client, wibox: go back to unmap style banning

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-05-19 14:49:22 +02:00
parent 3926f62ea3
commit 90bc90fde4
6 changed files with 22 additions and 80 deletions

View File

@ -156,7 +156,7 @@ scan(void)
state = window_state_get_reply(state_wins[i]);
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)
{
geom_wins[i] = NULL;
@ -177,6 +177,9 @@ scan(void)
*(geom_wins[i]), NULL)))
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);
p_delete(&geom_r);

View File

@ -204,14 +204,7 @@ client_ban(client_t *c)
{
if(!c->isbanned)
{
/* Move all clients out of the physical viewport into negative coordinate space. */
/* 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);
xcb_unmap_window(globalconf.connection, c->win);
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;
/* consider the window banned */
c->isbanned = true;
/* Initial values */
c->win = w;
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);
/* Move window outside the viewport before mapping it. */
client_ban(c);
xcb_map_window(globalconf.connection, c->win);
if(!startup)
spawn_start_notify(c);
@ -718,15 +710,6 @@ client_resize(client_t *c, area_t geometry, bool hints)
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_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y
| XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
@ -993,18 +976,7 @@ client_unban(client_t *c)
{
if(c->isbanned)
{
/* Move the client back where it belongs. */
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);
xcb_map_window(globalconf.connection, c->win);
c->isbanned = false;
}

12
event.c
View File

@ -264,17 +264,6 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
ev->value_mask &= ~(XCB_CONFIG_WINDOW_SIBLING |
XCB_CONFIG_WINDOW_STACK_MODE);
if(c->isbanned)
{
/* We'll be sending protocol geometry, so don't readd borders and titlebar. */
/* 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);
@ -286,7 +275,6 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
window_configure(c->win, geometry, c->border);
}
}
}
else
event_handle_configurerequest_configure_window(ev);

View File

@ -68,13 +68,7 @@ titlebar_ban(wibox_t *titlebar)
simple_window_t *sw = &titlebar->sw;
if(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);
}
xcb_unmap_window(globalconf.connection, sw->window);
/* Remove titlebar geometry from client. */
if((c = client_getbytitlebar(titlebar)))
@ -99,14 +93,7 @@ titlebar_unban(wibox_t *titlebar)
simple_window_t *sw = &titlebar->sw;
if(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);
}
xcb_map_window(globalconf.connection, sw->window);
titlebar->isbanned = false;

View File

@ -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.
* 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)
{
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.
* 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)
{
case Top:

10
wibox.h
View File

@ -83,16 +83,8 @@ wibox_t * wibox_getbywin(xcb_window_t);
static inline void
wibox_moveresize(wibox_t *wibox, area_t geometry)
{
if(wibox->sw.window && !wibox->isbanned)
if(wibox->sw.window)
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
wibox->sw.geometry = geometry;
wibox->need_update = true;