summaryrefslogtreecommitdiff
path: root/src/ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui.c')
-rw-r--r--src/ui.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ui.c b/src/ui.c
index 19cbe9cf..cc067e3f 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -70,26 +70,29 @@ struct _EventFunc
int last_event_serial;
};
+static EventFunc *ef = NULL;
+
static GdkFilterReturn
filter_func (GdkXEvent *xevent,
GdkEvent *event,
gpointer data)
{
- EventFunc *ef;
-
- ef = data;
+ g_return_if_fail (ef != NULL);
if ((* ef->func) (xevent, ef->data))
return GDK_FILTER_REMOVE;
else
{
- ef->last_event_serial = ((XEvent*)xevent)->xany.serial;
+ /* ef would be NULL here if we removed the filter function
+ * in response to the event.
+ */
+ if (ef != NULL)
+ ef->last_event_serial = ((XEvent*)xevent)->xany.serial;
+
return GDK_FILTER_CONTINUE;
}
}
-static EventFunc *ef = NULL;
-
void
meta_ui_add_event_func (Display *xdisplay,
MetaEventFunc func,