summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-25 13:34:51 +0200
committerinfirit <[email protected]>2014-07-25 13:34:51 +0200
commitb75ee1ca5bcd22c26e3ae6bfde6052eb1bbd0d29 (patch)
tree14c70b40019c164509ed7c0dd7df7b40b2eded5a
parent321cea66c5b65f3b4fe6cc89169a9c13b476c8d1 (diff)
downloadeom-b75ee1ca5bcd22c26e3ae6bfde6052eb1bbd0d29.tar.bz2
eom-b75ee1ca5bcd22c26e3ae6bfde6052eb1bbd0d29.tar.xz
Replace all calls to gdk_x11_get_default_xdisplay
Based on eog commit c4f204aee4640b3997d3e30d67f6f292da935078 From Felix Riemann <[email protected]>
-rw-r--r--cut-n-paste/totem-screensaver/totem-scrsaver.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/cut-n-paste/totem-screensaver/totem-scrsaver.c b/cut-n-paste/totem-screensaver/totem-scrsaver.c
index 70fa788..e08b6a8 100644
--- a/cut-n-paste/totem-screensaver/totem-scrsaver.c
+++ b/cut-n-paste/totem-screensaver/totem-scrsaver.c
@@ -281,7 +281,7 @@ screensaver_finalize_dbus (TotemScrsaver *scr)
static void
screensaver_enable_x11 (TotemScrsaver *scr)
{
-
+ Display *display;
#ifdef HAVE_XTEST
if (scr->priv->have_xtest != FALSE)
{
@@ -290,13 +290,14 @@ screensaver_enable_x11 (TotemScrsaver *scr)
}
#endif /* HAVE_XTEST */
- XLockDisplay (gdk_x11_get_default_xdisplay());
- XSetScreenSaver (gdk_x11_get_default_xdisplay(),
+ display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
+ XLockDisplay (display);
+ XSetScreenSaver (display,
scr->priv->timeout,
scr->priv->interval,
scr->priv->prefer_blanking,
scr->priv->allow_exposures);
- XUnlockDisplay (gdk_x11_get_default_xdisplay());
+ XUnlockDisplay (display);
}
#ifdef HAVE_XTEST
@@ -305,12 +306,15 @@ fake_event (TotemScrsaver *scr)
{
if (scr->priv->disabled)
{
- XLockDisplay (gdk_x11_get_default_xdisplay());
- XTestFakeKeyEvent (gdk_x11_get_default_xdisplay(), *scr->priv->keycode,
+ Display *display;
+
+ display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
+ XLockDisplay (display);
+ XTestFakeKeyEvent (display, *scr->priv->keycode,
True, CurrentTime);
- XTestFakeKeyEvent (gdk_x11_get_default_xdisplay(), *scr->priv->keycode,
+ XTestFakeKeyEvent (display, *scr->priv->keycode,
False, CurrentTime);
- XUnlockDisplay (gdk_x11_get_default_xdisplay());
+ XUnlockDisplay (display);
/* Swap the keycode */
if (scr->priv->keycode == &scr->priv->keycode1)
scr->priv->keycode = &scr->priv->keycode2;
@@ -325,16 +329,19 @@ fake_event (TotemScrsaver *scr)
static void
screensaver_disable_x11 (TotemScrsaver *scr)
{
+ Display *display;
+
+ display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
#ifdef HAVE_XTEST
if (scr->priv->have_xtest != FALSE)
{
- XLockDisplay (gdk_x11_get_default_xdisplay());
- XGetScreenSaver(gdk_x11_get_default_xdisplay(), &scr->priv->timeout,
+ XLockDisplay (display);
+ XGetScreenSaver(display, &scr->priv->timeout,
&scr->priv->interval,
&scr->priv->prefer_blanking,
&scr->priv->allow_exposures);
- XUnlockDisplay (gdk_x11_get_default_xdisplay());
+ XUnlockDisplay (display);
if (scr->priv->timeout != 0) {
g_timeout_add_seconds (scr->priv->timeout / 2,
@@ -348,14 +355,14 @@ screensaver_disable_x11 (TotemScrsaver *scr)
}
#endif /* HAVE_XTEST */
- XLockDisplay (gdk_x11_get_default_xdisplay());
- XGetScreenSaver(gdk_x11_get_default_xdisplay(), &scr->priv->timeout,
+ XLockDisplay (display);
+ XGetScreenSaver(display, &scr->priv->timeout,
&scr->priv->interval,
&scr->priv->prefer_blanking,
&scr->priv->allow_exposures);
- XSetScreenSaver(gdk_x11_get_default_xdisplay(), 0, 0,
+ XSetScreenSaver(display, 0, 0,
DontPreferBlanking, DontAllowExposures);
- XUnlockDisplay (gdk_x11_get_default_xdisplay());
+ XUnlockDisplay (display);
}
static void
@@ -363,25 +370,28 @@ screensaver_init_x11 (TotemScrsaver *scr)
{
#ifdef HAVE_XTEST
int a, b, c, d;
+ Display *display;
+
+ display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
- XLockDisplay (gdk_x11_get_default_xdisplay());
- scr->priv->have_xtest = (XTestQueryExtension (gdk_x11_get_default_xdisplay(), &a, &b, &c, &d) == True);
+ XLockDisplay (display);
+ scr->priv->have_xtest = (XTestQueryExtension (display, &a, &b, &c, &d) == True);
if (scr->priv->have_xtest != FALSE)
{
- scr->priv->keycode1 = XKeysymToKeycode (gdk_x11_get_default_xdisplay(), XK_Alt_L);
+ scr->priv->keycode1 = XKeysymToKeycode (display, XK_Alt_L);
if (scr->priv->keycode1 == 0) {
g_warning ("scr->priv->keycode1 not existant");
}
- scr->priv->keycode2 = XKeysymToKeycode (gdk_x11_get_default_xdisplay(), XK_Alt_R);
+ scr->priv->keycode2 = XKeysymToKeycode (display, XK_Alt_R);
if (scr->priv->keycode2 == 0) {
- scr->priv->keycode2 = XKeysymToKeycode (gdk_x11_get_default_xdisplay(), XK_Alt_L);
+ scr->priv->keycode2 = XKeysymToKeycode (display, XK_Alt_L);
if (scr->priv->keycode2 == 0) {
g_warning ("scr->priv->keycode2 not existant");
}
}
scr->priv->keycode = &scr->priv->keycode1;
}
- XUnlockDisplay (gdk_x11_get_default_xdisplay());
+ XUnlockDisplay (display);
#endif /* HAVE_XTEST */
}