Skip to content

Commit d7edd93

Browse files
wmwwraveit65
authored andcommitted
Notification area: error if compiling without X11 support
1 parent 3630b20 commit d7edd93

File tree

7 files changed

+43
-2
lines changed

7 files changed

+43
-2
lines changed

applets/notification_area/main.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
*/
2323

2424
#include <config.h>
25+
26+
#ifndef HAVE_X11
27+
#error file should only be built when HAVE_X11 is enabled
28+
#endif
29+
2530
#include <string.h>
2631

2732
#include <mate-panel-applet.h>
@@ -496,6 +501,11 @@ applet_factory (MatePanelApplet *applet,
496501
strcmp (iid, "SystemTrayApplet") == 0))
497502
return FALSE;
498503

504+
if (!GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (applet)))) {
505+
g_warning ("Notification area only works on X");
506+
return FALSE;
507+
}
508+
499509
#ifndef NOTIFICATION_AREA_INPROCESS
500510
gtk_window_set_default_icon_name (NOTIFICATION_AREA_ICON);
501511
#endif

applets/notification_area/na-grid.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
#ifndef NA_GRID_H
2626
#define NA_GRID_H
2727

28-
#ifdef GDK_WINDOWING_X11
28+
#include <config.h>
29+
30+
#ifdef HAVE_X11
2931
#include <gdk/gdkx.h>
3032
#endif
33+
3134
#include <gtk/gtk.h>
3235

3336
G_BEGIN_DECLS

applets/notification_area/system-tray/na-tray-child.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
*/
2121

2222
#include <config.h>
23+
24+
#ifndef HAVE_X11
25+
#error file should only be built when HAVE_X11 is enabled
26+
#endif
27+
2328
#include <string.h>
2429

2530
#include "na-tray-child.h"
@@ -417,6 +422,10 @@ na_tray_child_new (GdkScreen *screen,
417422
*/
418423

419424
display = gdk_screen_get_display (screen);
425+
if (!GDK_IS_X11_DISPLAY (display)) {
426+
g_warning ("na_tray only works on X11");
427+
return NULL;
428+
}
420429
gdk_x11_display_error_trap_push (display);
421430
result = XGetWindowAttributes (xdisplay, icon_window,
422431
&window_attributes);

applets/notification_area/system-tray/na-tray-child.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@
2323
#ifndef __NA_TRAY_CHILD_H__
2424
#define __NA_TRAY_CHILD_H__
2525

26+
#include <config.h>
27+
28+
#ifndef HAVE_X11
29+
#error file should only be included when HAVE_X11 is enabled
30+
#endif
31+
2632
#include <gtk/gtk.h>
33+
2734
#include <gdk/gdkx.h>
2835
#include <gtk/gtkx.h>
2936

applets/notification_area/system-tray/na-tray-manager.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
*/
2222

2323
#include <config.h>
24+
25+
#ifndef HAVE_X11
26+
#error file should only be built when HAVE_X11 is enabled
27+
#endif
28+
2429
#include <string.h>
2530
#include <libintl.h>
2631

applets/notification_area/system-tray/na-tray.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
*/
2222

2323
#include <config.h>
24+
25+
#ifndef HAVE_X11
26+
#error file should only be built when HAVE_X11 is enabled
27+
#endif
28+
2429
#include <string.h>
2530

2631
#include <gtk/gtk.h>

applets/notification_area/system-tray/na-tray.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
#ifndef __NA_TRAY_H__
2525
#define __NA_TRAY_H__
2626

27-
#ifdef GDK_WINDOWING_X11
27+
#include <config.h>
28+
29+
#ifdef HAVE_X11
2830
#include <gdk/gdkx.h>
2931
#endif
3032
#include <gtk/gtk.h>

0 commit comments

Comments
 (0)