mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
add a common infra to drop events
This commit is contained in:
parent
6fce5830ff
commit
83a0a4daf8
5 changed files with 13 additions and 11 deletions
10
awesome.c
10
awesome.c
|
@ -394,6 +394,16 @@ main(int argc, char *argv[])
|
|||
XNextEvent(dpy, &ev);
|
||||
if(handler[ev.type])
|
||||
handler[ev.type](&ev); /* call handler */
|
||||
|
||||
/* drop events requested to */
|
||||
if(globalconf.drop_events)
|
||||
{
|
||||
/* need to resync */
|
||||
XSync(dpy, False);
|
||||
while(XCheckMaskEvent(dpy, globalconf.drop_events, &ev));
|
||||
globalconf.drop_events = NoEventMask;
|
||||
}
|
||||
|
||||
/* need to resync */
|
||||
XSync(dpy, False);
|
||||
}
|
||||
|
|
1
client.c
1
client.c
|
@ -217,6 +217,7 @@ focus(Client *c, Bool selscreen, int screen)
|
|||
RevertToPointerRoot, CurrentTime);
|
||||
|
||||
ewmh_update_net_active_window(phys_screen);
|
||||
globalconf.drop_events |= EnterWindowMask;
|
||||
}
|
||||
|
||||
/** Manage a new client
|
||||
|
|
8
event.c
8
event.c
|
@ -275,7 +275,6 @@ handle_event_keypress(XEvent * e)
|
|||
XKeyEvent *ev = &e->xkey;
|
||||
Window dummy;
|
||||
Key *k;
|
||||
XEvent event;
|
||||
|
||||
keysym = XKeycodeToKeysym(e->xany.display, (KeyCode) ev->keycode, 0);
|
||||
|
||||
|
@ -299,7 +298,6 @@ handle_event_keypress(XEvent * e)
|
|||
k->func(screen, k->arg);
|
||||
break;
|
||||
}
|
||||
while(XCheckMaskEvent(globalconf.display, EnterWindowMask, &event));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -333,7 +331,6 @@ handle_event_maprequest(XEvent *e)
|
|||
int screen, x, y, d;
|
||||
unsigned int m;
|
||||
Window dummy;
|
||||
XEvent event;
|
||||
|
||||
if(!XGetWindowAttributes(e->xany.display, ev->window, &wa))
|
||||
return;
|
||||
|
@ -346,8 +343,6 @@ handle_event_maprequest(XEvent *e)
|
|||
&dummy, &dummy, &x, &y, &d, &d, &m))
|
||||
screen = get_screen_bycoord(x, y);
|
||||
client_manage(ev->window, &wa, screen);
|
||||
/* do this to keep focused client */
|
||||
while(XCheckMaskEvent(globalconf.display, EnterWindowMask, &event));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -387,14 +382,11 @@ handle_event_unmapnotify(XEvent * e)
|
|||
{
|
||||
Client *c;
|
||||
XUnmapEvent *ev = &e->xunmap;
|
||||
XEvent event;
|
||||
|
||||
if((c = get_client_bywin(globalconf.clients, ev->window))
|
||||
&& ev->event == RootWindow(e->xany.display, get_phys_screen(c->screen))
|
||||
&& ev->send_event && window_getstate(c->win) == NormalState)
|
||||
client_unmanage(c);
|
||||
/* do this to keep focused client */
|
||||
while(XCheckMaskEvent(globalconf.display, EnterWindowMask, &event));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
3
screen.c
3
screen.c
|
@ -329,7 +329,6 @@ uicb_client_movetoscreen(int screen __attribute__ ((unused)), char *arg)
|
|||
{
|
||||
int new_screen, prev_screen;
|
||||
Client *sel = globalconf.focus->client;
|
||||
XEvent event;
|
||||
|
||||
if(!sel || !XineramaIsActive(globalconf.display))
|
||||
return;
|
||||
|
@ -348,7 +347,5 @@ uicb_client_movetoscreen(int screen __attribute__ ((unused)), char *arg)
|
|||
move_client_to_screen(sel, new_screen, True);
|
||||
move_mouse_pointer_to_screen(new_screen);
|
||||
focus(sel, True, sel->screen);
|
||||
/* drop EnterWindow event to keep focus */
|
||||
XCheckMaskEvent(globalconf.display, EnterWindowMask, &event);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
|
@ -324,6 +324,8 @@ struct AwesomeConf
|
|||
tag_client_node_t *tclink;
|
||||
/** Command line passed to awesome */
|
||||
char *argv;
|
||||
/** EventMask to drop before each XEvent treatement */
|
||||
long drop_events;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue