window-tracker: Emit 'tracked-windows-changed' on title changes

This means the screen share window view gets updated also when the title
of a window changes. This is important since it often changes shortly
after mapping, which would otherwise go unnoticed by
xdg-desktop-portal-gnome.

An example is launching Files and it showing up as 'Loading..', or
launching a terminal, and it not showing the proper title (current
directory), but some place holder that is never visible on the
application window.

Adding it to the window tracker instead of in introspect.js itself is
for convenience - there is no per window signal tracking there, and it
already listens to the signal emissions about changed windows.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2578>
This commit is contained in:
Jonas Ådahl 2022-12-12 13:04:11 +01:00 committed by Marge Bot
parent 3b216be637
commit a1d650ce27

View File

@ -524,6 +524,15 @@ on_wm_class_changed (MetaWindow *window,
tracked_window_changed (self, window);
}
static void
on_title_changed (MetaWindow *window,
GParamSpec *pspec,
gpointer user_data)
{
ShellWindowTracker *self = SHELL_WINDOW_TRACKER (user_data);
tracked_window_changed (self, window);
}
static void
on_gtk_application_id_changed (MetaWindow *window,
GParamSpec *pspec,
@ -554,6 +563,7 @@ track_window (ShellWindowTracker *self,
g_hash_table_insert (self->window_to_app, window, app);
g_signal_connect (window, "notify::wm-class", G_CALLBACK (on_wm_class_changed), self);
g_signal_connect (window, "notify::title", G_CALLBACK (on_title_changed), self);
g_signal_connect (window, "notify::gtk-application-id", G_CALLBACK (on_gtk_application_id_changed), self);
g_signal_connect (window, "unmanaged", G_CALLBACK (on_window_unmanaged), self);
@ -586,6 +596,7 @@ disassociate_window (ShellWindowTracker *self,
_shell_app_remove_window (app, window);
g_signal_handlers_disconnect_by_func (window, G_CALLBACK (on_wm_class_changed), self);
g_signal_handlers_disconnect_by_func (window, G_CALLBACK (on_title_changed), self);
g_signal_handlers_disconnect_by_func (window, G_CALLBACK (on_gtk_application_id_changed), self);
g_signal_handlers_disconnect_by_func (window, G_CALLBACK (on_window_unmanaged), self);