keyboard: Use camelCase

Those aren't GObject properties, so should follow the regular JS style.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1976
This commit is contained in:
Florian Müllner 2019-12-04 18:51:08 +01:00
parent 9b4780fa1d
commit 85f10f1f6a

View File

@ -269,8 +269,8 @@ var Key = GObject.registerClass({
this.add_child(this.keyButton); this.add_child(this.keyButton);
this.connect('destroy', this._onDestroy.bind(this)); this.connect('destroy', this._onDestroy.bind(this));
this._extended_keys = extendedKeys; this._extendedKeys = extendedKeys;
this._extended_keyboard = null; this._extendedKeyboard = null;
this._pressTimeoutId = 0; this._pressTimeoutId = 0;
this._capturedPress = false; this._capturedPress = false;
@ -289,7 +289,7 @@ var Key = GObject.registerClass({
} }
_ensureExtendedKeysPopup() { _ensureExtendedKeysPopup() {
if (this._extended_keys.length == 0) if (this._extendedKeys.length === 0)
return; return;
this._boxPointer = new BoxPointer.BoxPointer(St.Side.BOTTOM); this._boxPointer = new BoxPointer.BoxPointer(St.Side.BOTTOM);
@ -300,7 +300,7 @@ var Key = GObject.registerClass({
// Adds style to existing keyboard style to avoid repetition // Adds style to existing keyboard style to avoid repetition
this._boxPointer.add_style_class_name('keyboard-subkeys'); this._boxPointer.add_style_class_name('keyboard-subkeys');
this._getExtendedKeys(); this._getExtendedKeys();
this.keyButton._extended_keys = this._extended_keyboard; this.keyButton._extendedKeys = this._extendedKeyboard;
} }
_getKeyval(key) { _getKeyval(key) {
@ -311,7 +311,7 @@ var Key = GObject.registerClass({
_press(key) { _press(key) {
this.emit('activated'); this.emit('activated');
if (key != this.key || this._extended_keys.length == 0) if (key !== this.key || this._extendedKeys.length === 0)
this.emit('pressed', this._getKeyval(key), key); this.emit('pressed', this._getKeyval(key), key);
if (key == this.key) { if (key == this.key) {
@ -323,7 +323,7 @@ var Key = GObject.registerClass({
this.emit('long-press'); this.emit('long-press');
if (this._extended_keys.length > 0) { if (this._extendedKeys.length > 0) {
this._touchPressed = false; this._touchPressed = false;
this.keyButton.set_hover(false); this.keyButton.set_hover(false);
this.keyButton.fake_release(); this.keyButton.fake_release();
@ -342,7 +342,7 @@ var Key = GObject.registerClass({
this._pressTimeoutId = 0; this._pressTimeoutId = 0;
} }
if (!this._longPress && key == this.key && this._extended_keys.length > 0) if (!this._longPress && key === this.key && this._extendedKeys.length > 0)
this.emit('pressed', this._getKeyval(key), key); this.emit('pressed', this._getKeyval(key), key);
this.emit('released', this._getKeyval(key), key); this.emit('released', this._getKeyval(key), key);
@ -445,19 +445,21 @@ var Key = GObject.registerClass({
} }
_getExtendedKeys() { _getExtendedKeys() {
this._extended_keyboard = new St.BoxLayout({ style_class: 'key-container', this._extendedKeyboard = new St.BoxLayout({
vertical: false }); style_class: 'key-container',
for (let i = 0; i < this._extended_keys.length; ++i) { vertical: false,
let extendedKey = this._extended_keys[i]; });
for (let i = 0; i < this._extendedKeys.length; ++i) {
let extendedKey = this._extendedKeys[i];
let key = this._makeKey(extendedKey); let key = this._makeKey(extendedKey);
key.extended_key = extendedKey; key.extendedKey = extendedKey;
this._extended_keyboard.add(key); this._extendedKeyboard.add(key);
key.width = this.keyButton.width; key.width = this.keyButton.width;
key.height = this.keyButton.height; key.height = this.keyButton.height;
} }
this._boxPointer.bin.add_actor(this._extended_keyboard); this._boxPointer.bin.add_actor(this._extendedKeyboard);
} }
get subkeys() { get subkeys() {
@ -1177,7 +1179,7 @@ var KeyboardManager = class KeyBoardManager {
let actor = event.get_source(); let actor = event.get_source();
return Main.layoutManager.keyboardBox.contains(actor) || return Main.layoutManager.keyboardBox.contains(actor) ||
!!actor._extended_keys || !!actor.extended_key; !!actor._extendedKeys || !!actor.extendedKey;
} }
}; };
@ -1339,7 +1341,7 @@ class Keyboard extends St.BoxLayout {
// Showing an extended key popup and clicking a key from the extended keys // Showing an extended key popup and clicking a key from the extended keys
// will grab focus, but ignore that // will grab focus, but ignore that
let extendedKeysWereFocused = this._focusInExtendedKeys; let extendedKeysWereFocused = this._focusInExtendedKeys;
this._focusInExtendedKeys = focus && (focus._extended_keys || focus.extended_key); this._focusInExtendedKeys = focus && (focus._extendedKeys || focus.extendedKey);
if (this._focusInExtendedKeys || extendedKeysWereFocused) if (this._focusInExtendedKeys || extendedKeysWereFocused)
return; return;