[gnome-shell] Require both mouse and keyboard grabs for some grabs to be successful



commit 23b4eb459ed66b2d268b4b28ba0fd0fc3c90177d
Author: Sebastian Keller <skeller gnome org>
Date:   Sat Apr 30 08:18:39 2022 +0200

    Require both mouse and keyboard grabs for some grabs to be successful
    
    Commit 7419674b changed some grabs from requiring both mouse and
    keyboard grabs to be considered successful to only requiring either of
    them.
    
    Due to this it was possible for example to open the overview or the
    screenshot UI with a client (such as Chrome when opening a menu) holding
    the mouse grab. This then made it impossible to interact with the UI
    using the mouse (or keyboard) and if attempted could result in an
    unresponsive UI.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5414
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2287>

 js/ui/grabHelper.js   | 2 +-
 js/ui/lookingGlass.js | 4 ++--
 js/ui/modalDialog.js  | 2 +-
 js/ui/overview.js     | 8 ++++----
 4 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js
index c4028fc38b..650bec48d2 100644
--- a/js/ui/grabHelper.js
+++ b/js/ui/grabHelper.js
@@ -154,7 +154,7 @@ var GrabHelper = class GrabHelper {
         let firstGrab = this._modalCount == 0;
         if (firstGrab) {
             let grab = Main.pushModal(this._owner, this._modalParams);
-            if (grab.get_seat_state() === Clutter.GrabState.NONE) {
+            if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
                 Main.popModal(grab);
                 return false;
             }
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 7dea384209..c7bf483e4a 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -453,7 +453,7 @@ class ObjInspector extends St.ScrollView {
             return;
 
         const grab = Main.pushModal(this, { actionMode: Shell.ActionMode.LOOKING_GLASS });
-        if (grab.get_seat_state() === Clutter.GrabState.NONE) {
+        if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
             Main.popModal(grab);
             return;
         }
@@ -1612,7 +1612,7 @@ class LookingGlass extends St.BoxLayout {
             return;
 
         let grab = Main.pushModal(this, { actionMode: Shell.ActionMode.LOOKING_GLASS });
-        if (grab.get_seat_state() === Clutter.GrabState.NONE) {
+        if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
             Main.popModal(grab);
             return;
         }
diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js
index 04c0cf8ca4..64800a376d 100644
--- a/js/ui/modalDialog.js
+++ b/js/ui/modalDialog.js
@@ -237,7 +237,7 @@ var ModalDialog = GObject.registerClass({
         if (timestamp)
             params['timestamp'] = timestamp;
         let grab = Main.pushModal(this, params);
-        if (grab.get_seat_state() === Clutter.GrabState.NONE) {
+        if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
             Main.popModal(grab);
             return false;
         }
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 4e86860ca5..615c6b10af 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -456,14 +456,14 @@ var Overview = class {
                 const grab = Main.pushModal(global.stage, {
                     actionMode: Shell.ActionMode.OVERVIEW,
                 });
-                if (grab.get_seat_state() !== Clutter.GrabState.NONE) {
-                    this._grab = grab;
-                    this._modal = true;
-                } else {
+                if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
                     Main.popModal(grab);
                     this.hide();
                     return false;
                 }
+
+                this._grab = grab;
+                this._modal = true;
             }
         } else {
             // eslint-disable-next-line no-lonely-if


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