From 0353a5bf2c46c80184dfc1b579bcdeeb0d762bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 28 Aug 2019 23:06:14 +0300 Subject: [PATCH] cleanup: Rename signals/methods that will conflict with Clutter.Actor https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559 --- js/ui/calendar.js | 12 ++++++------ js/ui/keyboard.js | 30 +++++++++++++++--------------- js/ui/lightbox.js | 18 ++++++++++++------ js/ui/messageList.js | 4 ++-- js/ui/modalDialog.js | 2 +- js/ui/screenShield.js | 24 +++++++++++++----------- js/ui/search.js | 16 ++++++++++++---- js/ui/windowManager.js | 10 +++++----- 8 files changed, 66 insertions(+), 50 deletions(-) diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 88e008e2c..6abc23e6c 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -1106,7 +1106,7 @@ var CalendarMessageList = class CalendarMessageList { visibleId: 0, emptyChangedId: 0, canClearChangedId: 0, - keyFocusId: 0 + messageFocusedId: 0 }; obj.destroyId = section.actor.connect('destroy', () => { this._removeSection(section); @@ -1117,8 +1117,8 @@ var CalendarMessageList = class CalendarMessageList { this._sync.bind(this)); obj.canClearChangedId = section.connect('can-clear-changed', this._sync.bind(this)); - obj.keyFocusId = section.connect('key-focus-in', - this._onKeyFocusIn.bind(this)); + obj.messageFocusedId = section.connect('message-focused', + this._onMessageFocused.bind(this)); this._sections.set(section, obj); this._sectionList.add_actor(section.actor); @@ -1131,15 +1131,15 @@ var CalendarMessageList = class CalendarMessageList { section.actor.disconnect(obj.visibleId); section.disconnect(obj.emptyChangedId); section.disconnect(obj.canClearChangedId); - section.disconnect(obj.keyFocusId); + section.disconnect(obj.messageFocusedId); this._sections.delete(section); this._sectionList.remove_actor(section.actor); this._sync(); } - _onKeyFocusIn(section, actor) { - Util.ensureActorVisibleInScrollView(this._scrollView, actor); + _onMessageFocused(_section, messageActor) { + Util.ensureActorVisibleInScrollView(this._scrollView, messageActor); } _sync() { diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 45eb5ce82..b6aa58fcb 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -977,7 +977,7 @@ var EmojiSelection = class EmojiSelection { key.keyButton.add_style_class_name('default-key'); key.keyButton.add_style_class_name('hide-key'); key.connect('released', () => { - this.emit('hide'); + this.emit('close-request'); }); row.appendKey(key.actor); row.layoutButtons(); @@ -1076,9 +1076,9 @@ var Keyboard = class Keyboard { return; if (focused) - this.show(Main.layoutManager.focusIndex); + this.open(Main.layoutManager.focusIndex); else - this.hide(); + this.close(); }); Meta.get_backend().connect('last-device-changed', @@ -1187,7 +1187,7 @@ var Keyboard = class Keyboard { this._emojiSelection = new EmojiSelection(); this._emojiSelection.connect('toggle', this._toggleEmoji.bind(this)); - this._emojiSelection.connect('hide', () => this.hide()); + this._emojiSelection.connect('close-request', () => this.close()); this._emojiSelection.connect('emoji-selected', (selection, emoji) => { this._keyboardController.commitString(emoji); }); @@ -1235,13 +1235,13 @@ var Keyboard = class Keyboard { return; if (!(focus instanceof Clutter.Text)) { - this.hide(); + this.close(); return; } if (!this._showIdleId) { this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => { - this.show(Main.layoutManager.focusIndex); + this.open(Main.layoutManager.focusIndex); this._showIdleId = 0; return GLib.SOURCE_REMOVE; }); @@ -1357,7 +1357,7 @@ var Keyboard = class Keyboard { if (keyval != null) this._keyboardController.keyvalRelease(keyval); else if (action == 'hide') - this.hide(); + this.close(); else if (action == 'languageMenu') this._popupLanguageMenu(actor); else if (action == 'emoji') @@ -1523,9 +1523,9 @@ var Keyboard = class Keyboard { return; if (enabled) - this.show(Main.layoutManager.focusIndex); + this.open(Main.layoutManager.focusIndex); else - this.hide(); + this.close(); } _setActiveLayer(activeLevel) { @@ -1565,7 +1565,7 @@ var Keyboard = class Keyboard { this._keyboardRestingId = 0; } - show(monitor) { + open(monitor) { if (!this._enabled) return; @@ -1585,13 +1585,13 @@ var Keyboard = class Keyboard { KEYBOARD_REST_TIME, () => { this._clearKeyboardRestTimer(); - this._show(monitor); + this._open(monitor); return GLib.SOURCE_REMOVE; }); GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer'); } - _show(monitor) { + _open(monitor) { if (!this._keyboardRequested) return; @@ -1607,7 +1607,7 @@ var Keyboard = class Keyboard { } } - hide() { + close() { if (!this._enabled) return; @@ -1622,13 +1622,13 @@ var Keyboard = class Keyboard { KEYBOARD_REST_TIME, () => { this._clearKeyboardRestTimer(); - this._hide(); + this._close(); return GLib.SOURCE_REMOVE; }); GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer'); } - _hide() { + _close() { if (this._keyboardRequested) return; diff --git a/js/ui/lightbox.js b/js/ui/lightbox.js index ecd6304ea..3ae6df26b 100644 --- a/js/ui/lightbox.js +++ b/js/ui/lightbox.js @@ -116,6 +116,7 @@ var Lightbox = class Lightbox { radialEffect: false, }); + this._active = false; this._container = container; this._children = container.get_children(); this._fadeFactor = params.fadeFactor; @@ -131,7 +132,6 @@ var Lightbox = class Lightbox { container.add_actor(this.actor); this.actor.raise_top(); this.actor.hide(); - this.shown = false; this.actor.connect('destroy', this._onDestroy.bind(this)); @@ -150,6 +150,10 @@ var Lightbox = class Lightbox { this._highlighted = null; } + get active() { + return this._active; + } + _actorAdded(container, newChild) { let children = this._container.get_children(); let myIndex = children.indexOf(this.actor); @@ -172,7 +176,7 @@ var Lightbox = class Lightbox { } } - show(fadeInTime) { + lightOn(fadeInTime) { this.actor.remove_all_transitions(); let easeProps = { @@ -181,8 +185,8 @@ var Lightbox = class Lightbox { }; let onComplete = () => { - this.shown = true; - this.emit('shown'); + this._active = true; + this.emit('active-changed'); }; this.actor.show(); @@ -201,10 +205,12 @@ var Lightbox = class Lightbox { } } - hide(fadeOutTime) { - this.shown = false; + lightOff(fadeOutTime) { this.actor.remove_all_transitions(); + this._active = false; + this.emit('active-changed'); + let easeProps = { duration: fadeOutTime || 0, mode: Clutter.AnimationMode.EASE_OUT_QUAD diff --git a/js/ui/messageList.js b/js/ui/messageList.js index 7faab03b9..c84663772 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -539,8 +539,8 @@ var MessageListSection = class MessageListSection { this._sync(); } - _onKeyFocusIn(actor) { - this.emit('key-focus-in', actor); + _onKeyFocusIn(messageActor) { + this.emit('message-focused', messageActor); } get allowed() { diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js index 1eeb15a95..1f7c481e1 100644 --- a/js/ui/modalDialog.js +++ b/js/ui/modalDialog.js @@ -121,7 +121,7 @@ var ModalDialog = GObject.registerClass({ this.dialogLayout.opacity = 255; if (this._lightbox) - this._lightbox.show(); + this._lightbox.lightOn(); this.opacity = 0; this.show(); this.ease({ diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index b1f6f2410..718270d56 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -559,11 +559,11 @@ var ScreenShield = class { this._longLightbox = new Lightbox.Lightbox(Main.uiGroup, { inhibitEvents: true, fadeFactor: 1 }); - this._longLightbox.connect('shown', this._onLongLightboxShown.bind(this)); + this._longLightbox.connect('active-changed', this._onLongLightbox.bind(this)); this._shortLightbox = new Lightbox.Lightbox(Main.uiGroup, { inhibitEvents: true, fadeFactor: 1 }); - this._shortLightbox.connect('shown', this._onShortLightboxShown.bind(this)); + this._shortLightbox.connect('active-changed', this._onShortLightbox.bind(this)); this.idleMonitor = Meta.IdleMonitor.get_core(); this._cursorTracker = Meta.CursorTracker.get_for_display(global.display); @@ -852,7 +852,7 @@ var ScreenShield = class { _activateFade(lightbox, time) { Main.uiGroup.set_child_above_sibling(lightbox.actor, null); - lightbox.show(time); + lightbox.lightOn(time); if (this._becameActiveId == 0) this._becameActiveId = this.idleMonitor.add_user_active_watch(this._onUserBecameActive.bind(this)); @@ -881,19 +881,21 @@ var ScreenShield = class { this._becameActiveId = 0; if (this._isActive || this._isLocked) { - this._longLightbox.hide(); - this._shortLightbox.hide(); + this._longLightbox.lightOff(); + this._shortLightbox.lightOff(); } else { this.deactivate(false); } } - _onLongLightboxShown() { - this.activate(false); + _onLongLightbox(lightBox) { + if (lightBox.active) + this.activate(false); } - _onShortLightboxShown() { - this._completeLockScreenShown(); + _onShortLightbox(lightBox) { + if (lightBox.active) + this._completeLockScreenShown(); } showDialog() { @@ -1235,8 +1237,8 @@ var ScreenShield = class { this._dialog = null; } - this._longLightbox.hide(); - this._shortLightbox.hide(); + this._longLightbox.lightOff(); + this._shortLightbox.lightOff(); this.actor.hide(); if (this._becameActiveId != 0) { diff --git a/js/ui/search.js b/js/ui/search.js index 22df02d7a..a06f040ce 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -148,6 +148,7 @@ var SearchResultsBase = class { this._resultsView = resultsView; this._terms = []; + this._focusChild = null; this.actor = new St.BoxLayout({ style_class: 'search-section', vertical: true }); @@ -190,8 +191,15 @@ var SearchResultsBase = class { this.actor.hide(); } + get focusChild() { + return this._focusChild; + } + _keyFocusIn(actor) { - this.emit('key-focus-in', actor); + if (this._focusChild == actor) + return; + this._focusChild = actor; + this.emit('focus-child-changed'); } _setMoreCount(_count) { @@ -595,8 +603,8 @@ var SearchResultsView = class { return false; } - _keyFocusIn(provider, actor) { - Util.ensureActorVisibleInScrollView(this._scrollView, actor); + _focusChildChanged(provider) { + Util.ensureActorVisibleInScrollView(this._scrollView, provider.focusChild); } _ensureProviderDisplay(provider) { @@ -609,7 +617,7 @@ var SearchResultsView = class { else providerDisplay = new GridSearchResults(provider, this); - providerDisplay.connect('key-focus-in', this._keyFocusIn.bind(this)); + providerDisplay.connect('focus-child-changed', this._focusChildChanged.bind(this)); providerDisplay.actor.hide(); this._content.add(providerDisplay.actor); provider.display = providerDisplay; diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index c9e48e7a3..740c09ebc 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -388,7 +388,7 @@ var TilePreview = class { this._showing = false; } - show(window, tileRect, monitorIndex) { + open(window, tileRect, monitorIndex) { let windowActor = window.get_compositor_private(); if (!windowActor) return; @@ -432,7 +432,7 @@ var TilePreview = class { }); } - hide() { + close() { if (!this._showing) return; @@ -1089,7 +1089,7 @@ var WindowManager = class { let mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN; let bottomDragAction = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM, mode); bottomDragAction.connect('activated', () => { - Main.keyboard.show(Main.layoutManager.bottomIndex); + Main.keyboard.open(Main.layoutManager.bottomIndex); }); Main.layoutManager.connect('keyboard-visible-changed', (manager, visible) => { bottomDragAction.cancel(); @@ -2045,13 +2045,13 @@ var WindowManager = class { _showTilePreview(shellwm, window, tileRect, monitorIndex) { if (!this._tilePreview) this._tilePreview = new TilePreview(); - this._tilePreview.show(window, tileRect, monitorIndex); + this._tilePreview.open(window, tileRect, monitorIndex); } _hideTilePreview() { if (!this._tilePreview) return; - this._tilePreview.hide(); + this._tilePreview.close(); } _showWindowMenu(shellwm, window, menu, rect) {