client, wibox: go back to unmap style banning
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
3926f62ea3
commit
90bc90fde4
|
@ -156,7 +156,7 @@ scan(void)
|
||||||
state = window_state_get_reply(state_wins[i]);
|
state = window_state_get_reply(state_wins[i]);
|
||||||
|
|
||||||
if(!attr_r || attr_r->override_redirect
|
if(!attr_r || attr_r->override_redirect
|
||||||
|| attr_r->map_state != XCB_MAP_STATE_VIEWABLE
|
|| attr_r->map_state == XCB_MAP_STATE_UNVIEWABLE
|
||||||
|| state == XCB_WM_STATE_WITHDRAWN)
|
|| state == XCB_WM_STATE_WITHDRAWN)
|
||||||
{
|
{
|
||||||
geom_wins[i] = NULL;
|
geom_wins[i] = NULL;
|
||||||
|
@ -177,6 +177,9 @@ scan(void)
|
||||||
*(geom_wins[i]), NULL)))
|
*(geom_wins[i]), NULL)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* The window can be mapped, so force it to be undrawn for startup */
|
||||||
|
xcb_unmap_window(globalconf.connection, wins[i]);
|
||||||
|
|
||||||
client_manage(wins[i], geom_r, phys_screen, true);
|
client_manage(wins[i], geom_r, phys_screen, true);
|
||||||
|
|
||||||
p_delete(&geom_r);
|
p_delete(&geom_r);
|
||||||
|
|
38
client.c
38
client.c
|
@ -204,14 +204,7 @@ client_ban(client_t *c)
|
||||||
{
|
{
|
||||||
if(!c->isbanned)
|
if(!c->isbanned)
|
||||||
{
|
{
|
||||||
/* Move all clients out of the physical viewport into negative coordinate space. */
|
xcb_unmap_window(globalconf.connection, c->win);
|
||||||
/* They will all be put on top of each other. */
|
|
||||||
uint32_t request[2] = { - (c->geometries.internal.width + 2 * c->border),
|
|
||||||
- (c->geometries.internal.height + 2 * c->border) };
|
|
||||||
|
|
||||||
xcb_configure_window(globalconf.connection, c->win,
|
|
||||||
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,
|
|
||||||
request);
|
|
||||||
|
|
||||||
c->isbanned = true;
|
c->isbanned = true;
|
||||||
|
|
||||||
|
@ -475,6 +468,9 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
||||||
|
|
||||||
c->phys_screen = phys_screen;
|
c->phys_screen = phys_screen;
|
||||||
|
|
||||||
|
/* consider the window banned */
|
||||||
|
c->isbanned = true;
|
||||||
|
|
||||||
/* Initial values */
|
/* Initial values */
|
||||||
c->win = w;
|
c->win = w;
|
||||||
c->geometry.x = wgeom->x;
|
c->geometry.x = wgeom->x;
|
||||||
|
@ -545,10 +541,6 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
||||||
*/
|
*/
|
||||||
window_state_set(c->win, XCB_WM_STATE_NORMAL);
|
window_state_set(c->win, XCB_WM_STATE_NORMAL);
|
||||||
|
|
||||||
/* Move window outside the viewport before mapping it. */
|
|
||||||
client_ban(c);
|
|
||||||
xcb_map_window(globalconf.connection, c->win);
|
|
||||||
|
|
||||||
if(!startup)
|
if(!startup)
|
||||||
spawn_start_notify(c);
|
spawn_start_notify(c);
|
||||||
|
|
||||||
|
@ -718,15 +710,6 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
||||||
|
|
||||||
titlebar_update_geometry(c);
|
titlebar_update_geometry(c);
|
||||||
|
|
||||||
/* The idea is to give a client a resize even when banned. */
|
|
||||||
/* We just have to move the (x,y) to keep it out of the viewport. */
|
|
||||||
/* This at least doesn't break expectations about events. */
|
|
||||||
if(c->isbanned)
|
|
||||||
{
|
|
||||||
geometry_internal.x = values[0] = - (geometry_internal.width + 2 * c->border);
|
|
||||||
geometry_internal.y = values[1] = - (geometry_internal.height + 2 * c->border);
|
|
||||||
}
|
|
||||||
|
|
||||||
xcb_configure_window(globalconf.connection, c->win,
|
xcb_configure_window(globalconf.connection, c->win,
|
||||||
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y
|
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y
|
||||||
| XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
|
| XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
|
||||||
|
@ -993,18 +976,7 @@ client_unban(client_t *c)
|
||||||
{
|
{
|
||||||
if(c->isbanned)
|
if(c->isbanned)
|
||||||
{
|
{
|
||||||
/* Move the client back where it belongs. */
|
xcb_map_window(globalconf.connection, c->win);
|
||||||
uint32_t request[] = { c->geometries.internal.x,
|
|
||||||
c->geometries.internal.y,
|
|
||||||
c->geometries.internal.width,
|
|
||||||
c->geometries.internal.height };
|
|
||||||
|
|
||||||
xcb_configure_window(globalconf.connection, c->win,
|
|
||||||
XCB_CONFIG_WINDOW_X
|
|
||||||
| XCB_CONFIG_WINDOW_Y
|
|
||||||
| XCB_CONFIG_WINDOW_WIDTH
|
|
||||||
| XCB_CONFIG_WINDOW_HEIGHT,
|
|
||||||
request);
|
|
||||||
|
|
||||||
c->isbanned = false;
|
c->isbanned = false;
|
||||||
}
|
}
|
||||||
|
|
28
event.c
28
event.c
|
@ -264,27 +264,15 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
|
||||||
ev->value_mask &= ~(XCB_CONFIG_WINDOW_SIBLING |
|
ev->value_mask &= ~(XCB_CONFIG_WINDOW_SIBLING |
|
||||||
XCB_CONFIG_WINDOW_STACK_MODE);
|
XCB_CONFIG_WINDOW_STACK_MODE);
|
||||||
|
|
||||||
if(c->isbanned)
|
/** Configure request are sent with size relative to real (internal)
|
||||||
{
|
* window size, i.e. without titlebars and borders. */
|
||||||
/* We'll be sending protocol geometry, so don't readd borders and titlebar. */
|
geometry = titlebar_geometry_add(c->titlebar, c->border, geometry);
|
||||||
/* We do have to ensure the windows don't end up in the visible screen. */
|
|
||||||
ev->x = geometry.x = - (geometry.width + 2*c->border);
|
|
||||||
ev->y = 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(!client_resize(c, geometry, false))
|
if(!client_resize(c, geometry, false))
|
||||||
{
|
{
|
||||||
/* Resize wasn't officially needed, but we don't want to break expectations. */
|
/* Resize wasn't officially needed, but we don't want to break expectations. */
|
||||||
geometry = titlebar_geometry_remove(c->titlebar, c->border, c->geometry);
|
geometry = titlebar_geometry_remove(c->titlebar, c->border, c->geometry);
|
||||||
window_configure(c->win, geometry, c->border);
|
window_configure(c->win, geometry, c->border);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
17
titlebar.c
17
titlebar.c
|
@ -68,13 +68,7 @@ titlebar_ban(wibox_t *titlebar)
|
||||||
simple_window_t *sw = &titlebar->sw;
|
simple_window_t *sw = &titlebar->sw;
|
||||||
|
|
||||||
if(sw->window)
|
if(sw->window)
|
||||||
{
|
xcb_unmap_window(globalconf.connection, sw->window);
|
||||||
uint32_t request[] = { - sw->geometry.width, - sw->geometry.height };
|
|
||||||
/* Move the titlebar to the same place as the window. */
|
|
||||||
xcb_configure_window(globalconf.connection, sw->window,
|
|
||||||
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,
|
|
||||||
request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove titlebar geometry from client. */
|
/* Remove titlebar geometry from client. */
|
||||||
if((c = client_getbytitlebar(titlebar)))
|
if((c = client_getbytitlebar(titlebar)))
|
||||||
|
@ -99,14 +93,7 @@ titlebar_unban(wibox_t *titlebar)
|
||||||
simple_window_t *sw = &titlebar->sw;
|
simple_window_t *sw = &titlebar->sw;
|
||||||
|
|
||||||
if(sw->window)
|
if(sw->window)
|
||||||
{
|
xcb_map_window(globalconf.connection, sw->window);
|
||||||
/* All resizing is done, so only move now. */
|
|
||||||
uint32_t request[] = { sw->geometry.x, sw->geometry.y };
|
|
||||||
|
|
||||||
xcb_configure_window(globalconf.connection, sw->window,
|
|
||||||
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,
|
|
||||||
request);
|
|
||||||
}
|
|
||||||
|
|
||||||
titlebar->isbanned = false;
|
titlebar->isbanned = false;
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ titlebar_geometry_add(wibox_t *t, int border, area_t geometry)
|
||||||
* This can then be substracted/added to the witdh/height/x/y.
|
* This can then be substracted/added to the witdh/height/x/y.
|
||||||
* In this case the border is included, because it belongs to a different window.
|
* In this case the border is included, because it belongs to a different window.
|
||||||
*/
|
*/
|
||||||
if(t && !t->isbanned)
|
if(t && t->isvisible)
|
||||||
switch(t->position)
|
switch(t->position)
|
||||||
{
|
{
|
||||||
case Top:
|
case Top:
|
||||||
|
@ -106,7 +106,7 @@ titlebar_geometry_remove(wibox_t *t, int border, area_t geometry)
|
||||||
* This can then be substracted/added to the witdh/height/x/y.
|
* This can then be substracted/added to the witdh/height/x/y.
|
||||||
* In this case the border is included, because it belongs to a different window.
|
* In this case the border is included, because it belongs to a different window.
|
||||||
*/
|
*/
|
||||||
if(t && !t->isbanned)
|
if(t && t->isvisible)
|
||||||
switch(t->position)
|
switch(t->position)
|
||||||
{
|
{
|
||||||
case Top:
|
case Top:
|
||||||
|
|
10
wibox.h
10
wibox.h
|
@ -83,16 +83,8 @@ wibox_t * wibox_getbywin(xcb_window_t);
|
||||||
static inline void
|
static inline void
|
||||||
wibox_moveresize(wibox_t *wibox, area_t geometry)
|
wibox_moveresize(wibox_t *wibox, area_t geometry)
|
||||||
{
|
{
|
||||||
if(wibox->sw.window && !wibox->isbanned)
|
if(wibox->sw.window)
|
||||||
simplewindow_moveresize(&wibox->sw, geometry);
|
simplewindow_moveresize(&wibox->sw, geometry);
|
||||||
else if(wibox->sw.window && wibox->isbanned)
|
|
||||||
{
|
|
||||||
area_t real_geom = geometry;
|
|
||||||
geometry.x = -geometry.width;
|
|
||||||
geometry.y = -geometry.height;
|
|
||||||
simplewindow_moveresize(&wibox->sw, geometry);
|
|
||||||
wibox->sw.geometry = real_geom;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
wibox->sw.geometry = geometry;
|
wibox->sw.geometry = geometry;
|
||||||
wibox->need_update = true;
|
wibox->need_update = true;
|
||||||
|
|
Loading…
Reference in New Issue