summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mate-panel/panel-xutils.c7
-rw-r--r--mate-panel/panel-xutils.h6
2 files changed, 13 insertions, 0 deletions
diff --git a/mate-panel/panel-xutils.c b/mate-panel/panel-xutils.c
index 821b7ead..5c4e5281 100644
--- a/mate-panel/panel-xutils.c
+++ b/mate-panel/panel-xutils.c
@@ -24,6 +24,10 @@
#include "config.h"
+#ifndef HAVE_X11
+#error file should only be built when HAVE_X11 is enabled
+#endif
+
#include "panel-xutils.h"
#include <glib.h>
@@ -63,6 +67,7 @@ panel_xutils_set_strut (GdkWindow *gdk_window,
GdkDisplay *display;
g_return_if_fail (GDK_IS_WINDOW (gdk_window));
+ g_return_if_fail (GDK_IS_X11_DISPLAY (gdk_window_get_display (gdk_window)));
xdisplay = GDK_WINDOW_XDISPLAY (gdk_window);
window = GDK_WINDOW_XID (gdk_window);
@@ -116,6 +121,7 @@ panel_warp_pointer (GdkWindow *gdk_window,
GdkDisplay *display;
g_return_if_fail (GDK_IS_WINDOW (gdk_window));
+ g_return_if_fail (GDK_IS_X11_DISPLAY (gdk_window_get_display (gdk_window)));
xdisplay = GDK_WINDOW_XDISPLAY (gdk_window);
window = GDK_WINDOW_XID (gdk_window);
@@ -143,6 +149,7 @@ panel_get_real_modifier_mask (guint mask)
return mask;
}
+ g_return_val_if_fail (GDK_IS_X11_DISPLAY (gdk_display_get_default ()), mask);
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
XDisplayKeycodes (display, &min_keycode, &max_keycode);
diff --git a/mate-panel/panel-xutils.h b/mate-panel/panel-xutils.h
index 8228196c..4cba602e 100644
--- a/mate-panel/panel-xutils.h
+++ b/mate-panel/panel-xutils.h
@@ -25,6 +25,12 @@
#ifndef __PANEL_XUTILS_H__
#define __PANEL_XUTILS_H__
+#ifdef PACKAGE_NAME // only check HAVE_X11 if config.h has been included
+#ifndef HAVE_X11
+#error file should only be included when HAVE_X11 is enabled
+#endif
+#endif
+
#include <glib.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>