[gedit] Check x11 backend at runtime
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Check x11 backend at runtime
- Date: Mon, 11 Mar 2013 08:13:50 +0000 (UTC)
commit 667e82be52c2df733e7b1884c46ea58e14e87990
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Mar 11 09:13:15 2013 +0100
Check x11 backend at runtime
gedit/gedit-utils.c | 43 ++++++++++++++++++++++++-------------------
1 files changed, 24 insertions(+), 19 deletions(-)
---
diff --git a/gedit/gedit-utils.c b/gedit/gedit-utils.c
index e59230a..130d3cf 100644
--- a/gedit/gedit-utils.c
+++ b/gedit/gedit-utils.c
@@ -776,12 +776,6 @@ gedit_utils_get_current_workspace (GdkScreen *screen)
#ifdef GDK_WINDOWING_X11
GdkWindow *root_win;
GdkDisplay *display;
- Atom type;
- gint format;
- gulong nitems;
- gulong bytes_after;
- guint *current_desktop;
- gint err, result;
guint ret = 0;
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
@@ -789,20 +783,31 @@ gedit_utils_get_current_workspace (GdkScreen *screen)
root_win = gdk_screen_get_root_window (screen);
display = gdk_screen_get_display (screen);
- gdk_error_trap_push ();
- result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (root_win),
- gdk_x11_get_xatom_by_name_for_display (display, "_NET_CURRENT_DESKTOP"),
- 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems,
- &bytes_after, (gpointer) ¤t_desktop);
- err = gdk_error_trap_pop ();
-
- if (err != Success || result != Success)
- return ret;
-
- if (type == XA_CARDINAL && format == 32 && nitems > 0)
- ret = current_desktop[0];
+ if (GDK_IS_X11_DISPLAY (display))
+ {
+ Atom type;
+ gint format;
+ gulong nitems;
+ gulong bytes_after;
+ guint *current_desktop;
+ gint err, result;
+
+ gdk_error_trap_push ();
+ result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (root_win),
+ gdk_x11_get_xatom_by_name_for_display (display,
"_NET_CURRENT_DESKTOP"),
+ 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems,
+ &bytes_after, (gpointer) ¤t_desktop);
+ err = gdk_error_trap_pop ();
+
+ if (err != Success || result != Success)
+ return ret;
+
+ if (type == XA_CARDINAL && format == 32 && nitems > 0)
+ ret = current_desktop[0];
+
+ XFree (current_desktop);
+ }
- XFree (current_desktop);
return ret;
#else
/* FIXME: on mac etc proably there are native APIs
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]