Merge branch 'startup-vs-xdg-activation' into 'main'

Startup tracking with xdg-activation

See merge request GNOME/gtk!3883
This commit is contained in:
Carlos Garnacho 2022-02-28 17:29:09 +00:00
commit 68319afd23
6 changed files with 11 additions and 5 deletions

View File

@ -1040,7 +1040,7 @@ out:
g_signal_connect_swapped (G_OBJECT (demo), "destroy", G_CALLBACK (g_application_quit), app); g_signal_connect_swapped (G_OBJECT (demo), "destroy", G_CALLBACK (g_application_quit), app);
} }
else else
gtk_widget_show (GTK_WIDGET (window)); gtk_window_present (GTK_WINDOW (window));
if (autoquit) if (autoquit)
g_timeout_add_seconds (1, auto_quit, app); g_timeout_add_seconds (1, auto_quit, app);

View File

@ -871,7 +871,7 @@ activate (GApplication *app)
update_ui (); update_ui ();
gtk_widget_show (main_window); gtk_window_present (GTK_WINDOW (main_window));
} }
static void static void

View File

@ -2360,7 +2360,7 @@ activate (GApplication *app)
model = (GMenuModel *)gtk_builder_get_object (builder, "new_style_context_menu_model"); model = (GMenuModel *)gtk_builder_get_object (builder, "new_style_context_menu_model");
set_up_context_popover (widget, model); set_up_context_popover (widget, model);
gtk_widget_show (GTK_WIDGET (window)); gtk_window_present (window);
g_object_unref (builder); g_object_unref (builder);
} }

View File

@ -854,6 +854,10 @@ gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
char *free_this = NULL; char *free_this = NULL;
/* Will be signaled with focus activation */
if (display_wayland->xdg_activation)
return;
if (startup_id == NULL) if (startup_id == NULL)
{ {
startup_id = free_this = display_wayland->startup_notification_id; startup_id = free_this = display_wayland->startup_notification_id;

View File

@ -3474,6 +3474,7 @@ gdk_wayland_surface_focus (GdkSurface *surface,
xdg_activation_v1_activate (display_wayland->xdg_activation, xdg_activation_v1_activate (display_wayland->xdg_activation,
display_wayland->startup_notification_id, display_wayland->startup_notification_id,
impl->display_server.wl_surface); impl->display_server.wl_surface);
gdk_wayland_display_set_startup_notification_id (GDK_DISPLAY (display_wayland), NULL);
} }
else if (display_wayland->gtk_shell_version >= 3) else if (display_wayland->gtk_shell_version >= 3)
{ {

View File

@ -5271,14 +5271,15 @@ gtk_window_present_with_time (GtkWindow *window,
#endif #endif
timestamp = gtk_get_current_event_time (); timestamp = gtk_get_current_event_time ();
} }
gdk_toplevel_focus (GDK_TOPLEVEL (surface), timestamp);
} }
else else
{ {
priv->initial_timestamp = timestamp; priv->initial_timestamp = timestamp;
gtk_widget_show (widget); gtk_widget_show (widget);
} }
g_assert (priv->surface != NULL);
gdk_toplevel_focus (GDK_TOPLEVEL (priv->surface), timestamp);
} }
/** /**