This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository e16-keyedit.

View the commit online.

commit bee386768cc189c248bbfbaea343ba9c4f923298
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Fri Dec 8 13:24:35 2023 +0100

    Handle initial failure to connect a bit nicer
---
 ipc.c    | 19 +++++++++++++++++--
 viewer.c |  4 ++--
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/ipc.c b/ipc.c
index 1a95431..f44985b 100644
--- a/ipc.c
+++ b/ipc.c
@@ -12,6 +12,13 @@
 #define gdk_window_foreign_new(xwin) \
     gdk_x11_window_foreign_new_for_display(gdk_display_get_default(), xwin)
 
+#if USE_GTK == 3
+#define gdk_error_trap_push() \
+    gdk_x11_display_error_trap_push(gdk_display_get_default())
+#define gdk_error_trap_pop() \
+    gdk_x11_display_error_trap_pop(gdk_display_get_default())
+#endif
+
 typedef struct {
     Window          win;
     char           *msg;
@@ -37,7 +44,7 @@ static GdkWindow *gdkwin2 = NULL;
 static void     (*msg_receive_callback)(char *msg) = NULL;
 static unsigned int Atom_ENL_MSG;
 
-static void
+static int
 CommsSetup(void)
 {
     char           *str;
@@ -47,9 +54,15 @@ CommsSetup(void)
     str = getenv("ENL_WM_ROOT");
     root_win = (str) ? strtoul(str, NULL, 0) : DefaultRootWindow(dpy);
 
+    gdk_error_trap_push();
     my_win = XCreateSimpleWindow(dpy, root_win, -10, -10, 1, 1, 0, 0, 0);
+    XSync(dpy, False);
+    if (gdk_error_trap_pop())
+        return 1;
 
     Atom_ENL_MSG = XInternAtom(dpy, "ENL_MSG", False);
+
+    return 0;
 }
 
 static          Window
@@ -203,7 +216,9 @@ CommsInit(void  (*msg_receive_func)(char *msg))
 {
     Window          win;
 
-    CommsSetup();
+    if (CommsSetup())
+        return 1;
+
     comms_win = win = CommsFindCommsWindow();
     if (win == None)
         return 1;
diff --git a/viewer.c b/viewer.c
index e78077d..82c4cfe 100644
--- a/viewer.c
+++ b/viewer.c
@@ -1190,7 +1190,7 @@ main(int argc, char *argv[])
     {
         GtkWidget      *win, *frame, *vbox, *label, *button;
 
-        win = gtk_window_new(GTK_WINDOW_POPUP);
+        win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
         gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER);
         frame = gtk_frame_new(NULL);
         gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
@@ -1204,7 +1204,7 @@ main(int argc, char *argv[])
                               "to configure it.\n" "\n");
         gtk_container_add(GTK_CONTAINER(win), frame);
         gtk_container_add(GTK_CONTAINER(frame), vbox);
-        gtk_container_set_border_width(GTK_CONTAINER(vbox), 32);
+        gtk_container_set_border_width(GTK_CONTAINER(vbox), 16);
         gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
         gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
         gtk_widget_show_all(win);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to