forked from AuroraMiddleware/gtk
x11: Register wm_protocols function with gdk_window_add_filter()
The client message code is about to go away, so we need to use a different way to get at ClientMessage output.
This commit is contained in:
parent
e67347a3c8
commit
609ddee632
@ -1016,21 +1016,28 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
return return_val;
|
||||
}
|
||||
|
||||
static GdkFilterReturn
|
||||
gdk_wm_protocols_filter (GdkXEvent *xev,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
GdkFilterReturn
|
||||
_gdk_wm_protocols_filter (GdkXEvent *xev,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
XEvent *xevent = (XEvent *)xev;
|
||||
GdkWindow *win = event->any.window;
|
||||
GdkDisplay *display;
|
||||
Atom atom;
|
||||
|
||||
if (!win)
|
||||
return GDK_FILTER_REMOVE;
|
||||
if (!GDK_IS_X11_WINDOW (win))
|
||||
return GDK_FILTER_CONTINUE;
|
||||
|
||||
if (xevent->type != ClientMessage)
|
||||
return GDK_FILTER_CONTINUE;
|
||||
|
||||
display = GDK_WINDOW_DISPLAY (win);
|
||||
atom = (Atom)xevent->xclient.data.l[0];
|
||||
|
||||
if (xevent->xclient.message_type != gdk_x11_get_xatom_by_name_for_display (display, "WM_PROTOCOLS"))
|
||||
return GDK_FILTER_CONTINUE;
|
||||
|
||||
atom = (Atom) xevent->xclient.data.l[0];
|
||||
|
||||
if (atom == gdk_x11_get_xatom_by_name_for_display (display, "WM_DELETE_WINDOW"))
|
||||
{
|
||||
@ -1113,11 +1120,6 @@ gdk_event_init (GdkDisplay *display)
|
||||
device_manager = gdk_display_get_device_manager (display);
|
||||
gdk_x11_event_source_add_translator ((GdkEventSource *) display_x11->event_source,
|
||||
GDK_EVENT_TRANSLATOR (device_manager));
|
||||
|
||||
gdk_display_add_client_message_filter (display,
|
||||
gdk_atom_intern_static_string ("WM_PROTOCOLS"),
|
||||
gdk_wm_protocols_filter,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -146,6 +146,10 @@ GdkScreen *_gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
|
||||
void _gdk_x11_display_error_event (GdkDisplay *display,
|
||||
XErrorEvent *error);
|
||||
|
||||
GdkFilterReturn _gdk_wm_protocols_filter (GdkXEvent *xev,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_X11_DISPLAY__ */
|
||||
|
@ -116,6 +116,10 @@ _gdk_x11_windowing_init (void)
|
||||
{
|
||||
XSetErrorHandler (gdk_x_error);
|
||||
XSetIOErrorHandler (gdk_x_io_error);
|
||||
|
||||
gdk_window_add_filter (NULL,
|
||||
_gdk_wm_protocols_filter,
|
||||
NULL);
|
||||
}
|
||||
|
||||
GdkGrabStatus
|
||||
|
Loading…
Reference in New Issue
Block a user