Backport 'WindowsChanged' introspect signal

Related: #2148362
This commit is contained in:
Jonas Ådahl 2022-12-13 11:01:09 +01:00
parent 455ca25bb8
commit 97040a32ad
3 changed files with 122 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From eea9b9a0dac494698a64892bab8d042e7d623c9f Mon Sep 17 00:00:00 2001
From: Cenk Uluisik <cenk.uluisik@googlemail.com>
Date: Sun, 6 Mar 2022 19:32:48 +0100
Subject: [PATCH] introspect: Add WindowsChanged signal
The screencast portal supports recording a single window,
and presents a list of open windows when that option is
selected. To allow updating that list when windows are
opened or closed, add a new "WindowsChanged" signal that
the portal can listen to.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2229>
---
data/dbus-interfaces/org.gnome.Shell.Introspect.xml | 6 ++++++
js/misc/introspect.js | 3 +++
2 files changed, 9 insertions(+)
diff --git a/data/dbus-interfaces/org.gnome.Shell.Introspect.xml b/data/dbus-interfaces/org.gnome.Shell.Introspect.xml
index 47fd7efdc2..cb19cfec56 100644
--- a/data/dbus-interfaces/org.gnome.Shell.Introspect.xml
+++ b/data/dbus-interfaces/org.gnome.Shell.Introspect.xml
@@ -18,6 +18,12 @@
-->
<signal name="RunningApplicationsChanged" />
+ <!--
+ WindowsChanged:
+ @short_description: Notifies when any window opens or closes
+ -->
+ <signal name="WindowsChanged" />
+
<!--
GetRunningApplications:
@short_description: Retrieves the description of all running applications
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
index 45eee81ce3..8916804e7f 100644
--- a/js/misc/introspect.js
+++ b/js/misc/introspect.js
@@ -42,6 +42,9 @@ var IntrospectService = class {
this._syncRunningApplications();
});
+ tracker.connect('tracked-windows-changed',
+ () => this._dbusImpl.emit_signal('WindowsChanged', null));
+
this._syncRunningApplications();
this._senderChecker = new DBusSenderChecker(APP_ALLOWLIST);
--
2.38.1

View File

@ -0,0 +1,64 @@
From a1d650ce2722fd154b047ce73fa23db205d823d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2578>
---
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

View File

@ -2,7 +2,7 @@
Name: gnome-shell
Version: 40.10
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Window management and application launching for GNOME
License: GPLv2+
@ -47,6 +47,8 @@ Patch45: 0001-status-volume-Hide-sliders-initially.patch
Patch46: 0001-kbdA11yDialog-Use-MetaKeyboardA11yFlags.patch
Patch47: 0001-layout-Initialize-regions-unconditionally.patch
Patch48: 0001-introspect-Allowlist-GNOME-portal.patch
Patch49: 0001-introspect-Add-WindowsChanged-signal.patch
Patch50: 0001-window-tracker-Emit-tracked-windows-changed-on-title.patch
%define eds_version 3.33.1
%define gnome_desktop_version 3.35.91
@ -265,6 +267,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/evolution-calendar.de
%{_mandir}/man1/gnome-shell.1*
%changelog
* Fri Dec 02 2022 Jonas Ådahl <jadahl@redhat.com> - 40.10-5
- Backport 'WindowsChanged' introspect signal
Related: #2148362
* Wed Nov 23 2022 Florian Müllner <fmuellner@redhat.com> - 40.10-4
- Fix struts on login screen
Resolves: #2145185