use global win/dpy in XEvent handler
This commit is contained in:
parent
f0c9b71b97
commit
6169a8e676
10
dunst.c
10
dunst.c
@ -142,13 +142,9 @@ static gboolean x11_fd_check(GSource *source)
|
|||||||
static gboolean
|
static gboolean
|
||||||
x11_fd_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
|
x11_fd_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
|
||||||
{
|
{
|
||||||
Display *dpy = ((x11_source_t*)source)->dpy;
|
|
||||||
Window win = ((x11_source_t*)source)->w;
|
|
||||||
|
|
||||||
|
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
while (XPending(dpy) > 0) {
|
while (XPending(dc->dpy) > 0) {
|
||||||
XNextEvent(dpy, &ev);
|
XNextEvent(dc->dpy, &ev);
|
||||||
switch (ev.type) {
|
switch (ev.type) {
|
||||||
case Expose:
|
case Expose:
|
||||||
if (ev.xexpose.count == 0 && visible) {
|
if (ev.xexpose.count == 0 && visible) {
|
||||||
@ -159,7 +155,7 @@ x11_fd_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
|
|||||||
break;
|
break;
|
||||||
case VisibilityNotify:
|
case VisibilityNotify:
|
||||||
if (ev.xvisibility.state != VisibilityUnobscured)
|
if (ev.xvisibility.state != VisibilityUnobscured)
|
||||||
XRaiseWindow(dpy, win);
|
XRaiseWindow(dc->dpy, win);
|
||||||
break;
|
break;
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
if (ev.xbutton.window == win) {
|
if (ev.xbutton.window == win) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user