From 71680bb5f3a4cb739ce5695d07e96d92c6c1aebf Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 10 Oct 2024 01:26:02 +0200 Subject: [PATCH] panel-message: allow building without X11 --- tools/message.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/message.c b/tools/message.c index 06be426..9f98f4c 100644 --- a/tools/message.c +++ b/tools/message.c @@ -22,12 +22,16 @@ #include #include #include +#include #include -#if GTK_CHECK_VERSION(3, 0, 0) -# include +#if defined(GDK_WINDOWING_X11) +# if GTK_CHECK_VERSION(3, 0, 0) +# include +# endif #endif #include "../include/Panel.h" #include "../config.h" + #define _(string) gettext(string) /* constants */ @@ -50,8 +54,10 @@ static int _message(unsigned int timeout, char const * stock, char const * title, char const * message); +#if defined(GDK_WINDOWING_X11) /* callbacks */ static gboolean _message_on_timeout(gpointer data); +#endif static int _error(char const * message, int ret); static int _usage(void); @@ -62,6 +68,7 @@ static int _usage(void); static int _message(unsigned int timeout, char const * stock, char const * title, char const * message) { +#if defined(GDK_WINDOWING_X11) PangoFontDescription * bold; GtkWidget * plug; GtkWidget * hbox; @@ -136,9 +143,19 @@ static int _message(unsigned int timeout, char const * stock, pango_font_description_free(bold); gtk_main(); return 0; +#else + (void) timeout; + (void) stock; + (void) title; + (void) message; + + return error_set_print(PROGNAME_PANEL_MESSAGE, 2, "%s", + "X11 support not detected"); +#endif } +#if defined(GDK_WINDOWING_X11) /* callbacks */ /* message_on_timeout */ static gboolean _message_on_timeout(gpointer data) @@ -148,6 +165,7 @@ static gboolean _message_on_timeout(gpointer data) gtk_main_quit(); return FALSE; } +#endif /* error */