Blame SOURCES/windows-changed-signal.patch

aecdcd
From 396a999f3e9daa0e3511e590339915e5ad9b6b31 Mon Sep 17 00:00:00 2001
aecdcd
From: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
aecdcd
Date: Mon, 24 Oct 2022 16:10:00 -0300
aecdcd
Subject: [PATCH 1/4] screencastwidget: Trivial style cleanup
aecdcd
aecdcd
(cherry picked from commit 663994bc20a0d93264a0b68222522c68e8525ba4)
aecdcd
---
aecdcd
 src/screencastwidget.c | 6 +++---
aecdcd
 1 file changed, 3 insertions(+), 3 deletions(-)
aecdcd
aecdcd
diff --git a/src/screencastwidget.c b/src/screencastwidget.c
aecdcd
index cdd57dc..0009a35 100644
aecdcd
--- a/src/screencastwidget.c
aecdcd
+++ b/src/screencastwidget.c
aecdcd
@@ -266,9 +266,9 @@ connect_windows_changed_listener (ScreenCastWidget *widget)
aecdcd
   g_assert (!widget->windows_changed_handler_id);
aecdcd
   widget->windows_changed_handler_id =
aecdcd
     g_signal_connect (widget->shell_introspect,
aecdcd
-                          "windows-changed",
aecdcd
-                          G_CALLBACK (on_windows_changed),
aecdcd
-                          widget);
aecdcd
+                      "windows-changed",
aecdcd
+                      G_CALLBACK (on_windows_changed),
aecdcd
+                      widget);
aecdcd
   shell_introspect_ref_listeners (widget->shell_introspect);
aecdcd
 }
aecdcd
 
aecdcd
-- 
aecdcd
2.38.1
aecdcd
aecdcd
aecdcd
From 5e7444c4ac4e0bc181a7cee9c00b3e542f77e0f6 Mon Sep 17 00:00:00 2001
aecdcd
From: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
aecdcd
Date: Mon, 24 Oct 2022 16:10:31 -0300
aecdcd
Subject: [PATCH 2/4] screencastwidget: Use g_clear_signal_handler
aecdcd
aecdcd
Small cleanup
aecdcd
aecdcd
(cherry picked from commit e0002330c41d62f49d9b58002ae1a607a79c67bf)
aecdcd
---
aecdcd
 src/meson.build        | 2 +-
aecdcd
 src/screencastwidget.c | 5 ++---
aecdcd
 2 files changed, 3 insertions(+), 4 deletions(-)
