fix fbrun positioning code to use hints properly

This commit is contained in:
simonb 2006-04-17 14:00:28 +00:00
parent a211ca912d
commit b2105a62c3
4 changed files with 13 additions and 4 deletions

View file

@ -1,6 +1,8 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 0.9.16: Changes for 0.9.16:
*06/04/17: *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 * Resize the clock if the text gets too big, sf.net patch #1436406
(thanks Geoff Lywood - glywood at users.sourceforge.net) (thanks Geoff Lywood - glywood at users.sourceforge.net)
ClockTool.cc ClockTool.cc

View file

@ -215,7 +215,6 @@ void FbRun::setTitle(const string &title) {
void FbRun::resize(unsigned int width, unsigned int height) { void FbRun::resize(unsigned int width, unsigned int height) {
FbTk::TextBox::resize(width, height); FbTk::TextBox::resize(width, height);
setNoMaximize();
} }
void FbRun::redrawLabel() { void FbRun::redrawLabel() {
@ -285,7 +284,7 @@ void FbRun::keyPressEvent(XKeyEvent &ke) {
clear(); clear();
} }
void FbRun::setNoMaximize() { void FbRun::lockPosition(bool size_too) {
// we don't need to maximize this window // we don't need to maximize this window
XSizeHints sh; XSizeHints sh;
sh.flags = PMaxSize | PMinSize; sh.flags = PMaxSize | PMinSize;
@ -293,6 +292,11 @@ void FbRun::setNoMaximize() {
sh.max_height = height(); sh.max_height = height();
sh.min_width = width(); sh.min_width = width();
sh.min_height = height(); sh.min_height = height();
if (size_too) {
sh.flags |= USPosition;
sh.x = x();
sh.y = y();
}
XSetWMNormalHints(m_display, window(), &sh); XSetWMNormalHints(m_display, window(), &sh);
} }

View file

@ -66,6 +66,9 @@ public:
void keyPressEvent(XKeyEvent &ev); void keyPressEvent(XKeyEvent &ev);
///@} ///@}
/// set no maximizable for this window
void lockPosition(bool size_too);
private: private:
void nextHistoryItem(); void nextHistoryItem();
void prevHistoryItem(); void prevHistoryItem();
@ -73,8 +76,6 @@ private:
void getSize(size_t &width, size_t &height); void getSize(size_t &width, size_t &height);
void createWindow(int x, int y, size_t width, size_t height); void createWindow(int x, int y, size_t width, size_t height);
void redrawLabel(); void redrawLabel();
/// set no maximizable for this window
void setNoMaximize();
void insertCharacter(char key); void insertCharacter(char key);
void adjustStartPos(); void adjustStartPos();

View file

@ -205,6 +205,8 @@ int main(int argc, char **argv) {
if (set_pos) if (set_pos)
fbrun.move(x, y); fbrun.move(x, y);
fbrun.lockPosition(set_pos);
fbrun.show(); fbrun.show();