diff options
author | rathnor <rathnor> | 2003-09-29 14:58:15 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-09-29 14:58:15 (GMT) |
commit | 81378f9494db4ab1d033947532d7fac968095ecd (patch) | |
tree | 0980a0ed9e2ebcbb2d7b7c88d6fbe1d98ab06dd2 /src/Window.cc | |
parent | 15dfe811124e3f1be7d9a802290372427dae5afb (diff) | |
download | fluxbox_pavel-81378f9494db4ab1d033947532d7fac968095ecd.zip fluxbox_pavel-81378f9494db4ab1d033947532d7fac968095ecd.tar.bz2 |
fix handling of base_Width/height hints in wm_normal_hints
- fixes abiword resize issues
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 59 |
1 files changed, 15 insertions, 44 deletions
diff --git a/src/Window.cc b/src/Window.cc index 193f689..e6ff0c6 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.235 2003/09/29 12:53:58 rathnor Exp $ | 25 | // $Id: Window.cc,v 1.236 2003/09/29 14:58:15 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -2437,11 +2437,11 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2437 | 2437 | ||
2438 | fixsize(&gx, &gy); | 2438 | fixsize(&gx, &gy); |
2439 | 2439 | ||
2440 | // draw resize rectangle | 2440 | // draw resize rectangle |
2441 | parent().drawRectangle(screen().rootTheme().opGC(), | 2441 | parent().drawRectangle(screen().rootTheme().opGC(), |
2442 | m_last_resize_x, m_last_resize_y, | 2442 | m_last_resize_x, m_last_resize_y, |
2443 | m_last_resize_w - 1 + 2 * frame().window().borderWidth(), | 2443 | m_last_resize_w - 1 + 2 * frame().window().borderWidth(), |
2444 | m_last_resize_h - 1 + 2 * frame().window().borderWidth()); | 2444 | m_last_resize_h - 1 + 2 * frame().window().borderWidth()); |
2445 | 2445 | ||
2446 | if (screen().doShowWindowPos()) | 2446 | if (screen().doShowWindowPos()) |
2447 | screen().showGeometry(gx, gy); | 2447 | screen().showGeometry(gx, gy); |
@@ -3166,7 +3166,7 @@ void FluxboxWindow::downsize() { | |||
3166 | } | 3166 | } |
3167 | 3167 | ||
3168 | 3168 | ||
3169 | void FluxboxWindow::fixsize(int *gx, int *gy) { | 3169 | void FluxboxWindow::fixsize(int *user_w, int *user_h) { |
3170 | int titlebar_height = (decorations.titlebar ? | 3170 | int titlebar_height = (decorations.titlebar ? |
3171 | frame().titlebar().height() + | 3171 | frame().titlebar().height() + |
3172 | frame().titlebar().borderWidth() : 0); | 3172 | frame().titlebar().borderWidth() : 0); |
@@ -3177,49 +3177,20 @@ void FluxboxWindow::fixsize(int *gx, int *gy) { | |||
3177 | 3177 | ||
3178 | // dx is new width = current width + difference between new and old x values | 3178 | // dx is new width = current width + difference between new and old x values |
3179 | //int dx = frame().width() + frame().x() - m_last_resize_x; | 3179 | //int dx = frame().width() + frame().x() - m_last_resize_x; |
3180 | int dx = m_last_resize_w - m_client->base_width; | 3180 | int dw = m_last_resize_w; |
3181 | 3181 | ||
3182 | // dy = new height (w/o decorations), similarly | 3182 | // dy = new height (w/o decorations), similarly |
3183 | int dy = m_last_resize_h - m_client->base_height - decoration_height; | 3183 | int dh = m_last_resize_h - decoration_height; |
3184 | 3184 | ||
3185 | // check minimum size | 3185 | m_client->applySizeHints(dw, dh, user_w, user_h); |
3186 | if (dx < static_cast<signed int>(m_client->min_width)) | ||
3187 | dx = m_client->min_width; | ||
3188 | if (dy < static_cast<signed int>(m_client->min_height)) | ||
3189 | dy = m_client->min_height; | ||
3190 | |||
3191 | // check maximum size | ||
3192 | if (m_client->max_width > 0 && dx > static_cast<signed int>(m_client->max_width)) | ||
3193 | dx = m_client->max_width; | ||
3194 | if (m_client->max_height > 0 && dy > static_cast<signed int>(m_client->max_height)) | ||
3195 | dy = m_client->max_height; | ||
3196 | |||
3197 | // make sure we have valid increment | ||
3198 | if (m_client->width_inc == 0) | ||
3199 | m_client->width_inc = 1; | ||
3200 | if (m_client->height_inc == 0) | ||
3201 | m_client->height_inc = 1; | ||
3202 | |||
3203 | // set snapping | ||
3204 | dx /= m_client->width_inc; | ||
3205 | dy /= m_client->height_inc; | ||
3206 | |||
3207 | // set return values | ||
3208 | if (gx != 0) | ||
3209 | *gx = dx; | ||
3210 | if (gy != 0) | ||
3211 | *gy = dy; | ||
3212 | |||
3213 | // snapping | ||
3214 | dx = dx * m_client->width_inc + m_client->base_width; | ||
3215 | dy = dy * m_client->height_inc + m_client->base_height + decoration_height; | ||
3216 | 3186 | ||
3217 | // update last resize | 3187 | // update last resize |
3218 | m_last_resize_w = dx; | 3188 | m_last_resize_w = dw; |
3219 | m_last_resize_h = dy; | 3189 | m_last_resize_h = dh + decoration_height; |
3220 | 3190 | ||
3191 | // move X if necessary | ||
3221 | if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM) { | 3192 | if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM) { |
3222 | m_last_resize_x = frame().x() + frame().width() - m_last_resize_w; | 3193 | m_last_resize_x = frame().x() + frame().width() - m_last_resize_w; |
3223 | } | 3194 | } |
3224 | 3195 | ||
3225 | if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP) { | 3196 | if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP) { |