changeset 512:644a8d165e5a

plugin calls: use the new binding feature of webrtc module: the new binding feature is used to update the "Desktop" button if sharing is cancelled by user, or stopped somehow. rel 434
author Goffi <goffi@goffi.org>
date Thu, 18 Jan 2024 23:31:29 +0100
parents 290b405940b5
children 0fdf3e59aaad
files libervia/desktop_kivy/plugins/plugin_wid_calls.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/desktop_kivy/plugins/plugin_wid_calls.py	Tue Jan 16 15:00:23 2024 +0100
+++ b/libervia/desktop_kivy/plugins/plugin_wid_calls.py	Thu Jan 18 23:31:29 2024 +0100
@@ -106,7 +106,7 @@
     PROXIED_PROPERTIES = {
         'audio_muted', 'callee', 'desktop_sharing', 'sid', 'video_muted', 'desktop_sharing_data'
     }
-    PROXIED_METHODS = {'answer_call', 'end_call', 'on_accepted_call', 'on_ice_candidates_new', 'setup_call', 'start_pipeline'}
+    PROXIED_METHODS = {'answer_call', 'bind', 'end_call', 'on_accepted_call', 'on_ice_candidates_new', 'setup_call', 'start_pipeline'}
 
     def __init__(self, parent_calls: "Calls", profile: str) -> None:
         self.parent_calls = parent_calls
@@ -243,6 +243,7 @@
             if buf is not None and mapinfo is not None:
                 buf.unmap(mapinfo)
 
+
 class WindowSelectButton(Button):
     pass
 
@@ -301,6 +302,9 @@
         )
         self.header_input_add_extra(call_btn)
         self.webrtc = WebRTC(self, self.profile)
+        self.webrtc.bind(
+            desktop_sharing=partial(setattr, self, "desktop_sharing")
+        )
         self.previous_fullscreen = None
         self.reset_instance()
 
@@ -419,7 +423,10 @@
         if self.desktop_sharing:
             self.desktop_sharing = False
         else:
-            DesktopScreenDialog(self).open()
+            if display_servers.detect() == display_servers.X11:
+                DesktopScreenDialog(self).open()
+            else:
+                self.desktop_sharing = True
 
     def on_desktop_sharing(self, instance, active: bool) -> None:
         self.webrtc.desktop_sharing = active