From 1b8f66d0f995b2f9ccf56c9ab7a27c2f68442c50 Mon Sep 17 00:00:00 2001 From: infirit Date: Thu, 9 Jul 2015 10:39:04 +0200 Subject: Always use GDK_DISPLAY_XDISPLAY instead of GDK_DISPLAY Has been in Gtk since 2.22 --- src/gs-fade.c | 28 ---------------------------- src/gs-grab-x11.c | 13 ------------- src/gs-lock-plug.c | 4 ---- src/gs-watcher-x11.c | 16 ---------------- src/gs-window-x11.c | 20 ++------------------ src/test-fade.c | 8 -------- 6 files changed, 2 insertions(+), 87 deletions(-) diff --git a/src/gs-fade.c b/src/gs-fade.c index b4ccb07..566078d 100644 --- a/src/gs-fade.c +++ b/src/gs-fade.c @@ -217,11 +217,7 @@ xf86_whack_gamma (int screen, g2.blue = XF86_MIN_GAMMA; } -#if GTK_CHECK_VERSION (3, 0, 0) status = XF86VidModeSetGamma (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), screen, &g2); -#else - status = XF86VidModeSetGamma (GDK_DISPLAY (), screen, &g2); -#endif } else { @@ -241,11 +237,7 @@ xf86_whack_gamma (int screen, b[i] = gamma_info->b[i] * ratio; } -#if GTK_CHECK_VERSION (3, 0, 0) status = XF86VidModeSetGammaRamp (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), screen, gamma_info->size, r, g, b); -#else - status = XF86VidModeSetGammaRamp (GDK_DISPLAY (), screen, gamma_info->size, r, g, b); -#endif g_free (r); g_free (g); @@ -321,11 +313,7 @@ gamma_fade_setup (GSFade *fade, int screen_idx) { /* have ramps */ -#if GTK_CHECK_VERSION (3, 0, 0) res = XF86VidModeGetGammaRampSize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), screen_idx, &screen_priv->info->size); -#else - res = XF86VidModeGetGammaRampSize (GDK_DISPLAY (), screen_idx, &screen_priv->info->size); -#endif if (!res || screen_priv->info->size <= 0) { screen_priv->fade_type = FADE_TYPE_GAMMA_NUMBER; @@ -342,11 +330,7 @@ gamma_fade_setup (GSFade *fade, int screen_idx) goto test_number; } -#if GTK_CHECK_VERSION (3, 0, 0) res = XF86VidModeGetGammaRamp (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), -#else - res = XF86VidModeGetGammaRamp (GDK_DISPLAY (), -#endif screen_idx, screen_priv->info->size, screen_priv->info->r, @@ -366,11 +350,7 @@ test_number: { /* only have gamma parameter, not ramps. */ -#if GTK_CHECK_VERSION (3, 0, 0) res = XF86VidModeGetGamma (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), screen_idx, &screen_priv->vmg); -#else - res = XF86VidModeGetGamma (GDK_DISPLAY (), screen_idx, &screen_priv->vmg); -#endif if (! res) { screen_priv->fade_type = FADE_TYPE_NONE; @@ -452,19 +432,11 @@ check_gamma_extension (GSFade *fade, int screen_idx) screen_priv = &fade->priv->screen_priv[screen_idx]; #ifdef HAVE_XF86VMODE_GAMMA -#if GTK_CHECK_VERSION (3, 0, 0) res = XF86VidModeQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &event, &error); -#else - res = XF86VidModeQueryExtension (GDK_DISPLAY (), &event, &error); -#endif if (! res) goto fade_none; -#if GTK_CHECK_VERSION (3, 0, 0) res = safe_XF86VidModeQueryVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor); -#else - res = safe_XF86VidModeQueryVersion (GDK_DISPLAY (), &major, &minor); -#endif if (! res) goto fade_none; diff --git a/src/gs-grab-x11.c b/src/gs-grab-x11.c index 61a376c..003df3b 100644 --- a/src/gs-grab-x11.c +++ b/src/gs-grab-x11.c @@ -128,11 +128,7 @@ xorg_lock_smasher_set_active (GSGrab *grab, { int status, event, error; -#if GTK_CHECK_VERSION (3, 0, 0) if (!XF86MiscQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &event, &error)) -#else - if (!XF86MiscQueryExtension (GDK_DISPLAY (), &event, &error)) -#endif { gs_debug ("No XFree86-Misc extension present"); return; @@ -149,11 +145,7 @@ xorg_lock_smasher_set_active (GSGrab *grab, gdk_error_trap_push (); -#if GTK_CHECK_VERSION (3, 0, 0) status = XF86MiscSetGrabKeysState (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), active); -#else - status = XF86MiscSetGrabKeysState (GDK_DISPLAY (), active); -#endif gdk_display_sync (gdk_display_get_default ()); gdk_error_trap_pop (); @@ -452,13 +444,8 @@ gs_grab_nuke_focus (void) gdk_error_trap_push (); -#if GTK_CHECK_VERSION (3, 0, 0) XGetInputFocus (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &focus, &rev); XSetInputFocus (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), None, RevertToNone, CurrentTime); -#else - XGetInputFocus (GDK_DISPLAY (), &focus, &rev); - XSetInputFocus (GDK_DISPLAY (), None, RevertToNone, CurrentTime); -#endif gdk_display_sync (gdk_display_get_default ()); gdk_error_trap_pop (); diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c index 3a42c7f..68c0f0b 100644 --- a/src/gs-lock-plug.c +++ b/src/gs-lock-plug.c @@ -2243,11 +2243,7 @@ gs_lock_plug_init (GSLockPlug *plug) { XklEngine *engine; -#if GTK_CHECK_VERSION (3, 0, 0) engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); -#else - engine = xkl_engine_get_instance (GDK_DISPLAY ()); -#endif if (xkl_engine_get_num_groups (engine) > 1) { GtkWidget *layout_indicator; diff --git a/src/gs-watcher-x11.c b/src/gs-watcher-x11.c index 5f699f1..2871512 100644 --- a/src/gs-watcher-x11.c +++ b/src/gs-watcher-x11.c @@ -592,11 +592,7 @@ disable_builtin_screensaver (GSWatcher *watcher, int desired_server_timeout, desired_server_interval; int desired_prefer_blank, desired_allow_exp; -#if GTK_CHECK_VERSION (3, 0, 0) XGetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), -#else - XGetScreenSaver (GDK_DISPLAY (), -#endif ¤t_server_timeout, ¤t_server_interval, ¤t_prefer_blank, @@ -635,31 +631,19 @@ disable_builtin_screensaver (GSWatcher *watcher, (desired_prefer_blank ? "blank" : "noblank"), (desired_allow_exp ? "expose" : "noexpose")); -#if GTK_CHECK_VERSION (3, 0, 0) XSetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), -#else - XSetScreenSaver (GDK_DISPLAY (), -#endif desired_server_timeout, desired_server_interval, desired_prefer_blank, desired_allow_exp); -#if GTK_CHECK_VERSION (3, 0, 0) XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); -#else - XSync (GDK_DISPLAY (), FALSE); -#endif } if (unblank_screen) { /* Turn off the server builtin saver if it is now running. */ -#if GTK_CHECK_VERSION (3, 0, 0) XForceScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), ScreenSaverReset); -#else - XForceScreenSaver (GDK_DISPLAY (), ScreenSaverReset); -#endif } } diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c index 3ed8b8e..f9369e8 100644 --- a/src/gs-window-x11.c +++ b/src/gs-window-x11.c @@ -269,7 +269,7 @@ clear_children (Window window) int status; children = NULL; - status = XQueryTree (GDK_DISPLAY (), window, &root, &parent, &children, &n_children); + status = XQueryTree (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), window, &root, &parent, &children, &n_children); if (status == 0) { @@ -288,7 +288,7 @@ clear_children (Window window) child = children [--n_children]; - XClearWindow (GDK_DISPLAY (), child); + XClearWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), child); clear_children (child); } @@ -1078,18 +1078,10 @@ select_popup_events (void) gdk_error_trap_push (); memset (&attr, 0, sizeof (attr)); -#if GTK_CHECK_VERSION (3, 0, 0) XGetWindowAttributes (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_ROOT_WINDOW (), &attr); -#else - XGetWindowAttributes (GDK_DISPLAY (), GDK_ROOT_WINDOW (), &attr); -#endif events = SubstructureNotifyMask | attr.your_event_mask; -#if GTK_CHECK_VERSION (3, 0, 0) XSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_ROOT_WINDOW (), events); -#else - XSelectInput (GDK_DISPLAY (), GDK_ROOT_WINDOW (), events); -#endif gdk_display_sync (gdk_display_get_default ()); gdk_error_trap_pop (); @@ -1104,18 +1096,10 @@ window_select_shape_events (GSWindow *window) gdk_error_trap_push (); -#if GTK_CHECK_VERSION (3, 0, 0) if (XShapeQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &window->priv->shape_event_base, &shape_error_base)) { events = ShapeNotifyMask; XShapeSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window))), events); } -#else - if (XShapeQueryExtension (GDK_DISPLAY (), &window->priv->shape_event_base, &shape_error_base)) - { - events = ShapeNotifyMask; - XShapeSelectInput (GDK_DISPLAY (), GDK_WINDOW_XID (GTK_WIDGET (window)->window), events); - } -#endif gdk_display_sync (gdk_display_get_default ()); gdk_error_trap_pop (); diff --git a/src/test-fade.c b/src/test-fade.c index b906460..6a82d21 100644 --- a/src/test-fade.c +++ b/src/test-fade.c @@ -101,11 +101,7 @@ main (int argc, exit (1); } -#if GTK_CHECK_VERSION (3, 0, 0) if (! XQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XF86_VIDMODE_NAME, &op, &event, &err)) -#else - if (! XQueryExtension (GDK_DISPLAY (), XF86_VIDMODE_NAME, &op, &event, &err)) -#endif { g_message ("no " XF86_VIDMODE_NAME " extension"); } @@ -115,11 +111,7 @@ main (int argc, int major; int minor; -#if GTK_CHECK_VERSION (3, 0, 0) if (! XF86VidModeQueryVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor)) -#else - if (! XF86VidModeQueryVersion (GDK_DISPLAY (), &major, &minor)) -#endif { g_message ("unable to get " XF86_VIDMODE_NAME " version"); } -- cgit v1.2.1