[gnome-shell] js/main: Inhibit remote access when depending on session mode



commit c3646a7642fea6764a5e7f9c6a70e6a8e33a4287
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Apr 21 16:13:20 2020 +0200

    js/main: Inhibit remote access when depending on session mode
    
    The session mode determines whether the screen casting should work or
    not, but until now only dealt with the built in screen cast, not the
    ones using PipeWire. Add the newly added API for inhibiting remote
    access when the session mode says screencasts are not allowed.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1210

 js/ui/main.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index bdd93ae1b0..2d7a480191 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -97,6 +97,8 @@ let _oskResource = null;
 Gio._promisify(Gio._LocalFilePrototype, 'delete_async', 'delete_finish');
 Gio._promisify(Gio._LocalFilePrototype, 'touch_async', 'touch_finish');
 
+let _remoteAccessInhibited = false;
+
 function _sessionUpdated() {
     if (sessionMode.isPrimary)
         _loadDefaultStylesheet();
@@ -121,6 +123,17 @@ function _sessionUpdated() {
         if (lookingGlass)
             lookingGlass.close();
     }
+
+    let remoteAccessController = global.backend.get_remote_access_controller();
+    if (remoteAccessController) {
+        if (sessionMode.allowScreencast && _remoteAccessInhibited) {
+            remoteAccessController.uninhibit_remote_access();
+            _remoteAccessInhibited = false;
+        } else if (!sessionMode.allowScreencast && !_remoteAccessInhibited) {
+            remoteAccessController.inhibit_remote_access();
+            _remoteAccessInhibited = true;
+        }
+    }
 }
 
 function start() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]