fix fbrun positioning code to use hints properly
This commit is contained in:
parent
a211ca912d
commit
b2105a62c3
4 changed files with 13 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -205,6 +205,8 @@ int main(int argc, char **argv) {
|
|||
|
||||
if (set_pos)
|
||||
fbrun.move(x, y);
|
||||
|
||||
fbrun.lockPosition(set_pos);
|
||||
|
||||
fbrun.show();
|
||||
|
||||
|
|
Loading…
Reference in a new issue