diff options
author | infirit <[email protected]> | 2014-12-09 12:05:51 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-09 23:02:27 +0100 |
commit | d205c55d5e18977aa5fe2f522c38ec6746a6aaaf (patch) | |
tree | 66203038b9fd19758277bbaac1dcc651bc813053 | |
parent | 1a0f225a72ecc4b93b7681a9bf7e4aa7f06c04fc (diff) | |
download | atril-d205c55d5e18977aa5fe2f522c38ec6746a6aaaf.tar.bz2 atril-d205c55d5e18977aa5fe2f522c38ec6746a6aaaf.tar.xz |
[totem-scrsaver] Cut down on ifdef hell
We have GDK_DISPLAY_XDISPLAY in Gtk+2 as well.
-rw-r--r-- | cut-n-paste/totem-screensaver/totem-scrsaver.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/cut-n-paste/totem-screensaver/totem-scrsaver.c b/cut-n-paste/totem-screensaver/totem-scrsaver.c index b6aa4f84..db89aa9e 100644 --- a/cut-n-paste/totem-screensaver/totem-scrsaver.c +++ b/cut-n-paste/totem-screensaver/totem-scrsaver.c @@ -280,9 +280,7 @@ screensaver_finalize_dbus (TotemScrsaver *scr) static void screensaver_enable_x11 (TotemScrsaver *scr) { -#if GTK_CHECK_VERSION (3, 0, 0) Display *xdisplay; -#endif #ifdef HAVE_XTEST if (scr->priv->have_xtest != FALSE) @@ -292,7 +290,6 @@ screensaver_enable_x11 (TotemScrsaver *scr) } #endif /* HAVE_XTEST */ -#if GTK_CHECK_VERSION (3, 0, 0) xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); XLockDisplay (xdisplay); XSetScreenSaver (xdisplay, @@ -301,15 +298,6 @@ screensaver_enable_x11 (TotemScrsaver *scr) scr->priv->prefer_blanking, scr->priv->allow_exposures); XUnlockDisplay (xdisplay); -#else - XLockDisplay (GDK_DISPLAY()); - XSetScreenSaver (GDK_DISPLAY(), - scr->priv->timeout, - scr->priv->interval, - scr->priv->prefer_blanking, - scr->priv->allow_exposures); - XUnlockDisplay (GDK_DISPLAY()); -#endif } #ifdef HAVE_XTEST @@ -318,7 +306,6 @@ fake_event (TotemScrsaver *scr) { if (scr->priv->disabled) { -#if GTK_CHECK_VERSION (3, 0, 0) Display *display; xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); @@ -328,14 +315,6 @@ fake_event (TotemScrsaver *scr) XTestFakeKeyEvent (xdisplay, *scr->priv->keycode, False, CurrentTime); XUnlockDisplay (xdisplay); -#else - XLockDisplay (GDK_DISPLAY()); - XTestFakeKeyEvent (GDK_DISPLAY(), *scr->priv->keycode, - True, CurrentTime); - XTestFakeKeyEvent (GDK_DISPLAY(), *scr->priv->keycode, - False, CurrentTime); - XUnlockDisplay (GDK_DISPLAY()); -#endif /* Swap the keycode */ if (scr->priv->keycode == &scr->priv->keycode1) scr->priv->keycode = &scr->priv->keycode2; @@ -350,31 +329,20 @@ fake_event (TotemScrsaver *scr) static void screensaver_disable_x11 (TotemScrsaver *scr) { -#if GTK_CHECK_VERSION (3, 0, 0) Display *xdisplay; xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); -#endif #ifdef HAVE_XTEST if (scr->priv->have_xtest != FALSE) { -#if GTK_CHECK_VERSION (3, 0, 0) XLockDisplay (xdisplay); XGetScreenSaver(xdisplay, &scr->priv->timeout, &scr->priv->interval, &scr->priv->prefer_blanking, &scr->priv->allow_exposures); XUnlockDisplay (xdisplay); -#else - XLockDisplay (GDK_DISPLAY()); - XGetScreenSaver(GDK_DISPLAY(), &scr->priv->timeout, - &scr->priv->interval, - &scr->priv->prefer_blanking, - &scr->priv->allow_exposures); - XUnlockDisplay (GDK_DISPLAY()); -#endif if (scr->priv->timeout != 0) { g_timeout_add_seconds (scr->priv->timeout / 2, @@ -388,7 +356,6 @@ screensaver_disable_x11 (TotemScrsaver *scr) } #endif /* HAVE_XTEST */ -#if GTK_CHECK_VERSION (3, 0, 0) XLockDisplay (xdisplay); XGetScreenSaver(xdisplay, &scr->priv->timeout, &scr->priv->interval, @@ -397,67 +364,34 @@ screensaver_disable_x11 (TotemScrsaver *scr) XSetScreenSaver(xdisplay, 0, 0, DontPreferBlanking, DontAllowExposures); XUnlockDisplay (xdisplay); -#else - XLockDisplay (GDK_DISPLAY()); - XGetScreenSaver(GDK_DISPLAY(), &scr->priv->timeout, - &scr->priv->interval, - &scr->priv->prefer_blanking, - &scr->priv->allow_exposures); - XSetScreenSaver(GDK_DISPLAY(), 0, 0, - DontPreferBlanking, DontAllowExposures); - XUnlockDisplay (GDK_DISPLAY()); -#endif } static void screensaver_init_x11 (TotemScrsaver *scr) { #ifdef HAVE_XTEST -#if GTK_CHECK_VERSION (3, 0, 0) Display *display; -#endif int a, b, c, d; -#if GTK_CHECK_VERSION (3, 0, 0) display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); XLockDisplay (xdisplay); scr->priv->have_xtest = (XTestQueryExtension (xdisplay, &a, &b, &c, &d) == True); -#else - XLockDisplay (GDK_DISPLAY()); - scr->priv->have_xtest = (XTestQueryExtension (GDK_DISPLAY(), &a, &b, &c, &d) == True); -#endif if (scr->priv->have_xtest != FALSE) { -#if GTK_CHECK_VERSION (3, 0, 0) scr->priv->keycode1 = XKeysymToKeycode (xdisplay, XK_Alt_L); -#else - scr->priv->keycode1 = XKeysymToKeycode (GDK_DISPLAY(), XK_Alt_L); -#endif if (scr->priv->keycode1 == 0) { g_warning ("scr->priv->keycode1 not existant"); } -#if GTK_CHECK_VERSION (3, 0, 0) scr->priv->keycode2 = XKeysymToKeycode (xdisplay, XK_Alt_R); -#else - scr->priv->keycode2 = XKeysymToKeycode (GDK_DISPLAY(), XK_Alt_R); -#endif if (scr->priv->keycode2 == 0) { -#if GTK_CHECK_VERSION (3, 0, 0) scr->priv->keycode2 = XKeysymToKeycode (xdisplay, XK_Alt_L); -#else - scr->priv->keycode2 = XKeysymToKeycode (GDK_DISPLAY(), XK_Alt_L); -#endif if (scr->priv->keycode2 == 0) { g_warning ("scr->priv->keycode2 not existant"); } } scr->priv->keycode = &scr->priv->keycode1; } -#if GTK_CHECK_VERSION (3, 0, 0) XUnlockDisplay (xdisplay); -#else - XUnlockDisplay (GDK_DISPLAY()); -#endif #endif /* HAVE_XTEST */ } |