diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/FbPixmap.cc | 15 | ||||
-rw-r--r-- | src/FbTk/FbWindow.cc | 8 | ||||
-rw-r--r-- | src/WinClient.cc | 25 | ||||
-rw-r--r-- | src/WinClient.hh | 2 | ||||
-rw-r--r-- | src/Window.cc | 9 |
5 files changed, 47 insertions, 12 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc index 9143232..0289ddd 100644 --- a/src/FbTk/FbPixmap.cc +++ b/src/FbTk/FbPixmap.cc | |||
@@ -114,13 +114,14 @@ FbPixmap &FbPixmap::operator = (Pixmap pm) { | |||
114 | Window root; | 114 | Window root; |
115 | int x, y; | 115 | int x, y; |
116 | unsigned int border_width, bpp; | 116 | unsigned int border_width, bpp; |
117 | XGetGeometry(display(), | 117 | if (!XGetGeometry(display(), |
118 | pm, | 118 | pm, |
119 | &root, | 119 | &root, |
120 | &x, &y, | 120 | &x, &y, |
121 | &m_width, &m_height, | 121 | &m_width, &m_height, |
122 | &border_width, | 122 | &border_width, |
123 | &bpp); | 123 | &bpp)) |
124 | return *this; | ||
124 | 125 | ||
125 | m_depth = bpp; | 126 | m_depth = bpp; |
126 | 127 | ||
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc index 3dce5b8..2c2bb24 100644 --- a/src/FbTk/FbWindow.cc +++ b/src/FbTk/FbWindow.cc | |||
@@ -582,10 +582,10 @@ void FbWindow::updateGeometry() { | |||
582 | 582 | ||
583 | Window root; | 583 | Window root; |
584 | unsigned int border_width, depth; | 584 | unsigned int border_width, depth; |
585 | XGetGeometry(display(), m_window, &root, &m_x, &m_y, | 585 | if (XGetGeometry(display(), m_window, &root, &m_x, &m_y, |
586 | (unsigned int *)&m_width, (unsigned int *)&m_height, | 586 | (unsigned int *)&m_width, (unsigned int *)&m_height, |
587 | &border_width, &depth); | 587 | &border_width, &depth)) |
588 | m_depth = depth; | 588 | m_depth = depth; |
589 | } | 589 | } |
590 | 590 | ||
591 | void FbWindow::create(Window parent, int x, int y, | 591 | void FbWindow::create(Window parent, int x, int y, |
diff --git a/src/WinClient.cc b/src/WinClient.cc index ddf0599..a9d5865 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc | |||
@@ -905,6 +905,31 @@ void WinClient::applySizeHints(int &width, int &height, | |||
905 | *display_height = j; | 905 | *display_height = j; |
906 | } | 906 | } |
907 | 907 | ||
908 | // check if the given width and height satisfy the size hints | ||
909 | bool WinClient::checkSizeHints(unsigned int width, unsigned int height) { | ||
910 | if (width < min_width || height < min_height) | ||
911 | return false; | ||
912 | |||
913 | if (width > max_width || height > max_height) | ||
914 | return false; | ||
915 | |||
916 | if ((width - base_width) % width_inc != 0) | ||
917 | return false; | ||
918 | |||
919 | if ((height - base_height) % height_inc != 0) | ||
920 | return false; | ||
921 | |||
922 | double ratio = (double)width / (double)height; | ||
923 | |||
924 | if (min_aspect_y > 0 && (double)min_aspect_x / (double)min_aspect_y > ratio) | ||
925 | return false; | ||
926 | |||
927 | if (max_aspect_y > 0 && (double)max_aspect_x / (double)max_aspect_y < ratio) | ||
928 | return false; | ||
929 | |||
930 | return true; | ||
931 | } | ||
932 | |||
908 | void WinClient::removeTransientFromWaitingList() { | 933 | void WinClient::removeTransientFromWaitingList() { |
909 | 934 | ||
910 | // holds the windows that dont have empty | 935 | // holds the windows that dont have empty |
diff --git a/src/WinClient.hh b/src/WinClient.hh index d3555d1..9c29e78 100644 --- a/src/WinClient.hh +++ b/src/WinClient.hh | |||
@@ -93,7 +93,7 @@ public: | |||
93 | */ | 93 | */ |
94 | void applySizeHints(int &width, int &height, int *display_width = 0, | 94 | void applySizeHints(int &width, int &height, int *display_width = 0, |
95 | int *display_height = 0, bool maximizing = false); | 95 | int *display_height = 0, bool maximizing = false); |
96 | 96 | bool checkSizeHints(unsigned int width, unsigned int height); | |
97 | 97 | ||
98 | void setGroupLeftWindow(Window win); | 98 | void setGroupLeftWindow(Window win); |
99 | 99 | ||
diff --git a/src/Window.cc b/src/Window.cc index e9d57c2..632c1e7 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -2570,6 +2570,15 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { | |||
2570 | int cx = frame().x(), cy = frame().y(), ignore = 0; | 2570 | int cx = frame().x(), cy = frame().y(), ignore = 0; |
2571 | unsigned int cw = frame().width(), ch = frame().height(); | 2571 | unsigned int cw = frame().width(), ch = frame().height(); |
2572 | 2572 | ||
2573 | // if this is not m_client and m_client has resize_inc, make sure the new | ||
2574 | // size would be ok with m_client | ||
2575 | if (client != m_client && cr.value_mask & CWWidth && | ||
2576 | cr.value_mask & CWHeight && | ||
2577 | !m_client->checkSizeHints(cr.width, cr.height)) { | ||
2578 | sendConfigureNotify(); | ||
2579 | return; | ||
2580 | } | ||
2581 | |||
2573 | if (cr.value_mask & CWBorderWidth) | 2582 | if (cr.value_mask & CWBorderWidth) |
2574 | client->old_bw = cr.border_width; | 2583 | client->old_bw = cr.border_width; |
2575 | 2584 | ||