From d7edd93f04f56bcf60e31096593cd60653726fe0 Mon Sep 17 00:00:00 2001 From: William Wold Date: Tue, 22 Jan 2019 08:40:49 -0500 Subject: Notification area: error if compiling without X11 support --- applets/notification_area/main.c | 10 ++++++++++ applets/notification_area/na-grid.h | 5 ++++- applets/notification_area/system-tray/na-tray-child.c | 9 +++++++++ applets/notification_area/system-tray/na-tray-child.h | 7 +++++++ applets/notification_area/system-tray/na-tray-manager.c | 5 +++++ applets/notification_area/system-tray/na-tray.c | 5 +++++ applets/notification_area/system-tray/na-tray.h | 4 +++- 7 files changed, 43 insertions(+), 2 deletions(-) diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c index 8d97ee59..8f8db2ff 100644 --- a/applets/notification_area/main.c +++ b/applets/notification_area/main.c @@ -22,6 +22,11 @@ */ #include + +#ifndef HAVE_X11 +#error file should only be built when HAVE_X11 is enabled +#endif + #include #include @@ -496,6 +501,11 @@ applet_factory (MatePanelApplet *applet, strcmp (iid, "SystemTrayApplet") == 0)) return FALSE; + if (!GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (applet)))) { + g_warning ("Notification area only works on X"); + return FALSE; + } + #ifndef NOTIFICATION_AREA_INPROCESS gtk_window_set_default_icon_name (NOTIFICATION_AREA_ICON); #endif diff --git a/applets/notification_area/na-grid.h b/applets/notification_area/na-grid.h index 7ddcc23c..9c8dd340 100644 --- a/applets/notification_area/na-grid.h +++ b/applets/notification_area/na-grid.h @@ -25,9 +25,12 @@ #ifndef NA_GRID_H #define NA_GRID_H -#ifdef GDK_WINDOWING_X11 +#include + +#ifdef HAVE_X11 #include #endif + #include G_BEGIN_DECLS diff --git a/applets/notification_area/system-tray/na-tray-child.c b/applets/notification_area/system-tray/na-tray-child.c index 047ce517..2f8549ac 100644 --- a/applets/notification_area/system-tray/na-tray-child.c +++ b/applets/notification_area/system-tray/na-tray-child.c @@ -20,6 +20,11 @@ */ #include + +#ifndef HAVE_X11 +#error file should only be built when HAVE_X11 is enabled +#endif + #include #include "na-tray-child.h" @@ -417,6 +422,10 @@ na_tray_child_new (GdkScreen *screen, */ display = gdk_screen_get_display (screen); + if (!GDK_IS_X11_DISPLAY (display)) { + g_warning ("na_tray only works on X11"); + return NULL; + } gdk_x11_display_error_trap_push (display); result = XGetWindowAttributes (xdisplay, icon_window, &window_attributes); diff --git a/applets/notification_area/system-tray/na-tray-child.h b/applets/notification_area/system-tray/na-tray-child.h index 6641fe88..aa39658a 100644 --- a/applets/notification_area/system-tray/na-tray-child.h +++ b/applets/notification_area/system-tray/na-tray-child.h @@ -23,7 +23,14 @@ #ifndef __NA_TRAY_CHILD_H__ #define __NA_TRAY_CHILD_H__ +#include + +#ifndef HAVE_X11 +#error file should only be included when HAVE_X11 is enabled +#endif + #include + #include #include diff --git a/applets/notification_area/system-tray/na-tray-manager.c b/applets/notification_area/system-tray/na-tray-manager.c index 3886a10d..4e137b25 100644 --- a/applets/notification_area/system-tray/na-tray-manager.c +++ b/applets/notification_area/system-tray/na-tray-manager.c @@ -21,6 +21,11 @@ */ #include + +#ifndef HAVE_X11 +#error file should only be built when HAVE_X11 is enabled +#endif + #include #include diff --git a/applets/notification_area/system-tray/na-tray.c b/applets/notification_area/system-tray/na-tray.c index 621d534d..bbf380c2 100644 --- a/applets/notification_area/system-tray/na-tray.c +++ b/applets/notification_area/system-tray/na-tray.c @@ -21,6 +21,11 @@ */ #include + +#ifndef HAVE_X11 +#error file should only be built when HAVE_X11 is enabled +#endif + #include #include diff --git a/applets/notification_area/system-tray/na-tray.h b/applets/notification_area/system-tray/na-tray.h index 8eaca36e..9f9d2bef 100644 --- a/applets/notification_area/system-tray/na-tray.h +++ b/applets/notification_area/system-tray/na-tray.h @@ -24,7 +24,9 @@ #ifndef __NA_TRAY_H__ #define __NA_TRAY_H__ -#ifdef GDK_WINDOWING_X11 +#include + +#ifdef HAVE_X11 #include #endif #include -- cgit v1.2.1