Commit 8ecd420e authored by Benjamin Otte's avatar Benjamin Otte
Browse files

x11: Do dnd event handling via gdk_window_add_filter()

parent 180cd853
......@@ -1446,7 +1446,6 @@ _gdk_x11_display_open (const gchar *display_name)
#endif
gdk_x11_display_init_input (display);
_gdk_x11_display_init_dnd (display);
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
_gdk_x11_screen_setup (display_x11->screens[i]);
......
......@@ -3125,18 +3125,32 @@ xdnd_drop_filter (GdkXEvent *xev,
return GDK_FILTER_REMOVE;
}
void
_gdk_x11_display_init_dnd (GdkDisplay *display)
GdkFilterReturn
_gdk_x11_dnd_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data)
{
XEvent *xevent = (XEvent *) xev;
GdkDisplay *display;
int i;
if (!GDK_IS_X11_WINDOW (event->any.window))
return GDK_FILTER_CONTINUE;
if (xevent->type != ClientMessage)
return GDK_FILTER_CONTINUE;
display = GDK_WINDOW_DISPLAY (event->any.window);
for (i = 0; i < G_N_ELEMENTS (xdnd_filters); i++)
{
gdk_display_add_client_message_filter (
display,
gdk_atom_intern_static_string (xdnd_filters[i].atom_name),
xdnd_filters[i].func, NULL);
if (xevent->xclient.message_type != gdk_x11_get_xatom_by_name_for_display (display, xdnd_filters[i].atom_name))
continue;
return xdnd_filters[i].func (xev, event, data);
}
return GDK_FILTER_CONTINUE;
}
/* Source side */
......
......@@ -120,6 +120,9 @@ _gdk_x11_windowing_init (void)
gdk_window_add_filter (NULL,
_gdk_wm_protocols_filter,
NULL);
gdk_window_add_filter (NULL,
_gdk_x11_dnd_filter,
NULL);
}
GdkGrabStatus
......
......@@ -286,7 +286,10 @@ void _gdk_x11_precache_atoms (GdkDisplay *display,
const gchar * const *atom_names,
gint n_atoms);
void _gdk_x11_display_init_dnd (GdkDisplay *display);
GdkFilterReturn
_gdk_x11_dnd_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data);
void _gdk_x11_screen_init_root_window (GdkScreen *screen);
void _gdk_x11_screen_init_visuals (GdkScreen *screen);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment