gtkwindow: Minor refactor

Move the handling of the startup ID to a separate function, since
this will be called from several places.
This commit is contained in:
Carlos Garnacho 2023-01-03 13:42:41 +01:00
parent 3c4f6144a0
commit 6f01f846dc

View File

@ -3895,6 +3895,28 @@ gtk_window_update_toplevel (GtkWindow *window,
gdk_toplevel_layout_unref (layout); 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 static void
gtk_window_map (GtkWidget *widget) gtk_window_map (GtkWidget *widget)
{ {
@ -3919,21 +3941,7 @@ gtk_window_map (GtkWidget *widget)
gtk_window_set_theme_variant (window); gtk_window_set_theme_variant (window);
if (!disable_startup_notification) gtk_window_notify_startup (window);
{
/* 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);
}
/* inherit from transient parent, so that a dialog that is /* inherit from transient parent, so that a dialog that is
* opened via keynav shows focus initially * opened via keynav shows focus initially