event: fix configurerequest
- We have to be careful with geometry around protocol code. Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
0626d42396
commit
bd6e568083
9
client.c
9
client.c
|
@ -659,8 +659,9 @@ client_geometry_hints(client_t *c, area_t geometry)
|
|||
* \param c Client to resize.
|
||||
* \param geometry New window geometry.
|
||||
* \param hints Use size hints.
|
||||
* \return true if an actual resize occurred.
|
||||
*/
|
||||
void
|
||||
bool
|
||||
client_resize(client_t *c, area_t geometry, bool hints)
|
||||
{
|
||||
int new_screen;
|
||||
|
@ -687,7 +688,7 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
|||
geometry_internal = client_geometry_hints(c, geometry_internal);
|
||||
|
||||
if(geometry_internal.width == 0 || geometry_internal.height == 0)
|
||||
return;
|
||||
return false;
|
||||
|
||||
/* Also let client hints propegate to the "official" geometry. */
|
||||
geometry = titlebar_geometry_add(c->titlebar, c->border, geometry_internal);
|
||||
|
@ -732,7 +733,11 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
|||
|
||||
/* execute hook */
|
||||
hooks_property(c, "geometry");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set a client minimized, or not.
|
||||
|
|
2
client.h
2
client.h
|
@ -52,7 +52,7 @@ void client_ban(client_t *);
|
|||
void client_unban(client_t *);
|
||||
void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, bool);
|
||||
area_t client_geometry_hints(client_t *, area_t);
|
||||
void client_resize(client_t *, area_t, bool);
|
||||
bool client_resize(client_t *, area_t, bool);
|
||||
void client_unmanage(client_t *);
|
||||
void client_saveprops_tags(client_t *);
|
||||
void client_kill(client_t *);
|
||||
|
|
26
event.c
26
event.c
|
@ -297,37 +297,29 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
|
|||
/* We do have to ensure the windows don't end up in the visible screen. */
|
||||
geometry.x = - (geometry.width + 2*c->border);
|
||||
geometry.y = - (geometry.height + 2*c->border);
|
||||
window_configure(c->win, geometry, c->border);
|
||||
event_handle_configurerequest_configure_window(ev);
|
||||
}
|
||||
else
|
||||
{
|
||||
/** Configure request are sent with size relative to real (internal)
|
||||
* window size, i.e. without titlebars and borders. */
|
||||
geometry = titlebar_geometry_add(c->titlebar, c->border, geometry);
|
||||
}
|
||||
|
||||
if(geometry.x != c->geometry.x
|
||||
|| geometry.y != c->geometry.y
|
||||
|| geometry.width != c->geometry.width
|
||||
|| geometry.height != c->geometry.height)
|
||||
{
|
||||
if(c->isbanned)
|
||||
if(client_resize(c, geometry, false))
|
||||
{
|
||||
window_configure(c->win, geometry, c->border);
|
||||
event_handle_configurerequest_configure_window(ev);
|
||||
}
|
||||
else
|
||||
{
|
||||
client_resize(c, geometry, false);
|
||||
/* All the wiboxes (may) need to be repositioned. */
|
||||
if(client_hasstrut(c))
|
||||
wibox_update_positions();
|
||||
client_need_arrange(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Resize wasn't officially needed, but we don't want to break expectations. */
|
||||
geometry = titlebar_geometry_remove(c->titlebar, c->border, c->geometry);
|
||||
window_configure(c->win, geometry, c->border);
|
||||
}
|
||||
}
|
||||
else
|
||||
window_configure(c->win, geometry, c->border);
|
||||
}
|
||||
else
|
||||
event_handle_configurerequest_configure_window(ev);
|
||||
|
|
Loading…
Reference in New Issue