From b2105a62c378b013257cd1a79ea5a50b4a90a82f Mon Sep 17 00:00:00 2001 From: simonb Date: Mon, 17 Apr 2006 14:00:28 +0000 Subject: fix fbrun positioning code to use hints properly --- ChangeLog | 2 ++ util/fbrun/FbRun.cc | 8 ++++++-- util/fbrun/FbRun.hh | 5 +++-- util/fbrun/main.cc | 2 ++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5fddd45..8eebecd 100644 --- a/ChangeLog +++ b/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 diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc index 281b35f..41c7474 100644 --- a/util/fbrun/FbRun.cc +++ b/util/fbrun/FbRun.cc @@ -215,7 +215,6 @@ void FbRun::setTitle(const string &title) { void FbRun::resize(unsigned int width, unsigned int height) { FbTk::TextBox::resize(width, height); - setNoMaximize(); } void FbRun::redrawLabel() { @@ -285,7 +284,7 @@ void FbRun::keyPressEvent(XKeyEvent &ke) { 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 @@ void FbRun::setNoMaximize() { 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); } diff --git a/util/fbrun/FbRun.hh b/util/fbrun/FbRun.hh index fb23a3a..f34f691 100644 --- a/util/fbrun/FbRun.hh +++ b/util/fbrun/FbRun.hh @@ -66,6 +66,9 @@ public: void keyPressEvent(XKeyEvent &ev); ///@} + /// set no maximizable for this window + void lockPosition(bool size_too); + private: void nextHistoryItem(); void prevHistoryItem(); @@ -73,8 +76,6 @@ private: 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(); diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc index 06ec644..878b5eb 100644 --- a/util/fbrun/main.cc +++ b/util/fbrun/main.cc @@ -205,6 +205,8 @@ int main(int argc, char **argv) { if (set_pos) fbrun.move(x, y); + + fbrun.lockPosition(set_pos); fbrun.show(); -- cgit v0.11.2