[evince/rendering-cleanup: 1/8] [totem-scrsaver] Don't use GDK_DISPLAY



commit e36b45a92e7883402b0728c3ac56a68a0ae3fcef
Author: Christian Persch <chpe gnome org>
Date:   Sat Sep 11 23:29:44 2010 +0200

    [totem-scrsaver] Don't use GDK_DISPLAY
    
    Fixes the build with gtk master.

 cut-n-paste/totem-screensaver/totem-scrsaver.c |   51 ++++++++++++++---------
 1 files changed, 31 insertions(+), 20 deletions(-)
---
diff --git a/cut-n-paste/totem-screensaver/totem-scrsaver.c b/cut-n-paste/totem-screensaver/totem-scrsaver.c
index c8dcc09..36d314e 100644
--- a/cut-n-paste/totem-screensaver/totem-scrsaver.c
+++ b/cut-n-paste/totem-screensaver/totem-scrsaver.c
@@ -279,6 +279,7 @@ screensaver_finalize_dbus (TotemScrsaver *scr)
 static void
 screensaver_enable_x11 (TotemScrsaver *scr)
 {
+        Display *xdisplay;
 
 #ifdef HAVE_XTEST
 	if (scr->priv->have_xtest != FALSE)
@@ -288,13 +289,14 @@ screensaver_enable_x11 (TotemScrsaver *scr)
 	}
 #endif /* HAVE_XTEST */
 
-	XLockDisplay (GDK_DISPLAY());
-	XSetScreenSaver (GDK_DISPLAY(),
+        xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
+	XLockDisplay (xdisplay);
+	XSetScreenSaver (xdisplay,
 			scr->priv->timeout,
 			scr->priv->interval,
 			scr->priv->prefer_blanking,
 			scr->priv->allow_exposures);
-	XUnlockDisplay (GDK_DISPLAY());
+	XUnlockDisplay (xdisplay);
 }
 
 #ifdef HAVE_XTEST
@@ -303,12 +305,15 @@ fake_event (TotemScrsaver *scr)
 {
 	if (scr->priv->disabled)
 	{
-		XLockDisplay (GDK_DISPLAY());
-		XTestFakeKeyEvent (GDK_DISPLAY(), *scr->priv->keycode,
+                Display *display;
+
+                xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
+		XLockDisplay (xdisplay);
+		XTestFakeKeyEvent (xdisplay, *scr->priv->keycode,
 				True, CurrentTime);
-		XTestFakeKeyEvent (GDK_DISPLAY(), *scr->priv->keycode,
+		XTestFakeKeyEvent (xdisplay, *scr->priv->keycode,
 				False, CurrentTime);
-		XUnlockDisplay (GDK_DISPLAY());
+		XUnlockDisplay (xdisplay);
 		/* Swap the keycode */
 		if (scr->priv->keycode == &scr->priv->keycode1)
 			scr->priv->keycode = &scr->priv->keycode2;
@@ -323,16 +328,19 @@ fake_event (TotemScrsaver *scr)
 static void
 screensaver_disable_x11 (TotemScrsaver *scr)
 {
+        Display *xdisplay;
+
+        xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
 
 #ifdef HAVE_XTEST
 	if (scr->priv->have_xtest != FALSE)
 	{
-		XLockDisplay (GDK_DISPLAY());
-		XGetScreenSaver(GDK_DISPLAY(), &scr->priv->timeout,
+		XLockDisplay (xdisplay);
+		XGetScreenSaver(xdisplay, &scr->priv->timeout,
 				&scr->priv->interval,
 				&scr->priv->prefer_blanking,
 				&scr->priv->allow_exposures);
-		XUnlockDisplay (GDK_DISPLAY());
+		XUnlockDisplay (xdisplay);
 
 		if (scr->priv->timeout != 0) {
 			g_timeout_add_seconds (scr->priv->timeout / 2,
@@ -346,14 +354,14 @@ screensaver_disable_x11 (TotemScrsaver *scr)
 	}
 #endif /* HAVE_XTEST */
 
-	XLockDisplay (GDK_DISPLAY());
-	XGetScreenSaver(GDK_DISPLAY(), &scr->priv->timeout,
+	XLockDisplay (xdisplay);
+	XGetScreenSaver(xdisplay, &scr->priv->timeout,
 			&scr->priv->interval,
 			&scr->priv->prefer_blanking,
 			&scr->priv->allow_exposures);
-	XSetScreenSaver(GDK_DISPLAY(), 0, 0,
+	XSetScreenSaver(xdisplay, 0, 0,
 			DontPreferBlanking, DontAllowExposures);
-	XUnlockDisplay (GDK_DISPLAY());
+	XUnlockDisplay (xdisplay);
 }
 
 static void
@@ -361,25 +369,28 @@ screensaver_init_x11 (TotemScrsaver *scr)
 {
 #ifdef HAVE_XTEST
 	int a, b, c, d;
+        Display *display;
+
+        xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
 
-	XLockDisplay (GDK_DISPLAY());
-	scr->priv->have_xtest = (XTestQueryExtension (GDK_DISPLAY(), &a, &b, &c, &d) == True);
+	XLockDisplay (xdisplay);
+	scr->priv->have_xtest = (XTestQueryExtension (xdisplay, &a, &b, &c, &d) == True);
 	if (scr->priv->have_xtest != FALSE)
 	{
-		scr->priv->keycode1 = XKeysymToKeycode (GDK_DISPLAY(), XK_Alt_L);
+		scr->priv->keycode1 = XKeysymToKeycode (xdisplay, XK_Alt_L);
 		if (scr->priv->keycode1 == 0) {
 			g_warning ("scr->priv->keycode1 not existant");
 		}
-		scr->priv->keycode2 = XKeysymToKeycode (GDK_DISPLAY(), XK_Alt_R);
+		scr->priv->keycode2 = XKeysymToKeycode (xdisplay, XK_Alt_R);
 		if (scr->priv->keycode2 == 0) {
-			scr->priv->keycode2 = XKeysymToKeycode (GDK_DISPLAY(), XK_Alt_L);
+			scr->priv->keycode2 = XKeysymToKeycode (xdisplay, XK_Alt_L);
 			if (scr->priv->keycode2 == 0) {
 				g_warning ("scr->priv->keycode2 not existant");
 			}
 		}
 		scr->priv->keycode = &scr->priv->keycode1;
 	}
-	XUnlockDisplay (GDK_DISPLAY());
+	XUnlockDisplay (xdisplay);
 #endif /* HAVE_XTEST */
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]