From 7b6b7b641c8a33703692333bfeccd87238ae1c73 Mon Sep 17 00:00:00 2001 From: Wolfgang Ulbrich Date: Thu, 10 Dec 2015 20:36:09 +0100 Subject: GTK3: use new gdk_error_trap_ignored api This gets rid of some compile warnings taken from: https://git.gnome.org/browse/gnome-screensaver/commit/?id=73c0e41 --- src/gs-grab-x11.c | 22 ++++++++++++++++++++++ src/gs-window-x11.c | 12 ++++++++++++ 2 files changed, 34 insertions(+) (limited to 'src') diff --git a/src/gs-grab-x11.c b/src/gs-grab-x11.c index 83b04e0..7367034 100644 --- a/src/gs-grab-x11.c +++ b/src/gs-grab-x11.c @@ -121,7 +121,11 @@ xorg_lock_smasher_set_active (GSGrab *grab, status = XF86MiscSetGrabKeysState (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), active); gdk_display_sync (gdk_display_get_default ()); +#if GTK_CHECK_VERSION (3, 0, 0) + error = gdk_error_trap_pop (); +#else gdk_error_trap_pop (); +#endif if (active && status == MiscExtGrabStateAlready) { @@ -129,12 +133,26 @@ xorg_lock_smasher_set_active (GSGrab *grab, status = MiscExtGrabStateSuccess; } +#if GTK_CHECK_VERSION (3, 0, 0) + if (error == Success) { + gs_debug ("XF86MiscSetGrabKeysState(%s) returned %s\n", + active ? "on" : "off", + (status == MiscExtGrabStateSuccess ? "MiscExtGrabStateSuccess" : + status == MiscExtGrabStateLocked ? "MiscExtGrabStateLocked" : + status == MiscExtGrabStateAlready ? "MiscExtGrabStateAlready" : + "unknown value")); + } else { + gs_debug ("XF86MiscSetGrabKeysState(%s) failed with error code %d\n", + active ? "on" : "off", error); + } +#else gs_debug ("XF86MiscSetGrabKeysState(%s) returned %s\n", active ? "on" : "off", (status == MiscExtGrabStateSuccess ? "MiscExtGrabStateSuccess" : status == MiscExtGrabStateLocked ? "MiscExtGrabStateLocked" : status == MiscExtGrabStateAlready ? "MiscExtGrabStateAlready" : "unknown value")); +#endif } #else static void @@ -416,8 +434,12 @@ gs_grab_nuke_focus (void) XGetInputFocus (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &focus, &rev); XSetInputFocus (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), None, RevertToNone, CurrentTime); +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_error_trap_pop_ignored (); +#else gdk_display_sync (gdk_display_get_default ()); gdk_error_trap_pop (); +#endif } void diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c index caf673f..ee7b197 100644 --- a/src/gs-window-x11.c +++ b/src/gs-window-x11.c @@ -282,8 +282,12 @@ widget_clear_all_children (GtkWidget *widget) clear_children (GDK_WINDOW_XID (w)); +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_error_trap_pop_ignored (); +#else gdk_display_sync (gtk_widget_get_display (widget)); gdk_error_trap_pop (); +#endif } #endif @@ -1031,8 +1035,12 @@ select_popup_events (void) events = SubstructureNotifyMask | attr.your_event_mask; XSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_ROOT_WINDOW (), events); +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_error_trap_pop_ignored (); +#else gdk_display_sync (gdk_display_get_default ()); gdk_error_trap_pop (); +#endif } static void @@ -1049,9 +1057,13 @@ window_select_shape_events (GSWindow *window) XShapeSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window))), events); } +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_error_trap_pop_ignored (); +#else gdk_display_sync (gdk_display_get_default ()); gdk_error_trap_pop (); #endif +#endif } static void -- cgit v1.2.1