gtkwindow: Minor refactor
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 3 Jan 2023 12:42:41 +0000 (13:42 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 3 Jan 2023 13:57:44 +0000 (14:57 +0100)
Move the handling of the startup ID to a separate function, since
this will be called from several places.

gtk/gtkwindow.c

index dfe84c9b6e9adbaeb1e64081d1c8609e338cfa84..fe68204415193ef1f24832f5b5236de8d67d783c 100644 (file)
@@ -3895,6 +3895,28 @@ gtk_window_update_toplevel (GtkWindow         *window,
   gdk_toplevel_layout_unref (layout);
 }
 
+static void
+gtk_window_notify_startup (GtkWindow *window)
+{
+  GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
+
+  if (!disable_startup_notification)
+    {
+      /* Do we have a custom startup-notification id? */
+      if (priv->startup_id != NULL)
+        {
+          /* Make sure we have a "real" id */
+          if (!startup_id_is_fake (priv->startup_id))
+            gdk_toplevel_set_startup_id (GDK_TOPLEVEL (priv->surface), priv->startup_id);
+
+          g_free (priv->startup_id);
+          priv->startup_id = NULL;
+        }
+      else
+        gdk_toplevel_set_startup_id (GDK_TOPLEVEL (priv->surface), NULL);
+    }
+}
+
 static void
 gtk_window_map (GtkWidget *widget)
 {
@@ -3919,21 +3941,7 @@ gtk_window_map (GtkWidget *widget)
 
   gtk_window_set_theme_variant (window);
 
-  if (!disable_startup_notification)
-    {
-      /* Do we have a custom startup-notification id? */
-      if (priv->startup_id != NULL)
-        {
-          /* Make sure we have a "real" id */
-          if (!startup_id_is_fake (priv->startup_id))
-            gdk_display_notify_startup_complete (gtk_widget_get_display (widget), priv->startup_id);
-
-          g_free (priv->startup_id);
-          priv->startup_id = NULL;
-        }
-       else
-         gdk_display_notify_startup_complete (gtk_widget_get_display (widget), NULL);
-    }
+  gtk_window_notify_startup (window);
 
   /* inherit from transient parent, so that a dialog that is
    * opened via keynav shows focus initially