change when configurerequests create configurenotifies.

make _NET_RESTACK_WINDOW create a configurenotify, because it is supposed to be like configurerequest. so why not?
This commit is contained in:
Dana Jansens 2007-05-11 02:44:29 +00:00
parent b30478ed76
commit 58788b9c16

View file

@ -950,42 +950,90 @@ static void event_handle_client(ObClient *client, XEvent *e)
break; break;
} }
case ConfigureRequest: case ConfigureRequest:
{
/* dont compress these unless you're going to watch for property /* dont compress these unless you're going to watch for property
notifies in between (these can change what the configure would notifies in between (these can change what the configure would
do to the window). do to the window).
also you can't compress stacking events also you can't compress stacking events
*/ */
ob_debug("ConfigureRequest desktop %d wmstate %d vis %d\n",
screen_desktop, client->wmstate, client->frame->visible);
/* don't allow clients to move shaded windows (fvwm does this) */
if (client->shaded) {
e->xconfigurerequest.value_mask &= ~CWX;
e->xconfigurerequest.value_mask &= ~CWY;
}
/* resize, then move, as specified in the EWMH section 7.7 */
if (e->xconfigurerequest.value_mask & (CWWidth | CWHeight |
CWX | CWY |
CWBorderWidth)) {
gint x, y, w, h; gint x, y, w, h;
/* if nothing is changed, then a configurenotify is needed */
gboolean config = TRUE;
x = client->area.x;
y = client->area.y;
w = client->area.width;
h = client->area.height;
ob_debug("ConfigureRequest desktop %d wmstate %d visibile %d\n",
screen_desktop, client->wmstate, client->frame->visible);
if (e->xconfigurerequest.value_mask & CWBorderWidth) if (e->xconfigurerequest.value_mask & CWBorderWidth)
if (client->border_width != e->xconfigurerequest.border_width) {
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;
}
x = (e->xconfigurerequest.value_mask & CWX) ?
e->xconfigurerequest.x : client->area.x;
y = (e->xconfigurerequest.value_mask & CWY) ?
e->xconfigurerequest.y : client->area.y;
w = (e->xconfigurerequest.value_mask & CWWidth) ?
e->xconfigurerequest.width : client->area.width;
h = (e->xconfigurerequest.value_mask & CWHeight) ?
e->xconfigurerequest.height : client->area.height;
ob_debug("ConfigureRequest x %d %d y %d %d\n", if (e->xconfigurerequest.value_mask & CWStackMode) {
ObClient *sibling = NULL;
/* get the sibling */
if (e->xconfigurerequest.value_mask & CWSibling) {
ObWindow *win;
win = g_hash_table_lookup(window_map,
&e->xconfigurerequest.above);
if (WINDOW_IS_CLIENT(win) && WINDOW_AS_CLIENT(win) != client)
sibling = WINDOW_AS_CLIENT(win);
}
/* 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;
}
/* don't allow clients to move shaded windows (fvwm does this) */
if (client->shaded && (e->xconfigurerequest.value_mask & CWX ||
e->xconfigurerequest.value_mask & CWY))
{
e->xconfigurerequest.value_mask &= ~CWX;
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;
}
if (e->xconfigurerequest.value_mask & CWX ||
e->xconfigurerequest.value_mask & CWY ||
e->xconfigurerequest.value_mask & CWWidth ||
e->xconfigurerequest.value_mask & CWHeight)
{
if (e->xconfigurerequest.value_mask & CWX)
x = e->xconfigurerequest.x;
if (e->xconfigurerequest.value_mask & CWY)
y = e->xconfigurerequest.y;
if (e->xconfigurerequest.value_mask & CWWidth)
w = e->xconfigurerequest.width;
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;
}
ob_debug("ConfigureRequest x(%d) %d y(%d) %d w(%d) %d h(%d) %d\n",
e->xconfigurerequest.value_mask & CWX, x, e->xconfigurerequest.value_mask & CWX, x,
e->xconfigurerequest.value_mask & CWY, y); e->xconfigurerequest.value_mask & CWY, y,
e->xconfigurerequest.value_mask & CWWidth, w,
e->xconfigurerequest.value_mask & CWHeight, h);
/* check for broken apps moving to their root position /* check for broken apps moving to their root position
@ -1011,27 +1059,12 @@ static void event_handle_client(ObClient *client, XEvent *e)
y = client->area.y; y = client->area.y;
} }
if (config) {
client_find_onscreen(client, &x, &y, w, h, FALSE); client_find_onscreen(client, &x, &y, w, h, FALSE);
client_configure_full(client, x, y, w, h, FALSE, TRUE, TRUE); client_configure_full(client, x, y, w, h, FALSE, TRUE);
}
if (e->xconfigurerequest.value_mask & CWStackMode) {
ObClient *sibling = NULL;
/* get the sibling */
if (e->xconfigurerequest.value_mask & CWSibling) {
ObWindow *win;
win = g_hash_table_lookup(window_map,
&e->xconfigurerequest.above);
if (WINDOW_IS_CLIENT(win) && WINDOW_AS_CLIENT(win) != client)
sibling = WINDOW_AS_CLIENT(win);
}
/* activate it rather than just focus it */
stacking_restack_request(client, sibling,
e->xconfigurerequest.detail, TRUE);
} }
break; break;
}
case UnmapNotify: case UnmapNotify:
if (client->ignore_unmaps) { if (client->ignore_unmaps) {
client->ignore_unmaps--; client->ignore_unmaps--;
@ -1237,6 +1270,13 @@ static void event_handle_client(ObClient *client, XEvent *e)
/* just raise, don't activate */ /* just raise, don't activate */
stacking_restack_request(client, sibling, stacking_restack_request(client, sibling,
e->xclient.data.l[2], FALSE); e->xclient.data.l[2], FALSE);
/* send a synthetic ConfigureNotify, cuz this is supposed
to be like a ConfigureRequest. */
client_configure_full(client, client->area.x,
client->area.y,
client->area.width,
client->area.height,
FALSE, TRUE);
} else } else
ob_debug_type(OB_DEBUG_APP_BUGS, ob_debug_type(OB_DEBUG_APP_BUGS,
"_NET_RESTACK_WINDOW sent for window %s " "_NET_RESTACK_WINDOW sent for window %s "