diff options
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/x11/gdkdisplay-x11.c | 3 | ||||
-rw-r--r-- | gdk/x11/gdkdnd-x11.c | 20 | ||||
-rw-r--r-- | gdk/x11/gdkeventsource.c | 14 | ||||
-rw-r--r-- | gdk/x11/gdkmain-x11.c | 7 | ||||
-rw-r--r-- | gdk/x11/gdkprivate-x11.h | 5 |
5 files changed, 31 insertions, 18 deletions
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 75dde8f5ff..8608c540b9 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -2499,9 +2499,6 @@ gdk_x11_display_set_startup_notification_id (GdkDisplay *display, * The registered events must have the window field in the same place * as core X events (this is not the case for e.g. XKB extension events). * - * If an event type is registered, events of this type will go through - * global and window-specific filters (see gdk_window_add_filter()). - * Unregistered events will only go through global filters. * GDK may register the events of some X extensions on its own. * * This function should only be needed in unusual circumstances, e.g. diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index 329071650f..2b491e7377 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -1619,14 +1619,20 @@ xdnd_read_actions (GdkX11DragContext *context_x11) * to continually send actions. So we select on PropertyChangeMask * and add this filter. */ -static GdkFilterReturn +GdkFilterReturn xdnd_source_window_filter (GdkXEvent *xev, GdkEvent *event, - gpointer cb_data) + gpointer data) { XEvent *xevent = (XEvent *)xev; - GdkX11DragContext *context_x11 = cb_data; - GdkDisplay *display = gdk_drag_context_get_display (GDK_DRAG_CONTEXT (context_x11)); + GdkX11DragContext *context_x11; + GdkDisplay *display; + + if (!data) + return GDK_FILTER_CONTINUE; + + context_x11 = data; + display = gdk_drag_context_get_display (GDK_DRAG_CONTEXT (context_x11)); if ((xevent->xany.type == PropertyNotify) && (xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "XdndActionList"))) @@ -1656,13 +1662,11 @@ xdnd_manage_source_filter (GdkDragContext *context, gdk_window_set_events (window, gdk_window_get_events (window) | GDK_PROPERTY_CHANGE_MASK); - gdk_window_add_filter (window, xdnd_source_window_filter, context); + g_object_set_data (G_OBJECT (window), "xdnd-source-context", context); } else { - gdk_window_remove_filter (window, - xdnd_source_window_filter, - context); + g_object_set_data (G_OBJECT (window), "xdnd-source-context", NULL); /* Should we remove the GDK_PROPERTY_NOTIFY mask? * but we might want it for other reasons. (Like * INCR selection transactions). diff --git a/gdk/x11/gdkeventsource.c b/gdk/x11/gdkeventsource.c index ed20f4798d..e30a459b96 100644 --- a/gdk/x11/gdkeventsource.c +++ b/gdk/x11/gdkeventsource.c @@ -305,6 +305,14 @@ gdk_event_source_translate_event (GdkX11Display *x11_display, result = gdk_window_cache_filter (xevent, event, cache); } + if (result == GDK_FILTER_CONTINUE && + xevent->xany.window == XRootWindow (dpy, 0)) + result = _gdk_wm_protocols_filter ((GdkXEvent *)xevent, event, NULL); + + if (result == GDK_FILTER_CONTINUE && + xevent->xany.window == XRootWindow (dpy, 0)) + result = _gdk_x11_dnd_filter ((GdkXEvent *)xevent, event, NULL); + /* Run default filters */ if (result == GDK_FILTER_CONTINUE && _gdk_default_filters) @@ -313,6 +321,12 @@ gdk_event_source_translate_event (GdkX11Display *x11_display, result = gdk_event_apply_filters (xevent, event, NULL); } + if (result == GDK_FILTER_CONTINUE && filter_window) + { + gpointer context = g_object_get_data (G_OBJECT (filter_window), "xdnd-source-context"); + result = xdnd_source_window_filter ((GdkXEvent *)xevent, event, context); + } + if (result == GDK_FILTER_CONTINUE && filter_window && filter_window->filters) { diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index 669158d04b..72edfe1c09 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -106,13 +106,6 @@ _gdk_x11_windowing_init (void) { XSetErrorHandler (gdk_x_error); XSetIOErrorHandler (gdk_x_io_error); - - gdk_window_add_filter (NULL, - _gdk_wm_protocols_filter, - NULL); - gdk_window_add_filter (NULL, - _gdk_x11_dnd_filter, - NULL); } GdkGrabStatus diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 16acf68748..73f3f7159c 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -206,6 +206,11 @@ _gdk_x11_dnd_filter (GdkXEvent *xev, GdkEvent *event, gpointer data); +GdkFilterReturn +xdnd_source_window_filter (GdkXEvent *xev, + GdkEvent *event, + gpointer data); + typedef struct _GdkWindowCache GdkWindowCache; GdkWindowCache * |