[titlebar] Give focus when clicking with Button1

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-04-08 16:11:13 +02:00
parent 5a062eb0d3
commit 2f513459e2
1 changed files with 13 additions and 3 deletions

16
event.c
View File

@ -125,6 +125,19 @@ event_handle_buttonpress(XEvent *e)
return;
}
for(c = globalconf.clients; c; c = c->next)
if(c->titlebar.sw && c->titlebar.sw->window == ev->window)
{
if(!client_focus(c, c->screen, True))
client_stack(c);
if(CLEANMASK(ev->state) == NoSymbol
&& ev->button == Button1)
window_grabbuttons(c->win, c->phys_screen);
event_handle_mouse_button_press(c->screen, ev->button, ev->state,
globalconf.buttons.titlebar, NULL);
return;
}
if((c = client_get_bywin(globalconf.clients, ev->window)))
{
if(!client_focus(c, c->screen, True))
@ -140,9 +153,6 @@ event_handle_buttonpress(XEvent *e)
}
else
{
for(c = globalconf.clients; c; c = c->next)
if(c->titlebar.sw && c->titlebar.sw->window == ev->window)
event_handle_mouse_button_press(c->screen, ev->button, ev->state, globalconf.buttons.titlebar, NULL);
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
if(RootWindow(e->xany.display, screen) == ev->window
&& XQueryPointer(e->xany.display,