[gnome-shell] window-tracker: Also listen for changes in the gtk-application-id
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] window-tracker: Also listen for changes in the gtk-application-id
- Date: Mon, 13 Oct 2014 00:24:49 +0000 (UTC)
commit aa3aea75201120226e04450aaf5d58115482031e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Oct 12 17:20:22 2014 -0700
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.
src/shell-window-tracker.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/src/shell-window-tracker.c b/src/shell-window-tracker.c
index 512f7ec..5c49008 100644
--- a/src/shell-window-tracker.c
+++ b/src/shell-window-tracker.c
@@ -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);
@@ -463,6 +460,24 @@ on_wm_class_changed (MetaWindow *window,
}
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]