Split restack function out of focus, and fix click-to-raise
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
c39d8c2a7e
commit
c5afa7753b
33
client.c
33
client.c
|
@ -211,9 +211,26 @@ client_focus(Client *c, int screen, Bool raise)
|
||||||
titlebar_update(c);
|
titlebar_update(c);
|
||||||
XSetInputFocus(globalconf.display, c->win, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(globalconf.display, c->win, RevertToPointerRoot, CurrentTime);
|
||||||
if(raise)
|
if(raise)
|
||||||
{
|
client_stack(c);
|
||||||
|
/* since we're dropping EnterWindow events and sometimes the window
|
||||||
|
* will appear under the mouse, grabbuttons */
|
||||||
|
window_grabbuttons(c->win, c->phys_screen);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
XSetInputFocus(globalconf.display,
|
||||||
|
RootWindow(globalconf.display, screen_virttophys(screen)),
|
||||||
|
RevertToPointerRoot, CurrentTime);
|
||||||
|
|
||||||
|
widget_invalidate_cache(screen, WIDGET_CACHE_CLIENTS);
|
||||||
|
ewmh_update_net_active_window(c->phys_screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
client_stack(Client *c)
|
||||||
|
{
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
Layout *curlay = layout_get_current(screen);
|
Layout *curlay = layout_get_current(c->screen);
|
||||||
|
|
||||||
if(c->isfloating || curlay->arrange == layout_floating)
|
if(c->isfloating || curlay->arrange == layout_floating)
|
||||||
{
|
{
|
||||||
XRaiseWindow(globalconf.display, c->win);
|
XRaiseWindow(globalconf.display, c->win);
|
||||||
|
@ -258,18 +275,6 @@ client_focus(Client *c, int screen, Bool raise)
|
||||||
wc.sibling = client->win;
|
wc.sibling = client->win;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* since we're dropping EnterWindow events and sometimes the window
|
|
||||||
* will appear under the mouse, grabbuttons */
|
|
||||||
window_grabbuttons(c->win, c->phys_screen);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
XSetInputFocus(globalconf.display,
|
|
||||||
RootWindow(globalconf.display, screen_virttophys(screen)),
|
|
||||||
RevertToPointerRoot, CurrentTime);
|
|
||||||
|
|
||||||
widget_invalidate_cache(screen, WIDGET_CACHE_CLIENTS);
|
|
||||||
ewmh_update_net_active_window(c->phys_screen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Manage a new client
|
/** Manage a new client
|
||||||
|
|
1
client.h
1
client.h
|
@ -28,6 +28,7 @@ Bool client_isvisible(Client *, int);
|
||||||
Client * client_get_bywin(Client *, Window);
|
Client * client_get_bywin(Client *, Window);
|
||||||
Client * client_get_byname(Client *, char *);
|
Client * client_get_byname(Client *, char *);
|
||||||
void client_focus(Client *, int, Bool);
|
void client_focus(Client *, int, Bool);
|
||||||
|
void client_stack(Client *);
|
||||||
void client_ban(Client *);
|
void client_ban(Client *);
|
||||||
void client_unban(Client *);
|
void client_unban(Client *);
|
||||||
void client_manage(Window, XWindowAttributes *, int);
|
void client_manage(Window, XWindowAttributes *, int);
|
||||||
|
|
5
event.c
5
event.c
|
@ -127,7 +127,7 @@ event_handle_buttonpress(XEvent *e)
|
||||||
|
|
||||||
if((c = client_get_bywin(globalconf.clients, ev->window)))
|
if((c = client_get_bywin(globalconf.clients, ev->window)))
|
||||||
{
|
{
|
||||||
client_focus(c, c->screen, True);
|
client_stack(c);
|
||||||
if(CLEANMASK(ev->state) == NoSymbol
|
if(CLEANMASK(ev->state) == NoSymbol
|
||||||
&& ev->button == Button1)
|
&& ev->button == Button1)
|
||||||
{
|
{
|
||||||
|
@ -266,8 +266,7 @@ event_handle_enternotify(XEvent *e)
|
||||||
window_grabbuttons(c->win, c->phys_screen);
|
window_grabbuttons(c->win, c->phys_screen);
|
||||||
if(globalconf.screens[c->screen].sloppy_focus)
|
if(globalconf.screens[c->screen].sloppy_focus)
|
||||||
client_focus(c, c->screen,
|
client_focus(c, c->screen,
|
||||||
(globalconf.screens[c->screen].sloppy_focus
|
globalconf.screens[c->screen].sloppy_focus_raise);
|
||||||
&& globalconf.screens[c->screen].sloppy_focus_raise));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||||
|
|
Loading…
Reference in New Issue