all repos — openbox @ 8f87a8af62c092617e7b5f4733d18ed11109f2ac

openbox fork - make it a bit more like ryudo

only send configure notify when they requested a move, or if we are actually changing anything.
that is: if they only request a resize and nothing changes, don't do anything and dont send a configurenotify. this fixes the emacs event storm

also some new macros for rects
Dana Jansens danakj@orodu.net
commit

8f87a8af62c092617e7b5f4733d18ed11109f2ac

parent

4c25342316a3d55f7c2e44b879c38bfca8b69053

2 files changed, 51 insertions(+), 25 deletions(-)

jump to
M openbox/event.copenbox/event.c

@@ -993,14 +993,11 @@ also you can't compress stacking events

*/ gint x, y, w, h; - - /* if nothing is changed, then a configurenotify is needed */ - gboolean config = TRUE; + gboolean move = FALSE; + gboolean resize = FALSE; - x = client->area.x; - y = client->area.y; - w = client->area.width; - h = client->area.height; + /* get the current area */ + RECT_TO_DIMS(client->area, x, y, w, h); ob_debug("ConfigureRequest desktop %d wmstate %d visibile %d\n", screen_desktop, client->wmstate, client->frame->visible);

@@ -1008,8 +1005,13 @@

if (e->xconfigurerequest.value_mask & CWBorderWidth) if (client->border_width != e->xconfigurerequest.border_width) { client->border_width = e->xconfigurerequest.border_width; - /* if only the border width is changing, then it's not needed*/ - config = FALSE; + + /* if the border width is changing then that is the same + as requesting a resize, but we don't actually change + the client's border, so it will change their root + coordiantes (since they include the border width) and + we need to a notify then */ + move = TRUE; }

@@ -1029,8 +1031,8 @@ /* activate it rather than just focus it */

stacking_restack_request(client, sibling, e->xconfigurerequest.detail, TRUE); - /* if a stacking change is requested then it is needed */ - config = TRUE; + /* if a stacking change moves the window without resizing */ + move = TRUE; } /* don't allow clients to move shaded windows (fvwm does this) */

@@ -1042,7 +1044,7 @@ e->xconfigurerequest.value_mask &= ~CWY;

/* if the client tried to move and we aren't letting it then a synthetic event is needed */ - config = TRUE; + move = TRUE; } if (e->xconfigurerequest.value_mask & CWX ||

@@ -1050,25 +1052,31 @@ e->xconfigurerequest.value_mask & CWY ||

e->xconfigurerequest.value_mask & CWWidth || e->xconfigurerequest.value_mask & CWHeight) { - if (e->xconfigurerequest.value_mask & CWX) + if (e->xconfigurerequest.value_mask & CWX) { x = e->xconfigurerequest.x; - if (e->xconfigurerequest.value_mask & CWY) + move = TRUE; + } + if (e->xconfigurerequest.value_mask & CWY) { y = e->xconfigurerequest.y; - if (e->xconfigurerequest.value_mask & CWWidth) + move = TRUE; + } + if (e->xconfigurerequest.value_mask & CWWidth) { w = e->xconfigurerequest.width; - if (e->xconfigurerequest.value_mask & CWHeight) + resize = TRUE; + } + if (e->xconfigurerequest.value_mask & CWHeight) { h = e->xconfigurerequest.height; - - /* if a new position or size is requested, then a configure is - needed */ - config = TRUE; + resize = TRUE; + } } - ob_debug("ConfigureRequest x(%d) %d y(%d) %d w(%d) %d h(%d) %d\n", + ob_debug("ConfigureRequest x(%d) %d y(%d) %d w(%d) %d h(%d) %d " + "move %d resize %d\n", e->xconfigurerequest.value_mask & CWX, x, e->xconfigurerequest.value_mask & CWY, y, e->xconfigurerequest.value_mask & CWWidth, w, - e->xconfigurerequest.value_mask & CWHeight, h); + e->xconfigurerequest.value_mask & CWHeight, h, + move, resize); /* check for broken apps moving to their root position

@@ -1077,7 +1085,8 @@ kde apps do this when they try activate themselves on another

desktop. eg. open amarok window on desktop 1, switch to desktop 2, click amarok tray icon. it will move by its decoration size. */ - if (x != client->area.x && + if (move && !resize && + x != client->area.x && x == (client->frame->area.x + client->frame->size.left - (gint)client->border_width) && y != client->area.y &&

@@ -1092,11 +1101,23 @@ client->title);

/* don't move it */ x = client->area.x; y = client->area.y; + + /* they still requested a move, so don't change whether a + notify is sent or not */ } - if (config) { + if (move || resize) { + gint lw,lh; + client_find_onscreen(client, &x, &y, w, h, FALSE); - client_configure(client, x, y, w, h, FALSE, TRUE); + client_try_configure(client, &x, &y, &w, &h, &lw, &lh, FALSE); + /* if they requested something that moves the window, or if + the window is actually being changed then configure it and + send a configure notify to them */ + if (move || !RECT_EQUAL_DIMS(client->area, x, y, w, h)) { + ob_debug("Doing configure\n"); + client_configure(client, x, y, w, h, FALSE, TRUE); + } /* ignore enter events caused by these like ob actions do */ event_ignore_all_queued_enters();
M openbox/geom.hopenbox/geom.h

@@ -57,6 +57,11 @@

#define RECT_EQUAL(r1, r2) ((r1).x == (r2).x && (r1).y == (r2).y && \ (r1).width == (r2).width && \ (r1).height == (r2).height) +#define RECT_EQUAL_DIMS(r, x, y, w, h) \ + ((r).x == (x) && (r).y == (y) && (r).width == (w) && (r).height == (h)) + +#define RECT_TO_DIMS(r, x, y, w, h) \ + (x) = (r).x, (y) = (r).y, (w) = (r).width, (h) = (r).height #define RECT_CONTAINS(r, px, py) \ ((px) >= (r).x && (px) < (r).x + (r).width && \