summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2009-11-21 14:17:02 -0500
committerDana Jansens <danakj@orodu.net>2009-11-21 14:24:17 -0500
commitca1a27bebac84dbc4f1c594612ac6348b94b53b4 (patch)
tree2eba26be19c7b44e3677ae2d052b91e69c346cb2
parentc828154886a40fa48b0545fd5d22e277f6d210e9 (diff)
Revert "Revert "make windows stay on screen when..."
Just kidding. This doesn't revert d81d54c7a977a034199f24fc8fa7433e634aaf91 but it redoes the work that patch reverted in a better, less intrusive, way.
-rw-r--r--openbox/event.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/openbox/event.c b/openbox/event.c
index e4292cbb..38b6bec2 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -1513,15 +1513,30 @@ static void event_handle_client(ObClient *client, XEvent *e)
msgtype = e->xproperty.atom;
if (msgtype == XA_WM_NORMAL_HINTS) {
+ int x, y, w, h, lw, lh;
+
ob_debug("Update NORMAL hints");
client_update_normal_hints(client);
/* normal hints can make a window non-resizable */
client_setup_decor_and_functions(client, FALSE);
- /* make sure the client's sizes are within its bounds, but only
- reconfigure the window if it needs to. emacs will update its
- normal hints every time it receives a conigurenotify */
- client_reconfigure(client, FALSE);
+ x = client->area.x;
+ y = client->area.y;
+ w = client->area.width;
+ h = client->area.height;
+
+ /* apply the new normal hints */
+ client_try_configure(client, &x, &y, &w, &h, &lw, &lh, FALSE);
+ /* make sure the window is visible, and if the window is resized
+ off-screen due to the normal hints changing then this will push
+ it back onto the screen. */
+ client_find_onscreen(client, &x, &y, w, h, FALSE);
+
+ /* make sure the client's sizes are within its bounds, but don't
+ make it reply with a configurenotify unless something changed.
+ emacs will update its normal hints every time it receives a
+ configurenotify */
+ client_configure(client, x, y, w, h, FALSE, TRUE, FALSE);
} else if (msgtype == OBT_PROP_ATOM(MOTIF_WM_HINTS)) {
client_get_mwm_hints(client);
/* This can override some mwm hints */