From a1d650ce2722fd154b047ce73fa23db205d823d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 12 Dec 2022 13:04:11 +0100 Subject: [PATCH] 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: --- src/shell-window-tracker.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/shell-window-tracker.c b/src/shell-window-tracker.c index 991613ea3f..df357f81b7 100644 --- a/src/shell-window-tracker.c +++ b/src/shell-window-tracker.c @@ -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); -- 2.38.1