Skip to content

Commit c733d20

Browse files
wmwwlukefromdc
authored andcommitted
panel-action-protocol: Error if used when X11 is disabled
1 parent 4fe2b74 commit c733d20

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

mate-panel/panel-action-protocol.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424

2525
#include <config.h>
2626

27+
#ifndef HAVE_X11
28+
#error file should only be built when HAVE_X11 is enabled
29+
#endif
30+
2731
#include "panel-action-protocol.h"
2832

2933
#include <gdk/gdk.h>
@@ -131,6 +135,8 @@ panel_action_protocol_filter (GdkXEvent *gdk_xevent,
131135

132136
screen = gdk_event_get_screen (event);
133137
display = gdk_screen_get_display (screen);
138+
if (!GDK_IS_X11_DISPLAY (display))
139+
return GDK_FILTER_CONTINUE;
134140
window = gdk_x11_window_lookup_for_display (display, xevent->xclient.window);
135141
if (!window)
136142
return GDK_FILTER_CONTINUE;
@@ -160,6 +166,7 @@ panel_action_protocol_init (void)
160166
GdkDisplay *display;
161167

162168
display = gdk_display_get_default ();
169+
g_assert(GDK_IS_X11_DISPLAY (display));
163170

164171
atom_mate_panel_action =
165172
XInternAtom (GDK_DISPLAY_XDISPLAY (display),

mate-panel/panel-action-protocol.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
#ifndef __PANEL_ACTION_PROTOCOL_H__
2626
#define __PANEL_ACTION_PROTOCOL_H__
2727

28+
#ifdef PACKAGE_NAME // only check HAVE_X11 if config.h has been included
29+
#ifndef HAVE_X11
30+
#error file should only be included when HAVE_X11 is enabled
31+
#endif
32+
#endif
33+
2834
#include <glib.h>
2935

3036
G_BEGIN_DECLS

0 commit comments

Comments
 (0)