window-tracker: Also listen for changes in the gtk-application-id
Wayland applications don't tend to have very useful WM Class properties, as GTK+ isn't very good at picking an appropriate application ID. While we should likely fix GTK+ to pick a better app ID, we do have the existing gtk_shell for more accurate information. The only problem is that the gtk_surface is set after the MetaWindow is constructed, and we're not listening for changes on the GTK+ application ID. Listen to changes on the GTK+ application ID to fix app tracking for most GTK+ applications under Wayland.
This commit is contained in:
parent
49fcc93a4b
commit
aa3aea7520
@ -448,12 +448,9 @@ update_focus_app (ShellWindowTracker *self)
|
||||
}
|
||||
|
||||
static void
|
||||
on_wm_class_changed (MetaWindow *window,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
tracked_window_changed (ShellWindowTracker *self,
|
||||
MetaWindow *window)
|
||||
{
|
||||
ShellWindowTracker *self = SHELL_WINDOW_TRACKER (user_data);
|
||||
|
||||
/* It's simplest to just treat this as a remove + add. */
|
||||
disassociate_window (self, window);
|
||||
track_window (self, window);
|
||||
@ -462,6 +459,24 @@ on_wm_class_changed (MetaWindow *window,
|
||||
update_focus_app (self);
|
||||
}
|
||||
|
||||
static void
|
||||
on_wm_class_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,
|
||||
gpointer user_data)
|
||||
{
|
||||
ShellWindowTracker *self = SHELL_WINDOW_TRACKER (user_data);
|
||||
tracked_window_changed (self, window);
|
||||
}
|
||||
|
||||
static void
|
||||
track_window (ShellWindowTracker *self,
|
||||
MetaWindow *window)
|
||||
@ -476,6 +491,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::gtk-application-id", G_CALLBACK (on_gtk_application_id_changed), self);
|
||||
|
||||
_shell_app_add_window (app, window);
|
||||
|
||||
@ -508,6 +524,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_emit (self, signals[TRACKED_WINDOWS_CHANGED], 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user