always grab Button1

This commit is contained in:
Julien Danjou 2008-01-26 13:11:12 +01:00
parent f9c9bc53c6
commit 37b4f62258
4 changed files with 15 additions and 18 deletions

View File

@ -187,7 +187,6 @@ focus(Client *c, int screen, Bool from_mouse)
if(globalconf.focus->client) if(globalconf.focus->client)
client_unfocus(globalconf.focus->client); client_unfocus(globalconf.focus->client);
if(c) if(c)
{ {
/* save sel in focus history */ /* save sel in focus history */
@ -199,6 +198,9 @@ focus(Client *c, int screen, Bool from_mouse)
|| !globalconf.screens[screen].sloppy_focus || !globalconf.screens[screen].sloppy_focus
|| globalconf.screens[screen].sloppy_focus_raise) || globalconf.screens[screen].sloppy_focus_raise)
XRaiseWindow(globalconf.display, c->win); XRaiseWindow(globalconf.display, c->win);
/* since we're dropping EnterWindow events and sometimes the window
* will appear under the mouse, grabbuttons */
window_grabbuttons(phys_screen, c->win);
} }
else else
XSetInputFocus(globalconf.display, XSetInputFocus(globalconf.display,

View File

@ -122,7 +122,7 @@ handle_event_buttonpress(XEvent *e)
&& ev->button == Button1) && ev->button == Button1)
{ {
XAllowEvents(globalconf.display, ReplayPointer, CurrentTime); XAllowEvents(globalconf.display, ReplayPointer, CurrentTime);
window_grabbuttons(get_phys_screen(c->screen), c->win, True); window_grabbuttons(get_phys_screen(c->screen), c->win);
} }
else else
handle_mouse_button_press(c->screen, ev->button, ev->state, globalconf.buttons.client, NULL); handle_mouse_button_press(c->screen, ev->button, ev->state, globalconf.buttons.client, NULL);
@ -228,7 +228,7 @@ handle_event_enternotify(XEvent * e)
if((c = get_client_bywin(globalconf.clients, ev->window))) if((c = get_client_bywin(globalconf.clients, ev->window)))
{ {
window_grabbuttons(get_phys_screen(c->screen), c->win, False); window_grabbuttons(get_phys_screen(c->screen), c->win);
if(globalconf.screens[c->screen].sloppy_focus) if(globalconf.screens[c->screen].sloppy_focus)
focus(c, c->screen, True); focus(c, c->screen, True);
} }

View File

@ -89,16 +89,12 @@ window_configure(Window win, Area geometry, int border)
/** Grab or ungrab buttons on a window /** Grab or ungrab buttons on a window
* \param screen The screen * \param screen The screen
* \param win The window * \param win The window
* \param focused True if client is focused
* \param raised True if the client is above other clients
*/ */
void void
window_grabbuttons(int screen, Window win, Bool raised) window_grabbuttons(int screen, Window win)
{ {
Button *b; Button *b;
if(!raised)
{
XGrabButton(globalconf.display, Button1, NoSymbol, XGrabButton(globalconf.display, Button1, NoSymbol,
win, False, BUTTONMASK, GrabModeSync, GrabModeAsync, None, None); win, False, BUTTONMASK, GrabModeSync, GrabModeAsync, None, None);
XGrabButton(globalconf.display, Button1, NoSymbol | LockMask, XGrabButton(globalconf.display, Button1, NoSymbol | LockMask,
@ -107,7 +103,6 @@ window_grabbuttons(int screen, Window win, Bool raised)
win, False, BUTTONMASK, GrabModeSync, GrabModeAsync, None, None); win, False, BUTTONMASK, GrabModeSync, GrabModeAsync, None, None);
XGrabButton(globalconf.display, Button1, NoSymbol | globalconf.numlockmask | LockMask, XGrabButton(globalconf.display, Button1, NoSymbol | globalconf.numlockmask | LockMask,
win, False, BUTTONMASK, GrabModeSync, GrabModeAsync, None, None); win, False, BUTTONMASK, GrabModeSync, GrabModeAsync, None, None);
}
for(b = globalconf.buttons.client; b; b = b->next) for(b = globalconf.buttons.client; b; b = b->next)
{ {

View File

@ -27,7 +27,7 @@
int window_setstate(Window, long); int window_setstate(Window, long);
long window_getstate(Window); long window_getstate(Window);
Status window_configure(Window, Area, int); Status window_configure(Window, Area, int);
void window_grabbuttons(int, Window, Bool); void window_grabbuttons(int, Window);
void window_root_grabbuttons(int); void window_root_grabbuttons(int);
void window_setshape(int, Window); void window_setshape(int, Window);
int window_settrans(Window, double); int window_settrans(Window, double);