Blame SOURCES/windows-changed-signal.patch

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