summaryrefslogtreecommitdiff
path: root/src/gs-grab-x11.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2013-11-12 16:50:44 +0100
committerStefano Karapetsas <[email protected]>2013-11-12 16:50:44 +0100
commitd5027c1631b5db4197f9d3a6aa518ce0265ac05f (patch)
treecf5bcdc0b965a1a1f803bbd704300ef51255cb8f /src/gs-grab-x11.c
parentfa5f117527e6674168ef613b5e50190fa08d9e26 (diff)
downloadmate-screensaver-d5027c1631b5db4197f9d3a6aa518ce0265ac05f.tar.bz2
mate-screensaver-d5027c1631b5db4197f9d3a6aa518ce0265ac05f.tar.xz
Add GTK3 support
Diffstat (limited to 'src/gs-grab-x11.c')
-rw-r--r--src/gs-grab-x11.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/gs-grab-x11.c b/src/gs-grab-x11.c
index 40650fb..61a376c 100644
--- a/src/gs-grab-x11.c
+++ b/src/gs-grab-x11.c
@@ -58,6 +58,7 @@ struct GSGrabPrivate
GtkWidget *invisible;
};
+#if !GTK_CHECK_VERSION (3, 0, 0)
static GdkCursor *
get_cursor (void)
{
@@ -82,6 +83,7 @@ get_cursor (void)
return cursor;
}
+#endif
static const char *
grab_string (int status)
@@ -126,7 +128,11 @@ 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;
@@ -143,7 +149,11 @@ 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 ();
@@ -216,7 +226,11 @@ gs_grab_get_mouse (GSGrab *grab,
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (screen != NULL, FALSE);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ cursor = gdk_cursor_new (GDK_BLANK_CURSOR);
+#else
cursor = get_cursor ();
+#endif
gs_debug ("Grabbing mouse widget=%X", (guint32) GDK_WINDOW_XID (window));
status = gdk_pointer_grab (window, TRUE, 0, NULL,
@@ -438,9 +452,13 @@ 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 ();
@@ -584,7 +602,11 @@ gs_grab_grab_offscreen (GSGrab *grab,
gs_debug ("Grabbing an offscreen window");
screen = gtk_invisible_get_screen (GTK_INVISIBLE (grab->priv->invisible));
+#if GTK_CHECK_VERSION (3, 0, 0)
+ res = gs_grab_grab_window (grab, gtk_widget_get_window (GTK_WIDGET (grab->priv->invisible)), screen, hide_cursor);
+#else
res = gs_grab_grab_window (grab, grab->priv->invisible->window, screen, hide_cursor);
+#endif
return res;
}