[gnome-shell] appDisplay: Make middle-click like Ctrl+click



commit a21a22fdb58820864f6fe982b705150cb4a97ced
Author: Xavier Johnson <krinkodot22 hotmail com>
Date:   Tue May 29 00:27:22 2018 -0400

    appDisplay: Make middle-click like Ctrl+click
    
    When middle-clicking an app icon on the Dash, it will always try to open
    a new window of that app, even if the app doesn't support multiple
    windows. Meanwhile, Ctrl+click on an app will only open a new window if
    the app allows it.
    
    This change prevents middle-clicks on app icons from opening new windows
    for apps without multi-window support.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/316

 js/ui/appDisplay.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 2c4d2d1da..2835c2aae 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1778,10 +1778,11 @@ var AppIcon = new Lang.Class({
     activate(button) {
         let event = Clutter.get_current_event();
         let modifiers = event ? event.get_state() : 0;
-        let openNewWindow = this.app.can_open_new_window () &&
-                            modifiers & Clutter.ModifierType.CONTROL_MASK &&
-                            this.app.state == Shell.AppState.RUNNING ||
-                            button && button == 2;
+        let isMiddleButton = button && button == Clutter.BUTTON_MIDDLE;
+        let isCtrlPressed = (modifiers & Clutter.ModifierType.CONTROL_MASK) != 0;
+        let openNewWindow = this.app.can_open_new_window() &&
+                            this.app.state == Shell.AppState.RUNNING &&
+                            (isCtrlPressed || isMiddleButton);
 
         if (this.app.state == Shell.AppState.STOPPED || openNewWindow)
             this.animateLaunch();


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