Skip to content

Commit

Permalink
panel-xutils: Error if used when X11 is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
wmww authored and lukefromdc committed Jan 29, 2019
1 parent 00e26f7 commit db9a60c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mate-panel/panel-xutils.c
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions mate-panel/panel-xutils.h
Expand Up @@ -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>
Expand Down

0 comments on commit db9a60c

Please sign in to comment.