Merge pull request #108 from JosephMcc/wayland-fix1
xed-utils: Add runtime checks for x11 specific functions
This commit is contained in:
commit
29c744694c
|
@ -54,8 +54,6 @@
|
|||
/* For the workspace/viewport stuff */
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#endif
|
||||
|
||||
|
@ -655,12 +653,6 @@ xed_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);
|
||||
|
@ -668,6 +660,15 @@ xed_utils_get_current_workspace (GdkScreen *screen)
|
|||
root_win = gdk_screen_get_root_window (screen);
|
||||
display = gdk_screen_get_display (screen);
|
||||
|
||||
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"),
|
||||
|
@ -686,6 +687,8 @@ xed_utils_get_current_workspace (GdkScreen *screen)
|
|||
}
|
||||
|
||||
XFree (current_desktop);
|
||||
}
|
||||
|
||||
return ret;
|
||||
#else
|
||||
/* FIXME: on mac etc proably there are native APIs
|
||||
|
@ -723,6 +726,8 @@ xed_utils_get_window_workspace (GtkWindow *gtkwindow)
|
|||
window = gtk_widget_get_window (GTK_WIDGET (gtkwindow));
|
||||
display = gdk_window_get_display (window);
|
||||
|
||||
if (GDK_IS_X11_DISPLAY (display))
|
||||
{
|
||||
gdk_error_trap_push ();
|
||||
result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
|
||||
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"),
|
||||
|
@ -741,6 +746,8 @@ xed_utils_get_window_workspace (GtkWindow *gtkwindow)
|
|||
}
|
||||
|
||||
XFree (workspace);
|
||||
}
|
||||
|
||||
return ret;
|
||||
#else
|
||||
/* FIXME: on mac etc proably there are native APIs
|
||||
|
@ -783,6 +790,8 @@ xed_utils_get_current_viewport (GdkScreen *screen,
|
|||
root_win = gdk_screen_get_root_window (screen);
|
||||
display = gdk_screen_get_display (screen);
|
||||
|
||||
if (GDK_IS_X11_DISPLAY (display))
|
||||
{
|
||||
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_DESKTOP_VIEWPORT"),
|
||||
|
@ -804,6 +813,7 @@ xed_utils_get_current_viewport (GdkScreen *screen,
|
|||
*x = coordinates[0];
|
||||
*y = coordinates[1];
|
||||
XFree (coordinates);
|
||||
}
|
||||
#else
|
||||
/* FIXME: on mac etc proably there are native APIs
|
||||
* to get the current workspace etc */
|
||||
|
|
Loading…
Reference in New Issue