Skip to content

Commit

Permalink
panel-action-protocol: 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 4fe2b74 commit c733d20
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-action-protocol.c
Original file line number Diff line number Diff line change
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-action-protocol.h"

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

screen = gdk_event_get_screen (event);
display = gdk_screen_get_display (screen);
if (!GDK_IS_X11_DISPLAY (display))
return GDK_FILTER_CONTINUE;
window = gdk_x11_window_lookup_for_display (display, xevent->xclient.window);
if (!window)
return GDK_FILTER_CONTINUE;
Expand Down Expand Up @@ -160,6 +166,7 @@ panel_action_protocol_init (void)
GdkDisplay *display;

display = gdk_display_get_default ();
g_assert(GDK_IS_X11_DISPLAY (display));

atom_mate_panel_action =
XInternAtom (GDK_DISPLAY_XDISPLAY (display),
Expand Down
6 changes: 6 additions & 0 deletions mate-panel/panel-action-protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
#ifndef __PANEL_ACTION_PROTOCOL_H__
#define __PANEL_ACTION_PROTOCOL_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>

G_BEGIN_DECLS
Expand Down

0 comments on commit c733d20

Please sign in to comment.