From a84eae27004062921acc47917dd35de0b917813f Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 12 Feb 2008 14:39:52 +0100 Subject: [PATCH] fix stacking issues --- client.c | 34 +++++++++++++++++++++++++++++----- mouse.c | 5 +---- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/client.c b/client.c index 83fc6a2a..4b9d0fb8 100644 --- a/client.c +++ b/client.c @@ -201,7 +201,24 @@ client_focus(Client *c, int screen, Bool raise) globalconf.screens[screen].colors_selected[ColBorder].pixel); XSetInputFocus(globalconf.display, c->win, RevertToPointerRoot, CurrentTime); if(raise) - XRaiseWindow(globalconf.display, c->win); + { + XWindowChanges wc; + Layout *curlay = layout_get_current(screen); + if(c->isfloating || curlay->arrange == layout_floating) + XRaiseWindow(globalconf.display, c->win); + else + { + Client *client; + wc.stack_mode = Below; + wc.sibling = c->win; + for(client = globalconf.clients; client; client = client->next) + if(client != c && IS_TILED(client, c->screen)) + { + XConfigureWindow(globalconf.display, client->win, CWSibling | CWStackMode, &wc); + wc.sibling = client->win; + } + } + } /* since we're dropping EnterWindow events and sometimes the window * will appear under the mouse, grabbuttons */ window_grabbuttons(phys_screen, c->win); @@ -530,11 +547,18 @@ client_setfloating(Client *c, Bool floating) if(c->isfloating != floating) { if((c->isfloating = floating)) - client_resize(c, c->f_geometry, False); - else if(c->ismax) { - c->ismax = False; - client_resize(c, c->m_geometry, False); + client_resize(c, c->f_geometry, False); + XRaiseWindow(globalconf.display, c->win); + } + else + { + XLowerWindow(globalconf.display, c->win); + if(c->ismax) + { + c->ismax = False; + client_resize(c, c->m_geometry, False); + } } if(client_isvisible(c, c->screen)) globalconf.screens[c->screen].need_arrange = True; diff --git a/mouse.c b/mouse.c index 45927144..5d3d2ca6 100644 --- a/mouse.c +++ b/mouse.c @@ -54,9 +54,6 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused))) if(!c) return; - /* go above everybody */ - XMapRaised(globalconf.display, c->win); - area = screen_get_area(c->screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding); @@ -127,7 +124,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused))) layout_refresh(); } if((target = client_get_bywin(globalconf.clients, child)) - && target != c) + && target != c && !target->isfloating) { client_list_swap(&globalconf.clients, c, target); globalconf.screens[c->screen].need_arrange = True;