do try_configure to find out what width the window will actually be, before adjust the x/y based on gravity, if they didn't specify the x/y

This commit is contained in:
Dana Jansens 2007-05-28 01:42:50 +00:00
parent 33406a1c7f
commit 30912d467a

View file

@ -1008,8 +1008,12 @@ static void event_handle_client(ObClient *client, XEvent *e)
RECT_TO_DIMS(client->area, x, y, w, h); RECT_TO_DIMS(client->area, x, y, w, h);
b = client->border_width; b = client->border_width;
ob_debug("ConfigureRequest desktop %d wmstate %d visibile %d\n", ob_debug("ConfigureRequest for \"%s\" desktop %d wmstate %d "
screen_desktop, client->wmstate, client->frame->visible); "visibile %d\n"
" x %d y %d w %d h %d b %d\n",
client->title,
screen_desktop, client->wmstate, client->frame->visible,
x, y, w, h, b);
if (e->xconfigurerequest.value_mask & CWBorderWidth) if (e->xconfigurerequest.value_mask & CWBorderWidth)
if (client->border_width != e->xconfigurerequest.border_width) { if (client->border_width != e->xconfigurerequest.border_width) {
@ -1038,10 +1042,10 @@ static void event_handle_client(ObClient *client, XEvent *e)
move = TRUE; move = TRUE;
} }
if (e->xconfigurerequest.value_mask & CWX || if ((e->xconfigurerequest.value_mask & CWX) ||
e->xconfigurerequest.value_mask & CWY || (e->xconfigurerequest.value_mask & CWY) ||
e->xconfigurerequest.value_mask & CWWidth || (e->xconfigurerequest.value_mask & CWWidth) ||
e->xconfigurerequest.value_mask & CWHeight) (e->xconfigurerequest.value_mask & CWHeight))
{ {
if (e->xconfigurerequest.value_mask & CWX) { if (e->xconfigurerequest.value_mask & CWX) {
/* don't allow clients to move shaded windows (fvwm does this) /* don't allow clients to move shaded windows (fvwm does this)
@ -1061,20 +1065,10 @@ static void event_handle_client(ObClient *client, XEvent *e)
if (e->xconfigurerequest.value_mask & CWWidth) { if (e->xconfigurerequest.value_mask & CWWidth) {
w = e->xconfigurerequest.width; w = e->xconfigurerequest.width;
resize = TRUE; resize = TRUE;
/* if x was not given, then use gravity to figure out the new
x. the reference point should not be moved */
if (!(e->xconfigurerequest.value_mask & CWX))
client_gravity_resize_w(client, &x, client->area.width, w);
} }
if (e->xconfigurerequest.value_mask & CWHeight) { if (e->xconfigurerequest.value_mask & CWHeight) {
h = e->xconfigurerequest.height; h = e->xconfigurerequest.height;
resize = TRUE; resize = TRUE;
/* if y was not given, then use gravity to figure out the new
y. the reference point should not be moved */
if (!(e->xconfigurerequest.value_mask & CWY))
client_gravity_resize_h(client, &y, client->area.height,h);
} }
} }
@ -1118,8 +1112,20 @@ static void event_handle_client(ObClient *client, XEvent *e)
gint lw,lh; gint lw,lh;
if (move || resize) { if (move || resize) {
client_find_onscreen(client, &x, &y, w, h, FALSE);
client_try_configure(client, &x, &y, &w, &h, &lw, &lh, FALSE); client_try_configure(client, &x, &y, &w, &h, &lw, &lh, FALSE);
/* if x was not given, then use gravity to figure out the new
x. the reference point should not be moved */
if ((e->xconfigurerequest.value_mask & CWWidth &&
!(e->xconfigurerequest.value_mask & CWX)))
client_gravity_resize_w(client, &x, client->area.width, w);
/* if y was not given, then use gravity to figure out the new
y. the reference point should not be moved */
if ((e->xconfigurerequest.value_mask & CWHeight &&
!(e->xconfigurerequest.value_mask & CWY)))
client_gravity_resize_h(client, &y, client->area.height,h);
client_find_onscreen(client, &x, &y, w, h, FALSE);
} }
/* if they requested something that moves the window, or if /* if they requested something that moves the window, or if
the window is actually being changed then configure it and the window is actually being changed then configure it and
@ -1127,7 +1133,9 @@ static void event_handle_client(ObClient *client, XEvent *e)
if (move || !RECT_EQUAL_DIMS(client->area, x, y, w, h) || if (move || !RECT_EQUAL_DIMS(client->area, x, y, w, h) ||
border) border)
{ {
ob_debug("Doing configure\n"); ob_debug("Granting ConfigureRequest x %d y %d w %d h %d "
"b %d\n",
x, y, w, h, b);
client_configure(client, x, y, w, h, b, FALSE, TRUE); client_configure(client, x, y, w, h, b, FALSE, TRUE);
} }