ref: 12bac584e165493f91435ffacb2b4633c593346c
parent: 8659cfd6409dcf093fc6d89e89bd38da391ba009
parent: da2fa989eb7c776578d4e722f27189b4bfe2d477
author: Simon Howard <fraggle@gmail.com>
date: Tue Apr 29 20:07:14 EDT 2014
Merge branch 'master' of github.com:chocolate-doom/chocolate-doom
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -262,6 +262,39 @@
exit(0);
}
+#define ZENITY_BINARY "/usr/bin/zenity"
+
+// returns non-zero if zenity is available
+
+static int ZenityAvailable(void)
+{
+ return system(ZENITY_BINARY " --help >/dev/null 2>&1") == 0;
+}
+
+// Open a native error box with a message using zenity
+
+static int ZenityErrorBox(char *message)
+{
+ int *result;
+ char *errorboxpath;
+ static size_t errorboxpath_size;
+
+ if (!ZenityAvailable())
+ {
+ return 0;
+ }
+
+ errorboxpath_size = strlen(ZENITY_BINARY) + strlen(message) + 19;
+ errorboxpath = malloc(errorboxpath_size);
+ M_snprintf(errorboxpath, errorboxpath_size, "%s --error --text=\"%s\"", ZENITY_BINARY, message);
+
+ result = system(errorboxpath);
+
+ free(errorboxpath);
+
+ return result;
+}
+
//
// I_Error
//
@@ -327,9 +360,7 @@
MessageBoxW(NULL, wmsgbuf, L"", MB_OK);
}
-#endif
-
-#ifdef __MACOSX__
+#elif defined(__MACOSX__)
if (exit_gui_popup && !I_ConsoleStdout())
{
CFStringRef message;
@@ -364,6 +395,11 @@
CFSTR(PACKAGE_STRING),
message,
NULL);
+ }
+#else
+ if (exit_gui_popup && !I_ConsoleStdout())
+ {
+ ZenityErrorBox(error);
}
#endif