fix fbrun positioning code to use hints properly
simonb simonb
4 files changed,
13 insertions(+),
4 deletions(-)
M
ChangeLog
→
ChangeLog
@@ -1,6 +1,8 @@
(Format: Year/Month/Day) Changes for 0.9.16: *06/04/17: + * Fix fbrun position setting (-pos and -nearmouse args) (Simon) + util/fbrun/... FbRun.hh/cc main.cc * Resize the clock if the text gets too big, sf.net patch #1436406 (thanks Geoff Lywood - glywood at users.sourceforge.net) ClockTool.cc
M
util/fbrun/FbRun.cc
→
util/fbrun/FbRun.cc
@@ -215,7 +215,6 @@ }
void FbRun::resize(unsigned int width, unsigned int height) { FbTk::TextBox::resize(width, height); - setNoMaximize(); } void FbRun::redrawLabel() {@@ -285,7 +284,7 @@ }
clear(); } -void FbRun::setNoMaximize() { +void FbRun::lockPosition(bool size_too) { // we don't need to maximize this window XSizeHints sh; sh.flags = PMaxSize | PMinSize;@@ -293,6 +292,11 @@ sh.max_width = width();
sh.max_height = height(); sh.min_width = width(); sh.min_height = height(); + if (size_too) { + sh.flags |= USPosition; + sh.x = x(); + sh.y = y(); + } XSetWMNormalHints(m_display, window(), &sh); }
M
util/fbrun/FbRun.hh
→
util/fbrun/FbRun.hh
@@ -66,6 +66,9 @@ ///@{
void keyPressEvent(XKeyEvent &ev); ///@} + /// set no maximizable for this window + void lockPosition(bool size_too); + private: void nextHistoryItem(); void prevHistoryItem();@@ -73,8 +76,6 @@ void drawString(int x, int y, const char *text, size_t len);
void getSize(size_t &width, size_t &height); void createWindow(int x, int y, size_t width, size_t height); void redrawLabel(); - /// set no maximizable for this window - void setNoMaximize(); void insertCharacter(char key); void adjustStartPos();
M
util/fbrun/main.cc
→
util/fbrun/main.cc
@@ -205,6 +205,8 @@ }
if (set_pos) fbrun.move(x, y); + + fbrun.lockPosition(set_pos); fbrun.show();