@techee requested changes on this pull request.

Looks good apart from the minor code style comment.

Just curious, didn't the use of `XDG_ACTIVATION_TOKEN` fix the focus issue 
under gnome by any chance?

> @@ -1056,6 +1056,17 @@ gint main_lib(gint argc, gchar **argv)
 #ifdef ENABLE_NLS
        main_locale_init(utils_resource_dir(RESOURCE_DIR_LOCALE), 
GETTEXT_PACKAGE);
 #endif
+
+       /* Magic ID used on X11 and Wayland for bringing our existing window on 
top;
+        * need to read it here, since GTK will clear this from the environment 
in
+        * gtk_init () (called from parse_command_line_options () below). Need 
to
+        * make a copy, since the value is not guaranteed to be valid after 
calling
+        * unsetenv() (which is done by GTK). */
+#ifdef HAVE_SOCKET
+       gchar *desktop_startup_id = g_strdup(getenv("DESKTOP_STARTUP_ID"));
+       if (!desktop_startup_id) desktop_startup_id = 
g_strdup(getenv("XDG_ACTIVATION_TOKEN"));

Style only: indented assignment on a new line.

> +                     if (socket_fd_gets(sock, buf, sizeof(buf)) != -1 && 
> *buf != '.')
+                       {
+#if defined(GDK_WINDOWING_WAYLAND) || defined(GDK_WINDOWING_X11)
+                               g_strstrip(buf); /* remove \n char */
+                               geany_debug("got desktop_startup_id: %s", buf);
+                               GdkDisplay *display = gdk_display_get_default();
+#ifdef GDK_WINDOWING_WAYLAND
+                               if (GDK_IS_WAYLAND_DISPLAY(display))
+                                       
gdk_wayland_display_set_startup_notification_id(display, buf);
+#endif
+#ifdef GDK_WINDOWING_X11
+                               if (GDK_IS_X11_DISPLAY(display))
+                                       
gdk_x11_display_set_startup_notification_id(display, buf);
+#endif
+#endif // GDK_WINDOWING_WAYLAND || GDK_WINDOWING_X11
+                               while (socket_fd_gets(sock, buf, sizeof(buf)) 
!= -1 && *buf != '.')

Possibly good indeed if tokens contain newlines (probably not).

> @@ -1085,7 +1093,7 @@ gint main_lib(gint argc, gchar **argv)
 #endif
                socket_info.lock_socket = -1;
                socket_info.lock_socket_tag = 0;
-               socket_info.lock_socket = socket_init(argc, argv, socket_port);
+               socket_info.lock_socket = socket_init(argc, argv, socket_port, 
desktop_startup_id);

Right, I didn't check the code properly enough.

> @@ -719,6 +729,22 @@ gboolean socket_lock_input_cb(GIOChannel *source, 
> GIOCondition condition, gpoint
                                cl_options.goto_column = atoi(buf);
                        }
                }
+               else if (strncmp(buf, "desktop_startup_id", 18) == 0)
+               {
+                       GdkDisplay *display = gdk_display_get_default();

It probably doesn't cause any harm if we keep it.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/4071#pullrequestreview-2464668063
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/4071/review/[email protected]>

Reply via email to