aecdcd
aecdcd
diff --git a/src/meson.build b/src/meson.build
aecdcd
index 6d2e476..8341aa1 100644
aecdcd
--- a/src/meson.build
aecdcd
+++ b/src/meson.build
aecdcd
@@ -60,7 +60,7 @@ deps = [
aecdcd
   declare_dependency(sources: built_sources),
aecdcd
   meson.get_compiler('c').find_library('m'),
aecdcd
   dependency('fontconfig'),
aecdcd
-  dependency('glib-2.0', version: '>= 2.44'),
aecdcd
+  dependency('glib-2.0', version: '>= 2.62'),
aecdcd
   dependency('gio-unix-2.0'),
aecdcd
   dependency('gtk4', version: '>= 4.0'),
aecdcd
   dependency('gsettings-desktop-schemas'),
aecdcd
diff --git a/src/screencastwidget.c b/src/screencastwidget.c
aecdcd
index 0009a35..82dd3bd 100644
aecdcd
--- a/src/screencastwidget.c
aecdcd
+++ b/src/screencastwidget.c
aecdcd
@@ -276,9 +276,8 @@ static void
aecdcd
 disconnect_windows_changed_listener (ScreenCastWidget *widget)
aecdcd
 {
aecdcd
   g_assert (widget->windows_changed_handler_id);
aecdcd
-  g_signal_handler_disconnect (widget->shell_introspect,
aecdcd
-                               widget->windows_changed_handler_id);
aecdcd
-  widget->windows_changed_handler_id = 0;
aecdcd
+  g_clear_signal_handler (&widget->windows_changed_handler_id,
aecdcd
+                          widget->shell_introspect);
aecdcd
   shell_introspect_unref_listeners (widget->shell_introspect);
aecdcd
 }
aecdcd
 
aecdcd
-- 
aecdcd
2.38.1
aecdcd
aecdcd
aecdcd
From 6b491b555bb3514da4fcadb4147813217392724b Mon Sep 17 00:00:00 2001
aecdcd
From: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
aecdcd
Date: Mon, 24 Oct 2022 18:55:51 -0300
aecdcd
Subject: [PATCH 3/4] Import newer org.gnome.Shell.Introspect.xml
aecdcd
aecdcd
It has a handy signal we will use soon, the "WindowsChanged" signal.
aecdcd
aecdcd
(cherry picked from commit 41277ae33a9c9d54e6df7d7277854ccc79265fc2)
aecdcd
---
aecdcd
 data/org.gnome.Shell.Introspect.xml | 14 ++++++++++++++
aecdcd
 1 file changed, 14 insertions(+)
aecdcd
aecdcd
diff --git a/data/org.gnome.Shell.Introspect.xml b/data/org.gnome.Shell.Introspect.xml
aecdcd
index d71f241..cb19cfe 100644
aecdcd
--- a/data/org.gnome.Shell.Introspect.xml
aecdcd
+++ b/data/org.gnome.Shell.Introspect.xml
aecdcd
@@ -18,6 +18,12 @@
aecdcd
     -->
aecdcd
     <signal name="RunningApplicationsChanged" />
aecdcd
 
aecdcd
+    
aecdcd
+        WindowsChanged:
aecdcd
+        @short_description: Notifies when any window opens or closes
aecdcd
+    -->
aecdcd
+    <signal name="WindowsChanged" />
aecdcd
+
aecdcd
     
aecdcd
         GetRunningApplications:
aecdcd
         @short_description: Retrieves the description of all running applications
aecdcd
@@ -70,6 +76,14 @@
aecdcd
     -->
aecdcd
     <property name="AnimationsEnabled" type="b" access="read"/>
aecdcd
 
aecdcd
+    
aecdcd
+       ScreenSize:
aecdcd
+       @short_description: The size of the screen
aecdcd
+
aecdcd
+       Since: 3
aecdcd
+    -->
aecdcd
+    <property name="ScreenSize" type="(ii)" access="read"/>
aecdcd
+
aecdcd
     <property name="version" type="u" access="read"/>
aecdcd
   </interface>
aecdcd
 </node>
aecdcd
-- 
aecdcd
2.38.1
aecdcd
aecdcd
aecdcd
From 70b25b7abb8223876f0ca509852e21ec26e3f624 Mon Sep 17 00:00:00 2001
aecdcd
From: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
aecdcd
Date: Mon, 24 Oct 2022 18:56:59 -0300
aecdcd
Subject: [PATCH 4/4] shellintrospect: React to "windows-changed" signal
aecdcd
aecdcd
In addition to fetching the list of windows whenever a new
aecdcd
listener registers, listen to the "windows-changed" signal
aecdcd
from the D-Bus proxy and update the list of windows when
aecdcd
Shell signals us.
aecdcd
aecdcd
Fixes
aecdcd
https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/17
aecdcd
aecdcd
(cherry picked from commit ddc82436d623a7904882230ede0049a8e3ee6595)
aecdcd
---
aecdcd
 src/shellintrospect.c | 12 ++++++++++++
aecdcd
 1 file changed, 12 insertions(+)
aecdcd
aecdcd
diff --git a/src/shellintrospect.c b/src/shellintrospect.c
aecdcd
index 6b007b4..1fa8b93 100644
aecdcd
--- a/src/shellintrospect.c
aecdcd
+++ b/src/shellintrospect.c
aecdcd
@@ -189,6 +189,14 @@ shell_introspect_are_animations_enabled (ShellIntrospect *shell_introspect,
aecdcd
   return TRUE;
aecdcd
 }
aecdcd
 
aecdcd
+static void
aecdcd
+on_windows_changed_cb (GDBusProxy      *proxy,
aecdcd
+                       ShellIntrospect *shell_introspect)
aecdcd
+{
aecdcd
+  if (shell_introspect->num_listeners > 0)
aecdcd
+    sync_state (shell_introspect);
aecdcd
+}
aecdcd
+
aecdcd
 static void
aecdcd
 sync_animations_enabled (ShellIntrospect *shell_introspect)
aecdcd
 {
aecdcd
@@ -233,6 +241,10 @@ on_shell_introspect_proxy_acquired (GObject      *object,
aecdcd
 
aecdcd
   shell_introspect->proxy = proxy;
aecdcd
 
aecdcd
+  g_signal_connect (proxy, "windows-changed",
aecdcd
+                    G_CALLBACK (on_windows_changed_cb),
aecdcd
+                    shell_introspect);
aecdcd
+
aecdcd
   if (shell_introspect->num_listeners > 0)
aecdcd
     sync_state (shell_introspect);
aecdcd
 
aecdcd
-- 
aecdcd
2.38.1
aecdcd