gtkwindow: Minor refactor

Move the handling of the startup ID to a separate function, since
this will be called from several places.

(cherry-picked from commit 6f01f846dc66a6359a1524ace13377536821dbb0)
This commit is contained in:
Carlos Garnacho 2023-01-18 19:55:31 +01:00
parent 7a9f88ee48
commit a067938589

View File

@ -6279,6 +6279,32 @@ popover_map (GtkWidget *widget,
}
}
static void
gtk_window_notify_startup (GtkWindow *window)
{
GtkWindowPrivate *priv = window->priv;
if (!disable_startup_notification &&
!GTK_IS_OFFSCREEN_WINDOW (window) &&
priv->type != GTK_WINDOW_POPUP)
{
/* 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_notify_startup_complete_with_id (priv->startup_id);
g_free (priv->startup_id);
priv->startup_id = NULL;
}
else
{
gdk_notify_startup_complete ();
}
}
}
static void
gtk_window_map (GtkWidget *widget)
{
@ -6354,25 +6380,7 @@ gtk_window_map (GtkWidget *widget)
gdk_window_show (gdk_window);
if (!disable_startup_notification &&
!GTK_IS_OFFSCREEN_WINDOW (window) &&
priv->type != GTK_WINDOW_POPUP)
{
/* 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_notify_startup_complete_with_id (priv->startup_id);
g_free (priv->startup_id);
priv->startup_id = NULL;
}
else
{
gdk_notify_startup_complete ();
}
}
gtk_window_notify_startup (window);
/* if mnemonics visible is not already set
* (as in the case of popup menus), then hide mnemonics initially