From 15d615853671b0988b9a87720cac2762c702f28b Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 13 Jun 2007 15:07:49 +0000 Subject: [PATCH] don't force reconfigure in a number of places, also eat enter events when reconfiguring. yay --- openbox/client.c | 32 ++++++++++++++++++++++++-------- openbox/client.h | 2 +- openbox/event.c | 19 ++----------------- openbox/frame.c | 2 +- openbox/openbox.c | 2 +- openbox/screen.c | 16 ++-------------- 6 files changed, 31 insertions(+), 42 deletions(-) diff --git a/openbox/client.c b/openbox/client.c index 152f2316..f70ab445 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -1749,7 +1749,8 @@ void client_setup_decor_and_functions(ObClient *self, gboolean reconfig) client_change_allowed_actions(self); if (reconfig) - client_reconfigure(self); + /* force reconfigure to make sure decorations are updated */ + client_reconfigure(self, TRUE); } static void client_change_allowed_actions(ObClient *self) @@ -1807,11 +1808,25 @@ static void client_change_allowed_actions(ObClient *self) } } -void client_reconfigure(ObClient *self) +void client_reconfigure(ObClient *self, gboolean force) { - client_configure(self, self->area.x, self->area.y, - self->area.width, self->area.height, - FALSE, TRUE); + gint x, y, w, h, lw, lh; + + /* 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 */ + RECT_TO_DIMS(self->area, x, y, w, h); + if (!force) + client_try_configure(self, &x, &y, &w, &h, &lw, &lh, FALSE); + if (force || !RECT_EQUAL_DIMS(self->area, x, y, w, h)) { + gulong ignore_start; + + ob_debug("Reconfiguring client x %d y %d w %d h %d\n", + x, y, w, h); + ignore_start = event_start_ignore_all_enters(); + client_configure(self, x, y, w, h, FALSE, TRUE); + event_end_ignore_all_enters(ignore_start); + } } void client_update_wmhints(ObClient *self) @@ -3254,11 +3269,12 @@ void client_set_desktop_recursive(ObClient *self, /* raise if it was not already on the desktop */ if (old != DESKTOP_ALL) stacking_raise(CLIENT_AS_WINDOW(self)); - /* the new desktop's geometry may be different, so we may need to - resize, for example if we are maximized */ - client_reconfigure(self); if (STRUT_EXISTS(self->strut)) screen_update_areas(); + else + /* the new desktop's geometry may be different, so we may need to + resize, for example if we are maximized */ + client_reconfigure(self, FALSE); } /* move all transients */ diff --git a/openbox/client.h b/openbox/client.h index 98f9e6e4..a334ad2b 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -427,7 +427,7 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gboolean user, gboolean final); -void client_reconfigure(ObClient *self); +void client_reconfigure(ObClient *self, gboolean force); /*! Finds coordinates to keep a client on the screen. @param self The client diff --git a/openbox/event.c b/openbox/event.c index ccf4bb65..88cccdee 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1434,7 +1434,7 @@ static void event_handle_client(ObClient *client, XEvent *e) /* send a synthetic ConfigureNotify, cuz this is supposed to be like a ConfigureRequest. */ - client_reconfigure(client); + client_reconfigure(client, TRUE); } else ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_RESTACK_WINDOW sent for window %s " @@ -1481,27 +1481,12 @@ static void event_handle_client(ObClient *client, XEvent *e) msgtype = e->xproperty.atom; if (msgtype == XA_WM_NORMAL_HINTS) { - gint x, y, w, h, lw, lh; - ob_debug("Update NORMAL hints\n"); 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 */ - RECT_TO_DIMS(client->area, x, y, w, h); - client_try_configure(client, &x, &y, &w, &h, &lw, &lh, FALSE); - if (!RECT_EQUAL_DIMS(client->area, x, y, w, h)) { - gulong ignore_start; - - ob_debug("Configuring client x %d y %d w %d h %d\n", - x, y, w, h); - ignore_start = event_start_ignore_all_enters(); - client_configure(client, x, y, w, h, FALSE, TRUE); - event_end_ignore_all_enters(ignore_start); - } + client_reconfigure(client, FALSE); } else if (msgtype == XA_WM_HINTS) { client_update_wmhints(client); } else if (msgtype == XA_WM_TRANSIENT_FOR) { diff --git a/openbox/frame.c b/openbox/frame.c index 55a28413..9ecee818 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -1675,7 +1675,7 @@ void frame_end_iconify_animation(ObFrame *self) else { /* Send a ConfigureNotify when the animation is done, this fixes KDE's pager showing the window in the wrong place. */ - client_reconfigure(self->client); + client_reconfigure(self->client, TRUE); } /* we're not animating any more ! */ diff --git a/openbox/openbox.c b/openbox/openbox.c index e8d5ae4d..1e1e3bf0 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -337,7 +337,7 @@ gint main(gint argc, gchar **argv) frame_adjust_area(c->frame, TRUE, TRUE, FALSE); /* the decor sizes may have changed, so the windows may end up in new positions */ - client_reconfigure(c); + client_reconfigure(c, FALSE); } } diff --git a/openbox/screen.c b/openbox/screen.c index 3962fd2a..92d4d9a4 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -1206,20 +1206,8 @@ void screen_update_areas() dims, 4 * screen_num_desktops * screen_num_monitors); /* the area has changed, adjust all the windows if they need it */ - for (it = client_list; it; it = g_list_next(it)) { - gint x, y, w, h, lw, lh; - ObClient *client = it->data; - - RECT_TO_DIMS(client->area, x, y, w, h); - client_try_configure(client, &x, &y, &w, &h, &lw, &lh, FALSE); - if (!RECT_EQUAL_DIMS(client->area, x, y, w, h)) { - gulong ignore_start; - - ignore_start = event_start_ignore_all_enters(); - client_configure(client, x, y, w, h, FALSE, TRUE); - event_end_ignore_all_enters(ignore_start); - } - } + for (it = client_list; it; it = g_list_next(it)) + client_reconfigure(it->data, FALSE); g_free(dims); } -- 2.44.0