From 6169a8e676530d433004edaa0cae4c5a9154d70a Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Tue, 19 Feb 2013 01:16:49 +0000 Subject: [PATCH] use global win/dpy in XEvent handler --- dunst.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/dunst.c b/dunst.c index 15e9d24..efd2c42 100644 --- a/dunst.c +++ b/dunst.c @@ -142,13 +142,9 @@ static gboolean x11_fd_check(GSource *source) static gboolean 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; - while (XPending(dpy) > 0) { - XNextEvent(dpy, &ev); + while (XPending(dc->dpy) > 0) { + XNextEvent(dc->dpy, &ev); switch (ev.type) { case Expose: if (ev.xexpose.count == 0 && visible) { @@ -159,7 +155,7 @@ x11_fd_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) break; case VisibilityNotify: if (ev.xvisibility.state != VisibilityUnobscured) - XRaiseWindow(dpy, win); + XRaiseWindow(dc->dpy, win); break; case ButtonPress: if (ev.xbutton.window == win) {