[devilspie/libwnck3: 6/6] Only work on X11 displays



commit ae94aa34d5828faebf086a940ceb3b4738c0155e
Author: Christian Persch <chpe gnome org>
Date:   Thu May 31 18:30:56 2012 +0200

    Only work on X11 displays

 src/devilspie.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/devilspie.c b/src/devilspie.c
index 7af5dc8..e52d48e 100644
--- a/src/devilspie.c
+++ b/src/devilspie.c
@@ -24,6 +24,7 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <libwnck/libwnck.h>
+#include <gdk/gdkx.h>
 #include "e-sexp.h"
 #include "devilspie.h"
 #include "parser.h"
@@ -119,7 +120,18 @@ int main(int argc, char **argv) {
   /* Parse the arguments */
   context = g_option_context_new ("- Devil's Pie " VERSION);
   g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
-  g_option_context_parse (context, &argc, &argv, &error);
+  if (!g_option_context_parse (context, &argc, &argv, &error)) {
+    g_printerr (_("Failed to parse arguments: %s\n"), error->message);
+    g_error_free (error);
+    g_option_context_free (context);
+    return 1;
+  }
+  g_option_context_free (context);
+
+  if (!GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
+    g_printerr ("Not an X11 display.\n");
+    return 1;
+  }
 
   if (debug) g_printerr(_("Devil's Pie %s starting...\n"), VERSION);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]