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
This commit is contained in:
parent
1e203f4631
commit
d3d165243c
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 });
|
||||
|
@ -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 });
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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),
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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()),
|
||||
|
@ -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;
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 });
|
||||
|
Loading…
Reference in New Issue
Block a user