event_handle_configurerequest: Add missing test

c->size_hints.win_gravity only contains something valid if the
XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY bit is set in the flags. Most likely
this wasn't noticed before, because most code just happens to
zero-initialize this field and gravity 0 is NorthWest, which does not do
anything.

Signed-off-by: Uli Schlachter <uli.schlachter@informatik.uni-oldenburg.de>
This commit is contained in:
Uli Schlachter 2018-08-20 10:40:58 +02:00
parent 62d27950fa
commit a54fea40ef
1 changed files with 4 additions and 2 deletions

View File

@ -374,11 +374,13 @@ event_handle_configurerequest(xcb_configure_request_event_t *ev)
if(ev->value_mask & XCB_CONFIG_WINDOW_X) if(ev->value_mask & XCB_CONFIG_WINDOW_X)
{ {
geometry.x = ev->x; geometry.x = ev->x;
if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY)
xwindow_translate_for_gravity(c->size_hints.win_gravity, deco_left, 0, deco_right, 0, &geometry.x, NULL); xwindow_translate_for_gravity(c->size_hints.win_gravity, deco_left, 0, deco_right, 0, &geometry.x, NULL);
} }
if(ev->value_mask & XCB_CONFIG_WINDOW_Y) if(ev->value_mask & XCB_CONFIG_WINDOW_Y)
{ {
geometry.y = ev->y; geometry.y = ev->y;
if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY)
xwindow_translate_for_gravity(c->size_hints.win_gravity, 0, deco_top, 0, deco_bottom, NULL, &geometry.y); xwindow_translate_for_gravity(c->size_hints.win_gravity, 0, deco_top, 0, deco_bottom, NULL, &geometry.y);
} }