mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-15 14:50:06 +00:00
x11: Do dnd event handling via gdk_window_add_filter()
This commit is contained in:
parent
180cd853fc
commit
8ecd420ede
@ -1446,7 +1446,6 @@ _gdk_x11_display_open (const gchar *display_name)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
gdk_x11_display_init_input (display);
|
gdk_x11_display_init_input (display);
|
||||||
_gdk_x11_display_init_dnd (display);
|
|
||||||
|
|
||||||
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
|
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
|
||||||
_gdk_x11_screen_setup (display_x11->screens[i]);
|
_gdk_x11_screen_setup (display_x11->screens[i]);
|
||||||
|
@ -3125,18 +3125,32 @@ xdnd_drop_filter (GdkXEvent *xev,
|
|||||||
return GDK_FILTER_REMOVE;
|
return GDK_FILTER_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
GdkFilterReturn
|
||||||
_gdk_x11_display_init_dnd (GdkDisplay *display)
|
_gdk_x11_dnd_filter (GdkXEvent *xev,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
|
XEvent *xevent = (XEvent *) xev;
|
||||||
|
GdkDisplay *display;
|
||||||
int i;
|
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++)
|
for (i = 0; i < G_N_ELEMENTS (xdnd_filters); i++)
|
||||||
{
|
{
|
||||||
gdk_display_add_client_message_filter (
|
if (xevent->xclient.message_type != gdk_x11_get_xatom_by_name_for_display (display, xdnd_filters[i].atom_name))
|
||||||
display,
|
continue;
|
||||||
gdk_atom_intern_static_string (xdnd_filters[i].atom_name),
|
|
||||||
xdnd_filters[i].func, NULL);
|
return xdnd_filters[i].func (xev, event, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return GDK_FILTER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Source side */
|
/* Source side */
|
||||||
|
@ -120,6 +120,9 @@ _gdk_x11_windowing_init (void)
|
|||||||
gdk_window_add_filter (NULL,
|
gdk_window_add_filter (NULL,
|
||||||
_gdk_wm_protocols_filter,
|
_gdk_wm_protocols_filter,
|
||||||
NULL);
|
NULL);
|
||||||
|
gdk_window_add_filter (NULL,
|
||||||
|
_gdk_x11_dnd_filter,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkGrabStatus
|
GdkGrabStatus
|
||||||
|
@ -286,7 +286,10 @@ void _gdk_x11_precache_atoms (GdkDisplay *display,
|
|||||||
const gchar * const *atom_names,
|
const gchar * const *atom_names,
|
||||||
gint n_atoms);
|
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_root_window (GdkScreen *screen);
|
||||||
void _gdk_x11_screen_init_visuals (GdkScreen *screen);
|
void _gdk_x11_screen_init_visuals (GdkScreen *screen);
|
||||||
|
Loading…
Reference in New Issue
Block a user