shell/window-tracker: Track windows getting unmanaged
It makes sense to not rely on workspaces' ::window-removed signal, and we already do that in ShellApp. However it is odd to remove a tracked window from the app, but still track it in the window tracker. Move the code to remove unmanaged windows from both. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4751 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2029>
This commit is contained in:
@ -527,6 +527,13 @@ on_gtk_application_id_changed (MetaWindow *window,
|
||||
tracked_window_changed (self, window);
|
||||
}
|
||||
|
||||
static void
|
||||
on_window_unmanaged (MetaWindow *window,
|
||||
gpointer user_data)
|
||||
{
|
||||
disassociate_window (SHELL_WINDOW_TRACKER (user_data), window);
|
||||
}
|
||||
|
||||
static void
|
||||
track_window (ShellWindowTracker *self,
|
||||
MetaWindow *window)
|
||||
@ -542,6 +549,7 @@ track_window (ShellWindowTracker *self,
|
||||
|
||||
g_signal_connect (window, "notify::wm-class", G_CALLBACK (on_wm_class_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);
|
||||
|
||||
_shell_app_add_window (app, window);
|
||||
|
||||
@ -573,6 +581,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_gtk_application_id_changed), self);
|
||||
g_signal_handlers_disconnect_by_func (window, G_CALLBACK (on_window_unmanaged), self);
|
||||
|
||||
g_signal_emit (self, signals[TRACKED_WINDOWS_CHANGED], 0);
|
||||
|
||||
|
Reference in New Issue
Block a user