[gnome-shell] cleanup: Use non-deprecated key symbols



commit d3d165243c8457cc65e8864cee493f27fca15d59
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Nov 5 20:37:28 2019 +0100

    cleanup: Use non-deprecated key symbols
    
    Clutter originally cluttered its namespace with key symbols, before
    prefixing all symbols with KEY. We still use the unprefixed symbols
    occasionally, replace them so mutter can drop the deprecated symbols.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/808

 js/ui/altTab.js                 | 22 +++++++++++-----------
 js/ui/appDisplay.js             | 12 ++++++------
 js/ui/audioDeviceSelection.js   |  2 +-
 js/ui/closeDialog.js            |  2 +-
 js/ui/components/keyring.js     |  2 +-
 js/ui/components/polkitAgent.js |  2 +-
 js/ui/ctrlAltTab.js             |  4 ++--
 js/ui/dnd.js                    |  2 +-
 js/ui/endSessionDialog.js       |  2 +-
 js/ui/extensionDownloader.js    |  2 +-
 js/ui/kbdA11yDialog.js          |  4 ++--
 js/ui/lookingGlass.js           |  6 +++---
 js/ui/padOsd.js                 |  2 +-
 js/ui/runDialog.js              |  4 ++--
 js/ui/shellMountOperation.js    |  4 ++--
 js/ui/status/keyboard.js        |  4 ++--
 js/ui/status/network.js         |  4 ++--
 js/ui/switchMonitor.js          |  4 ++--
 js/ui/switcherPopup.js          |  2 +-
 js/ui/viewSelector.js           | 24 ++++++++++++------------
 js/ui/windowManager.js          |  2 +-
 21 files changed, 56 insertions(+), 56 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index c2d3760a2b..e81199dc83 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -180,25 +180,25 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
             this._select(this._next());
         } else if (action == Meta.KeyBindingAction.SWITCH_APPLICATIONS_BACKWARD) {
             this._select(this._previous());
-        } else if (keysym == Clutter.q) {
+        } else if (keysym === Clutter.KEY_q) {
             this._quitApplication(this._selectedIndex);
         } else if (this._thumbnailsFocused) {
-            if (keysym == Clutter.Left)
+            if (keysym === Clutter.KEY_Left)
                 this._select(this._selectedIndex, this._previousWindow());
-            else if (keysym == Clutter.Right)
+            else if (keysym === Clutter.KEY_Right)
                 this._select(this._selectedIndex, this._nextWindow());
-            else if (keysym == Clutter.Up)
+            else if (keysym === Clutter.KEY_Up)
                 this._select(this._selectedIndex, null, true);
-            else if (keysym == Clutter.w || keysym == Clutter.F4)
+            else if (keysym === Clutter.KEY_w || keysym === Clutter.KEY_F4)
                 this._closeAppWindow(this._selectedIndex, this._currentWindow);
             else
                 return Clutter.EVENT_PROPAGATE;
         } else {
-            if (keysym == Clutter.Left)
+            if (keysym === Clutter.KEY_Left)
                 this._select(this._previous());
-            else if (keysym == Clutter.Right)
+            else if (keysym === Clutter.KEY_Right)
                 this._select(this._next());
-            else if (keysym == Clutter.Down)
+            else if (keysym === Clutter.KEY_Down)
                 this._select(this._selectedIndex, 0);
             else
                 return Clutter.EVENT_PROPAGATE;
@@ -596,11 +596,11 @@ class WindowSwitcherPopup extends SwitcherPopup.SwitcherPopup {
         } else if (action == Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD) {
             this._select(this._previous());
         } else {
-            if (keysym == Clutter.Left)
+            if (keysym === Clutter.KEY_Left)
                 this._select(this._previous());
-            else if (keysym == Clutter.Right)
+            else if (keysym === Clutter.KEY_Right)
                 this._select(this._next());
-            else if (keysym == Clutter.w || keysym == Clutter.F4)
+            else if (keysym === Clutter.KEY_w || keysym === Clutter.KEY_F4)
                 this._closeWindow(this._selectedIndex);
             else
                 return Clutter.EVENT_PROPAGATE;
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index cb08acceaf..f9706aa2eb 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -660,10 +660,10 @@ var AllView = GObject.registerClass({
         if (this._displayingPopup)
             return Clutter.EVENT_STOP;
 
-        if (event.get_key_symbol() == Clutter.Page_Up) {
+        if (event.get_key_symbol() === Clutter.KEY_Page_Up) {
             this.goToPage(this._grid.currentPage - 1);
             return Clutter.EVENT_STOP;
-        } else if (event.get_key_symbol() == Clutter.Page_Down) {
+        } else if (event.get_key_symbol() === Clutter.KEY_Page_Down) {
             this.goToPage(this._grid.currentPage + 1);
             return Clutter.EVENT_STOP;
         }
@@ -1960,18 +1960,18 @@ var AppFolderPopup = GObject.registerClass({
         let direction;
         let isLtr = Clutter.get_default_text_direction() == Clutter.TextDirection.LTR;
         switch (keyEvent.keyval) {
-        case Clutter.Down:
+        case Clutter.KEY_Down:
             direction = St.DirectionType.TAB_FORWARD;
             break;
-        case Clutter.Right:
+        case Clutter.KEY_Right:
             direction = isLtr
                 ? St.DirectionType.TAB_FORWARD
                 : St.DirectionType.TAB_BACKWARD;
             break;
-        case Clutter.Up:
+        case Clutter.KEY_Up:
             direction = St.DirectionType.TAB_BACKWARD;
             break;
-        case Clutter.Left:
+        case Clutter.KEY_Left:
             direction = isLtr
                 ? St.DirectionType.TAB_BACKWARD
                 : St.DirectionType.TAB_FORWARD;
diff --git a/js/ui/audioDeviceSelection.js b/js/ui/audioDeviceSelection.js
index ba7d1e9fe0..f8c8ea6baf 100644
--- a/js/ui/audioDeviceSelection.js
+++ b/js/ui/audioDeviceSelection.js
@@ -54,7 +54,7 @@ var AudioDeviceSelectionDialog = GObject.registerClass({
                              label: _("Sound Settings") });
         this.addButton({ action: this.close.bind(this),
                          label: _("Cancel"),
-                         key: Clutter.Escape });
+                         key: Clutter.KEY_Escape });
     }
 
     _getDeviceLabel(device) {
diff --git a/js/ui/closeDialog.js b/js/ui/closeDialog.js
index 5cbeb9c5cb..4d43196ba6 100644
--- a/js/ui/closeDialog.js
+++ b/js/ui/closeDialog.js
@@ -73,7 +73,7 @@ var CloseDialog = GObject.registerClass({
                                  default: true });
         this._dialog.addButton({ label: _('Wait'),
                                  action: this._onWait.bind(this),
-                                 key: Clutter.Escape });
+                                 key: Clutter.KEY_Escape });
 
         global.focus_manager.add_group(this._dialog);
 
diff --git a/js/ui/components/keyring.js b/js/ui/components/keyring.js
index f32a462103..429fbce80d 100644
--- a/js/ui/components/keyring.js
+++ b/js/ui/components/keyring.js
@@ -33,7 +33,7 @@ class KeyringDialog extends ModalDialog.ModalDialog {
 
         this._cancelButton = this.addButton({ label: '',
                                               action: this._onCancelButton.bind(this),
-                                              key: Clutter.Escape });
+                                              key: Clutter.KEY_Escape });
         this._continueButton = this.addButton({ label: '',
                                                 action: this._onContinueButton.bind(this),
                                                 default: true });
diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js
index 1a11c0b7eb..8759400ef3 100644
--- a/js/ui/components/polkitAgent.js
+++ b/js/ui/components/polkitAgent.js
@@ -136,7 +136,7 @@ var AuthenticationDialog = GObject.registerClass({
 
         this._cancelButton = this.addButton({ label: _("Cancel"),
                                               action: this.cancel.bind(this),
-                                              key: Clutter.Escape });
+                                              key: Clutter.KEY_Escape });
         this._okButton = this.addButton({ label: _("Authenticate"),
                                           action: this._onAuthenticateButtonPressed.bind(this),
                                           reactive: false });
diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js
index f765d529c5..cb7e4cd691 100644
--- a/js/ui/ctrlAltTab.js
+++ b/js/ui/ctrlAltTab.js
@@ -143,9 +143,9 @@ class CtrlAltTabPopup extends SwitcherPopup.SwitcherPopup {
             this._select(this._next());
         else if (action == Meta.KeyBindingAction.SWITCH_PANELS_BACKWARD)
             this._select(this._previous());
-        else if (keysym == Clutter.Left)
+        else if (keysym == Clutter.KEY_Left)
             this._select(this._previous());
-        else if (keysym == Clutter.Right)
+        else if (keysym == Clutter.KEY_Right)
             this._select(this._next());
         else
             return Clutter.EVENT_PROPAGATE;
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 6fff86b251..2ec939740d 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -267,7 +267,7 @@ var _Draggable = class _Draggable {
         // dragging and ignore all other key presses.
         } else if (event.type() == Clutter.EventType.KEY_PRESS && this._dragState == DragState.DRAGGING) {
             let symbol = event.get_key_symbol();
-            if (symbol == Clutter.Escape) {
+            if (symbol == Clutter.KEY_Escape) {
                 this._cancelDrag(event.get_time());
                 return Clutter.EVENT_STOP;
             }
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index fc5440eb72..319e8c764d 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -443,7 +443,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
         let dialogContent = DialogContent[this._type];
         let buttons = [{ action: this.cancel.bind(this),
                          label: _("Cancel"),
-                         key: Clutter.Escape }];
+                         key: Clutter.KEY_Escape }];
 
         for (let i = 0; i < dialogContent.confirmButtons.length; i++) {
             let signal = dialogContent.confirmButtons[i].signal;
diff --git a/js/ui/extensionDownloader.js b/js/ui/extensionDownloader.js
index dc3f1d566d..a19aa832be 100644
--- a/js/ui/extensionDownloader.js
+++ b/js/ui/extensionDownloader.js
@@ -189,7 +189,7 @@ class InstallExtensionDialog extends ModalDialog.ModalDialog {
         this.setButtons([{
             label: _("Cancel"),
             action: this._onCancelButtonPressed.bind(this),
-            key: Clutter.Escape,
+            key: Clutter.KEY_Escape,
         }, {
             label: _("Install"),
             action: this._onInstallButtonPressed.bind(this),
diff --git a/js/ui/kbdA11yDialog.js b/js/ui/kbdA11yDialog.js
index f5ffccce7c..877c4327ad 100644
--- a/js/ui/kbdA11yDialog.js
+++ b/js/ui/kbdA11yDialog.js
@@ -61,7 +61,7 @@ class KbdA11yDialog extends GObject.Object {
                                dialog.close();
                            },
                            default: enabled,
-                           key: !enabled ? Clutter.Escape : null });
+                           key: !enabled ? Clutter.KEY_Escape : null });
 
         dialog.addButton({ label: enabled ? _("Turn Off") : _("Leave Off"),
                            action: () => {
@@ -69,7 +69,7 @@ class KbdA11yDialog extends GObject.Object {
                                dialog.close();
                            },
                            default: !enabled,
-                           key: enabled ? Clutter.Escape : null });
+                           key: enabled ? Clutter.KEY_Escape : null });
 
         dialog.open();
     }
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 87f2aa04cd..284282c787 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -81,7 +81,7 @@ var AutoComplete = class AutoComplete {
         if (cursorPos != -1) {
             text = text.slice(0, cursorPos);
         }
-        if (event.get_key_symbol() == Clutter.Tab) {
+        if (event.get_key_symbol() === Clutter.KEY_Tab) {
             let [completions, attrHead] = JsParse.getCompletions(text, commandHeader, 
AUTO_COMPLETE_GLOBAL_KEYWORDS);
             let currTime = global.get_current_time();
             if ((currTime - this._lastTabTime) < AUTO_COMPLETE_DOUBLE_TAB_DELAY) {
@@ -565,7 +565,7 @@ var Inspector = GObject.registerClass({
     }
 
     _onKeyPressEvent(actor, event) {
-        if (event.get_key_symbol() == Clutter.Escape)
+        if (event.get_key_symbol() === Clutter.KEY_Escape)
             this._close();
         return Clutter.EVENT_STOP;
     }
@@ -1096,7 +1096,7 @@ class LookingGlass extends St.BoxLayout {
     // Handle key events which are relevant for all tabs of the LookingGlass
     vfunc_key_press_event(keyPressEvent) {
         let symbol = keyPressEvent.keyval;
-        if (symbol == Clutter.Escape) {
+        if (symbol === Clutter.KEY_Escape) {
             if (this._objInspector.visible) {
                 this._objInspector.close();
             } else {
diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js
index 75e274f33f..4b8d1d76d5 100644
--- a/js/ui/padOsd.js
+++ b/js/ui/padOsd.js
@@ -797,7 +797,7 @@ var PadOsd = GObject.registerClass({
             this._padDiagram.deactivateButton(event.get_button());
             return Clutter.EVENT_STOP;
         } else if (event.type() == Clutter.EventType.KEY_PRESS &&
-                   (!this._editionMode || event.get_key_symbol() == Clutter.Escape)) {
+                   (!this._editionMode || event.get_key_symbol() === Clutter.KEY_Escape)) {
             if (this._editedAction != null)
                 this._endActionEdition();
             else
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index 8154b94273..edb9bc9ca9 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -95,7 +95,7 @@ class RunDialog extends ModalDialog.ModalDialog {
         this.setButtons([{
             action: this.close.bind(this),
             label: _("Close"),
-            key: Clutter.Escape,
+            key: Clutter.KEY_Escape,
         }]);
 
         this._pathCompleter = new Gio.FilenameCompleter();
@@ -112,7 +112,7 @@ class RunDialog extends ModalDialog.ModalDialog {
         });
         this._entryText.connect('key-press-event', (o, e) => {
             let symbol = e.get_key_symbol();
-            if (symbol == Clutter.Tab) {
+            if (symbol === Clutter.KEY_Tab) {
                 let text = o.get_text();
                 let prefix;
                 if (text.lastIndexOf(' ') == -1)
diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js
index 968205a458..f8bda055f7 100644
--- a/js/ui/shellMountOperation.js
+++ b/js/ui/shellMountOperation.js
@@ -394,7 +394,7 @@ var ShellMountPasswordDialog = GObject.registerClass({
         this._defaultButtons = [{
             label: _("Cancel"),
             action: this._onCancelButton.bind(this),
-            key: Clutter.Escape,
+            key: Clutter.KEY_Escape,
         }, {
             label: _("Unlock"),
             action: this._onUnlockButton.bind(this),
@@ -404,7 +404,7 @@ var ShellMountPasswordDialog = GObject.registerClass({
         this._usesKeyfilesButtons = [{
             label: _("Cancel"),
             action: this._onCancelButton.bind(this),
-            key: Clutter.Escape,
+            key: Clutter.KEY_Escape,
         }, {
             /* Translators: %s is the Disks application */
             label: _("Open %s").format(disksApp.get_name()),
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index f378170774..d6423e5ab5 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -87,9 +87,9 @@ class InputSourcePopup extends SwitcherPopup.SwitcherPopup {
             this._select(this._next());
         else if (action == this._actionBackward)
             this._select(this._previous());
-        else if (keysym == Clutter.Left)
+        else if (keysym == Clutter.KEY_Left)
             this._select(this._previous());
-        else if (keysym == Clutter.Right)
+        else if (keysym == Clutter.KEY_Right)
             this._select(this._next());
         else
             return Clutter.EVENT_PROPAGATE;
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index c5643f03b9..b7e36c87a7 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -908,10 +908,10 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
 
         this._disconnectButton = this.addButton({ action: this.close.bind(this),
                                                   label: _("Cancel"),
-                                                  key: Clutter.Escape });
+                                                  key: Clutter.KEY_Escape });
         this._connectButton = this.addButton({ action: this._connect.bind(this),
                                                label: _("Connect"),
-                                               key: Clutter.Return });
+                                               key: Clutter.KEY_Return });
     }
 
     _connect() {
diff --git a/js/ui/switchMonitor.js b/js/ui/switchMonitor.js
index a53e06033a..ded8c49c02 100644
--- a/js/ui/switchMonitor.js
+++ b/js/ui/switchMonitor.js
@@ -52,9 +52,9 @@ class SwitchMonitorPopup extends SwitcherPopup.SwitcherPopup {
     _keyPressHandler(keysym, action) {
         if (action == Meta.KeyBindingAction.SWITCH_MONITOR)
             this._select(this._next());
-        else if (keysym == Clutter.Left)
+        else if (keysym == Clutter.KEY_Left)
             this._select(this._previous());
-        else if (keysym == Clutter.Right)
+        else if (keysym == Clutter.KEY_Right)
             this._select(this._next());
         else
             return Clutter.EVENT_PROPAGATE;
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index cc49ddf73f..04c4d3337e 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -172,7 +172,7 @@ var SwitcherPopup = GObject.registerClass({
 
         // Note: pressing one of the below keys will destroy the popup only if
         // that key is not used by the active popup's keyboard shortcut
-        if (keysym == Clutter.Escape || keysym == Clutter.Tab)
+        if (keysym === Clutter.KEY_Escape || keysym === Clutter.KEY_Tab)
             this.fadeAndDestroy();
 
         return Clutter.EVENT_STOP;
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 6b10ec600c..618dbd6df9 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -406,7 +406,7 @@ var ViewSelector = GObject.registerClass({
 
         let symbol = event.get_key_symbol();
 
-        if (symbol == Clutter.Escape) {
+        if (symbol === Clutter.KEY_Escape) {
             if (this._searchActive)
                 this.reset();
             else if (this._showAppsButton.checked)
@@ -417,10 +417,10 @@ var ViewSelector = GObject.registerClass({
         } else if (this._shouldTriggerSearch(symbol)) {
             this.startSearch(event);
         } else if (!this._searchActive && !global.stage.key_focus) {
-            if (symbol == Clutter.Tab || symbol == Clutter.Down) {
+            if (symbol === Clutter.KEY_Tab || symbol === Clutter.KEY_Down) {
                 this._activePage.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
                 return Clutter.EVENT_STOP;
-            } else if (symbol == Clutter.ISO_Left_Tab) {
+            } else if (symbol === Clutter.KEY_ISO_Left_Tab) {
                 this._activePage.navigate_focus(null, St.DirectionType.TAB_BACKWARD, false);
                 return Clutter.EVENT_STOP;
             }
@@ -485,10 +485,10 @@ var ViewSelector = GObject.registerClass({
     }
 
     _shouldTriggerSearch(symbol) {
-        if (symbol == Clutter.Multi_key)
+        if (symbol === Clutter.KEY_Multi_key)
             return true;
 
-        if (symbol == Clutter.BackSpace && this._searchActive)
+        if (symbol === Clutter.KEY_BackSpace && this._searchActive)
             return true;
 
         let unicode = Clutter.keysym_to_unicode(symbol);
@@ -541,7 +541,7 @@ var ViewSelector = GObject.registerClass({
 
     _onKeyPress(entry, event) {
         let symbol = event.get_key_symbol();
-        if (symbol == Clutter.Escape) {
+        if (symbol === Clutter.KEY_Escape) {
             if (this._isActivated()) {
                 this.reset();
                 return Clutter.EVENT_STOP;
@@ -549,28 +549,28 @@ var ViewSelector = GObject.registerClass({
         } else if (this._searchActive) {
             let arrowNext, nextDirection;
             if (entry.get_text_direction() == Clutter.TextDirection.RTL) {
-                arrowNext = Clutter.Left;
+                arrowNext = Clutter.KEY_Left;
                 nextDirection = St.DirectionType.LEFT;
             } else {
-                arrowNext = Clutter.Right;
+                arrowNext = Clutter.KEY_Right;
                 nextDirection = St.DirectionType.RIGHT;
             }
 
-            if (symbol == Clutter.Tab) {
+            if (symbol === Clutter.KEY_Tab) {
                 this._searchResults.navigateFocus(St.DirectionType.TAB_FORWARD);
                 return Clutter.EVENT_STOP;
-            } else if (symbol == Clutter.ISO_Left_Tab) {
+            } else if (symbol === Clutter.KEY_ISO_Left_Tab) {
                 this._focusTrap.can_focus = false;
                 this._searchResults.navigateFocus(St.DirectionType.TAB_BACKWARD);
                 this._focusTrap.can_focus = true;
                 return Clutter.EVENT_STOP;
-            } else if (symbol == Clutter.Down) {
+            } else if (symbol === Clutter.KEY_Down) {
                 this._searchResults.navigateFocus(St.DirectionType.DOWN);
                 return Clutter.EVENT_STOP;
             } else if (symbol == arrowNext && this._text.position == -1) {
                 this._searchResults.navigateFocus(nextDirection);
                 return Clutter.EVENT_STOP;
-            } else if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
+            } else if (symbol === Clutter.KEY_Return || symbol === Clutter.KEY_KP_Enter) {
                 this._searchResults.activateDefault();
                 return Clutter.EVENT_STOP;
             }
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 5b33877418..97f4ef8a98 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -69,7 +69,7 @@ class DisplayChangeDialog extends ModalDialog.ModalDialog {
         */
         this._cancelButton = this.addButton({ label: _("Revert Settings"),
                                               action: this._onFailure.bind(this),
-                                              key: Clutter.Escape });
+                                              key: Clutter.KEY_Escape });
         this._okButton = this.addButton({ label: _("Keep Changes"),
                                           action: this._onSuccess.bind(this),
                                           default: true });


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