From deb2f30b3785c5b51d5f84383791e67e9f580f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 29 Nov 2013 18:17:34 +0000 Subject: [PATCH] js: Use EVENT_PROPAGATE/EVENT_STOP constants in event handlers Just as SOURCE_CONTINUE/SOURCE_REMOVE in source functions, these constants increase code clarity over plain true/false. https://bugzilla.gnome.org/show_bug.cgi?id=719567 --- js/gdm/authPrompt.js | 1 + js/gdm/loginDialog.js | 4 ++-- js/misc/history.js | 2 +- js/ui/appDisplay.js | 22 +++++++++++----------- js/ui/boxpointer.js | 2 +- js/ui/calendar.js | 1 + js/ui/dnd.js | 14 +++++++------- js/ui/grabHelper.js | 12 ++++++------ js/ui/ibusCandidatePopup.js | 1 + js/ui/keyboard.js | 26 +++++++++++++++++++++----- js/ui/layout.js | 6 +++--- js/ui/lookingGlass.js | 16 +++++++++------- js/ui/messageTray.js | 30 ++++++++++++++++-------------- js/ui/modalDialog.js | 9 +++++---- js/ui/overview.js | 3 ++- js/ui/panel.js | 20 +++++++++++--------- js/ui/panelMenu.js | 19 ++++++++++--------- js/ui/popupMenu.js | 23 ++++++++++++----------- js/ui/runDialog.js | 6 +++--- js/ui/screenShield.js | 12 ++++++------ js/ui/screenshot.js | 10 +++++----- js/ui/shellEntry.js | 6 +++--- js/ui/slider.js | 19 ++++++++++--------- js/ui/status/brightness.js | 2 +- js/ui/status/system.js | 2 +- js/ui/status/volume.js | 8 ++++---- js/ui/switcherPopup.js | 7 +++++-- js/ui/viewSelector.js | 22 +++++++++++----------- js/ui/workspace.js | 4 +++- js/ui/workspaceThumbnail.js | 6 +++--- js/ui/workspacesView.js | 6 +++--- 31 files changed, 178 insertions(+), 143 deletions(-) diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index 7a3cf0a29..6fe14ff3d 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -80,6 +80,7 @@ const AuthPrompt = new Lang.Class({ if (event.get_key_symbol() == Clutter.KEY_Escape) { this.cancel(); } + return Clutter.EVENT_PROPAGATE; })); this._userWell = new St.Bin({ x_fill: true, diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index d2c44ad3f..9ce5f49a4 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -764,7 +764,7 @@ const LoginDialog = new Lang.Class({ global.stage.connect('captured-event', Lang.bind(this, function(actor, event) { if (this._timedLoginDelay == undefined) - return false; + return Clutter.EVENT_PROPAGATE; if (event.type() == Clutter.EventType.KEY_PRESS || event.type() == Clutter.EventType.BUTTON_PRESS) { @@ -777,7 +777,7 @@ const LoginDialog = new Lang.Class({ this._resetTimedLogin(); } - return false; + return Clutter.EVENT_PROPAGATE; })); }, diff --git a/js/misc/history.js b/js/misc/history.js index 5d499f863..b56d83064 100644 --- a/js/misc/history.js +++ b/js/misc/history.js @@ -89,7 +89,7 @@ const HistoryManager = new Lang.Class({ } else if (symbol == Clutter.KEY_Down) { return this._setNextItem(entry.get_text()); } - return false; + return Clutter.EVENT_PROPAGATE; }, _indexChanged: function() { diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 360dc0008..cdd1e1aa6 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -415,7 +415,7 @@ const AllView = new Lang.Class({ _onScroll: function(actor, event) { if (this._displayingPopup) - return true; + return Clutter.EVENT_STOP; let direction = event.get_scroll_direction(); if (direction == Clutter.ScrollDirection.UP) @@ -423,7 +423,7 @@ const AllView = new Lang.Class({ else if (direction == Clutter.ScrollDirection.DOWN) this.goToPage(this._currentPage + 1); - return true; + return Clutter.EVENT_STOP; }, _onPan: function(action) { @@ -454,17 +454,17 @@ const AllView = new Lang.Class({ _onKeyPressEvent: function(actor, event) { if (this._displayingPopup) - return true; + return Clutter.EVENT_STOP; if (event.get_key_symbol() == Clutter.Page_Up) { this.goToPage(this._currentPage - 1); - return true; + return Clutter.EVENT_STOP; } else if (event.get_key_symbol() == Clutter.Page_Down) { this.goToPage(this._currentPage + 1); - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; }, _getItemId: function(item) { @@ -1223,13 +1223,13 @@ const AppFolderPopup = new Lang.Class({ _onKeyPress: function(actor, event) { if (!this._isOpen) - return false; + return Clutter.EVENT_PROPAGATE; if (event.get_key_symbol() != Clutter.KEY_Escape) - return false; + return Clutter.EVENT_PROPAGATE; this.popdown(); - return true; + return Clutter.EVENT_STOP; }, toggle: function() { @@ -1374,9 +1374,9 @@ const AppIcon = new Lang.Class({ })); } else if (button == 3) { this.popupMenu(); - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; }, _onClicked: function(actor, button) { diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js index e94033710..c8bae58c4 100644 --- a/js/ui/boxpointer.js +++ b/js/ui/boxpointer.js @@ -69,7 +69,7 @@ const BoxPointer = new Lang.Class({ _muteInput: function() { if (this._capturedEventId == 0) this._capturedEventId = this.actor.connect('captured-event', - function() { return true; }); + function() { return Clutter.EVENT_STOP; }); }, _unmuteInput: function() { diff --git a/js/ui/calendar.js b/js/ui/calendar.js index b5ad1523b..d91578319 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -497,6 +497,7 @@ const Calendar = new Lang.Class({ this._onNextMonthButtonClicked(); break; } + return Clutter.EVENT_PROPAGATE; }, _onPrevMonthButtonClicked: function() { diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 246d69557..a99791efd 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -106,10 +106,10 @@ const _Draggable = new Lang.Class({ _onButtonPress : function (actor, event) { if (event.get_button() != 1) - return false; + return Clutter.EVENT_PROPAGATE; if (Tweener.getTweenCount(actor)) - return false; + return Clutter.EVENT_PROPAGATE; this._buttonDown = true; this._grabActor(); @@ -118,7 +118,7 @@ const _Draggable = new Lang.Class({ this._dragStartX = stageX; this._dragStartY = stageY; - return false; + return Clutter.EVENT_PROPAGATE; }, _grabActor: function() { @@ -164,11 +164,11 @@ const _Draggable = new Lang.Class({ } else if (this._dragActor != null && !this._animationInProgress) { // Drag must have been cancelled with Esc. this._dragComplete(); - return true; + return Clutter.EVENT_STOP; } else { // Drag has never started. this._ungrabActor(); - return false; + return Clutter.EVENT_PROPAGATE; } // We intercept MOTION event to figure out if the drag has started and to draw // this._dragActor under the pointer when dragging is in progress @@ -184,11 +184,11 @@ const _Draggable = new Lang.Class({ let symbol = event.get_key_symbol(); if (symbol == Clutter.Escape) { this._cancelDrag(event.get_time()); - return true; + return Clutter.EVENT_STOP; } } - return false; + return Clutter.EVENT_PROPAGATE; }, /** diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js index b022d1d6b..ec53deb90 100644 --- a/js/ui/grabHelper.js +++ b/js/ui/grabHelper.js @@ -280,7 +280,7 @@ const GrabHelper = new Lang.Class({ if (type == Clutter.EventType.KEY_PRESS && event.get_key_symbol() == Clutter.KEY_Escape) { this.ungrab({ isUser: true }); - return true; + return Clutter.EVENT_STOP; } let press = type == Clutter.EventType.BUTTON_PRESS; @@ -289,14 +289,14 @@ const GrabHelper = new Lang.Class({ if (release && this._ignoreRelease) { this._ignoreRelease = false; - return true; + return Clutter.EVENT_STOP; } if (this._isWithinGrabbedActor(event.get_source())) - return false; + return Clutter.EVENT_PROPAGATE; if (Main.keyboard.shouldTakeEvent(event)) - return false; + return Clutter.EVENT_PROPAGATE; if (button) { // If we have a press event, ignore the next event, @@ -305,9 +305,9 @@ const GrabHelper = new Lang.Class({ this._ignoreRelease = true; let i = this._actorInGrabStack(event.get_source()) + 1; this.ungrab({ actor: this._grabStack[i].actor, isUser: true }); - return true; + return Clutter.EVENT_STOP; } - return true; + return Clutter.EVENT_STOP; }, }); diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js index 11fe7641f..7c8db7aa0 100644 --- a/js/ui/ibusCandidatePopup.js +++ b/js/ui/ibusCandidatePopup.js @@ -32,6 +32,7 @@ const CandidateArea = new Lang.Class({ let j = i; box.connect('button-release-event', Lang.bind(this, function(actor, event) { this.emit('candidate-clicked', j, event.get_button(), event.get_state()); + return Clutter.EVENT_PROPAGATE; })); } diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index b95535563..c1a6dbfa2 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -82,8 +82,16 @@ const Key = new Lang.Class({ style_class: 'keyboard-key' }); button.key_width = this._key.width; - button.connect('button-press-event', Lang.bind(this, function () { this._key.press(); })); - button.connect('button-release-event', Lang.bind(this, function () { this._key.release(); })); + button.connect('button-press-event', Lang.bind(this, + function () { + this._key.press(); + return Clutter.EVENT_PROPAGATE; + })); + button.connect('button-release-event', Lang.bind(this, + function () { + this._key.release(); + return Clutter.EVENT_PROPAGATE; + })); return button; }, @@ -106,8 +114,16 @@ const Key = new Lang.Class({ let label = this._getUnichar(extended_key); let key = new St.Button({ label: label, style_class: 'keyboard-key' }); key.extended_key = extended_key; - key.connect('button-press-event', Lang.bind(this, function () { extended_key.press(); })); - key.connect('button-release-event', Lang.bind(this, function () { extended_key.release(); })); + key.connect('button-press-event', Lang.bind(this, + function () { + extended_key.press(); + return Clutter.EVENT_PROPAGATE; + })); + key.connect('button-release-event', Lang.bind(this, + function () { + extended_key.release(); + return Clutter.EVENT_PROPAGATE; + })); this._extended_keyboard.add(key); } this._boxPointer.bin.add_actor(this._extended_keyboard); @@ -297,7 +313,7 @@ const Keyboard = new Lang.Class({ else if (release && this._capturedPress) this._hideSubkeys(); - return true; + return Clutter.EVENT_STOP; }, _addRows : function (keys, layout) { diff --git a/js/ui/layout.js b/js/ui/layout.js index 13c480801..5ad222c6a 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -1226,20 +1226,20 @@ const HotCorner = new Lang.Class({ this._entered = true; this._toggleOverview(); } - return false; + return Clutter.EVENT_PROPAGATE; }, _onCornerLeft : function(actor, event) { if (event.get_related() != this.actor) this._entered = false; // Consume event, otherwise this will confuse onEnvironsLeft - return true; + return Clutter.EVENT_STOP; }, _onEnvironsLeft : function(actor, event) { if (event.get_related() != this._corner) this._entered = false; - return false; + return Clutter.EVENT_PROPAGATE; } }); diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index bbf35eb33..a126d81af 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -109,6 +109,7 @@ const AutoComplete = new Lang.Class({ } this._lastTabTime = currTime; } + return Clutter.EVENT_PROPAGATE; }, // Insert characters of text not already included in head at cursor position. i.e., if text="abc" and head="a", @@ -558,7 +559,7 @@ const Inspector = new Lang.Class({ _onKeyPressEvent: function (actor, event) { if (event.get_key_symbol() == Clutter.Escape) this._close(); - return true; + return Clutter.EVENT_STOP; }, _onButtonPressEvent: function (actor, event) { @@ -567,7 +568,7 @@ const Inspector = new Lang.Class({ this.emit('target', this._target, stageX, stageY); } this._close(); - return true; + return Clutter.EVENT_STOP; }, _onScrollEvent: function (actor, event) { @@ -601,12 +602,12 @@ const Inspector = new Lang.Class({ default: break; } - return true; + return Clutter.EVENT_STOP; }, _onMotionEvent: function (actor, event) { this._update(event); - return true; + return Clutter.EVENT_STOP; }, _update: function(event) { @@ -828,7 +829,7 @@ const LookingGlass = new Lang.Class({ global.stage.set_key_focus(this._entry); })); this.actor.hide(); - return true; + return Clutter.EVENT_STOP; })); let gcIcon = new St.Icon({ icon_name: 'gnome-fs-trash-full', @@ -843,6 +844,7 @@ const LookingGlass = new Lang.Class({ Mainloop.source_remove(this._timeoutId); return GLib.SOURCE_REMOVE; })); + return Clutter.EVENT_PROPAGATE; })); let notebook = new Notebook(); @@ -1064,7 +1066,7 @@ const LookingGlass = new Lang.Class({ } else { this.close(); } - return true; + return Clutter.EVENT_STOP; } // Ctrl+PgUp and Ctrl+PgDown switches tabs in the notebook view if (modifierState & Clutter.ModifierType.CONTROL_MASK) { @@ -1074,7 +1076,7 @@ const LookingGlass = new Lang.Class({ this._notebook.nextTab(); } } - return false; + return Clutter.EVENT_PROPAGATE; }, open : function() { diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index afcfdca19..06609c580 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -187,7 +187,7 @@ const URLHighlighter = new Lang.Class({ // The MessageTray doesn't actually hide us, so // we need to check for paint opacities as well. if (!actor.visible || actor.get_paint_opacity() == 0) - return false; + return Clutter.EVENT_PROPAGATE; // Keep Notification.actor from seeing this and taking // a pointer grab, which would block our button-release-event @@ -196,7 +196,7 @@ const URLHighlighter = new Lang.Class({ })); this.actor.connect('button-release-event', Lang.bind(this, function (actor, event) { if (!actor.visible || actor.get_paint_opacity() == 0) - return false; + return Clutter.EVENT_PROPAGATE; let urlId = this._findUrlAtPos(event); if (urlId != -1) { @@ -205,13 +205,13 @@ const URLHighlighter = new Lang.Class({ url = 'http://' + url; Gio.app_info_launch_default_for_uri(url, global.create_app_launch_context()); - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; })); this.actor.connect('motion-event', Lang.bind(this, function(actor, event) { if (!actor.visible || actor.get_paint_opacity() == 0) - return false; + return Clutter.EVENT_PROPAGATE; let urlId = this._findUrlAtPos(event); if (urlId != -1 && !this._cursorChanged) { @@ -221,16 +221,17 @@ const URLHighlighter = new Lang.Class({ global.screen.set_cursor(Meta.Cursor.DEFAULT); this._cursorChanged = false; } - return false; + return Clutter.EVENT_PROPAGATE; })); this.actor.connect('leave-event', Lang.bind(this, function() { if (!this.actor.visible || this.actor.get_paint_opacity() == 0) - return; + return Clutter.EVENT_PROPAGATE; if (this._cursorChanged) { this._cursorChanged = false; global.screen.set_cursor(Meta.Cursor.DEFAULT); } + return Clutter.EVENT_PROPAGATE; })); }, @@ -1523,9 +1524,9 @@ const SummaryItem = new Lang.Class({ _onKeyPress: function(actor, event) { if (event.get_key_symbol() == Clutter.KEY_Up) { actor.emit('clicked', 1); - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; }, prepareNotificationStackForShowing: function() { @@ -1783,6 +1784,7 @@ const MessageTray = new Lang.Class({ this._setClickedSummaryItem(null); this._updateState(); actor.grab_key_focus(); + return Clutter.EVENT_PROPAGATE; })); global.focus_manager.add_group(this.actor); this._summary = new St.BoxLayout({ style_class: 'message-tray-summary', @@ -2010,10 +2012,10 @@ const MessageTray = new Lang.Class({ _onNotificationKeyRelease: function(actor, event) { if (event.get_key_symbol() == Clutter.KEY_Escape && event.get_state() == 0) { this._closeNotification(); - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; }, _closeNotification: function() { @@ -2865,13 +2867,13 @@ const MessageTray = new Lang.Class({ case Clutter.KEY_Escape: this._setClickedSummaryItem(null); this._updateState(); - return true; + return Clutter.EVENT_STOP; case Clutter.KEY_Delete: this._clickedSummaryItem.source.destroy(); this._escapeTray(); - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; }, _onSummaryBoxPointerUngrabbed: function() { diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js index 029cc410e..4e444f113 100644 --- a/js/ui/modalDialog.js +++ b/js/ui/modalDialog.js @@ -229,6 +229,7 @@ const ModalDialog = new Lang.Class({ _onKeyPressEvent: function(object, event) { this._pressedKey = event.get_key_symbol(); + return Clutter.EVENT_PROPAGATE; }, _onKeyReleaseEvent: function(object, event) { @@ -237,21 +238,21 @@ const ModalDialog = new Lang.Class({ let symbol = event.get_key_symbol(); if (symbol != pressedKey) - return false; + return Clutter.EVENT_PROPAGATE; let buttonInfo = this._buttonKeys[symbol]; if (!buttonInfo) - return false; + return Clutter.EVENT_PROPAGATE; let button = buttonInfo['button']; let action = buttonInfo['action']; if (action && button.reactive) { action(); - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; }, _onGroupDestroy: function() { diff --git a/js/ui/overview.js b/js/ui/overview.js index eb0690a06..f4ea362a3 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -148,7 +148,7 @@ const Overview = new Lang.Class({ this._coverPane = new Clutter.Actor({ opacity: 0, reactive: true }); Main.layoutManager.overviewGroup.add_child(this._coverPane); - this._coverPane.connect('event', Lang.bind(this, function (actor, event) { return true; })); + this._coverPane.connect('event', Lang.bind(this, function (actor, event) { return Clutter.EVENT_STOP; })); this._stack.add_actor(this._overview); Main.layoutManager.overviewGroup.add_child(this._stack); @@ -379,6 +379,7 @@ const Overview = new Lang.Class({ _onScrollEvent: function(actor, event) { this.emit('scroll-event', event); + return Clutter.EVENT_PROPAGATE; }, addAction: function(action) { diff --git a/js/ui/panel.js b/js/ui/panel.js index 08d823ec8..5ffd7b919 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -602,14 +602,15 @@ const ActivitiesButton = new Lang.Class({ _onCapturedEvent: function(actor, event) { if (event.type() == Clutter.EventType.BUTTON_PRESS) { if (!Main.overview.shouldToggleByCornerOrButton()) - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; }, _onButtonRelease: function() { Main.overview.toggle(); this.menu.close(); + return Clutter.EVENT_PROPAGATE; }, _onKeyRelease: function(actor, event) { @@ -617,6 +618,7 @@ const ActivitiesButton = new Lang.Class({ if (symbol == Clutter.KEY_Return || symbol == Clutter.KEY_space) { Main.overview.toggle(); } + return Clutter.EVENT_PROPAGATE; }, _xdndToggleOverview: function(actor) { @@ -984,23 +986,23 @@ const Panel = new Lang.Class({ _onButtonPress: function(actor, event) { if (Main.modalCount > 0) - return false; + return Clutter.EVENT_PROPAGATE; if (event.get_source() != actor) - return false; + return Clutter.EVENT_PROPAGATE; let button = event.get_button(); if (button != 1) - return false; + return Clutter.EVENT_PROPAGATE; let focusWindow = global.display.focus_window; if (!focusWindow) - return false; + return Clutter.EVENT_PROPAGATE; let dragWindow = focusWindow.is_attached_dialog() ? focusWindow.get_transient_for() : focusWindow; if (!dragWindow) - return false; + return Clutter.EVENT_PROPAGATE; let rect = dragWindow.get_outer_rect(); let [stageX, stageY] = event.get_coords(); @@ -1009,7 +1011,7 @@ const Panel = new Lang.Class({ stageX > rect.x && stageX < rect.x + rect.width; if (!allowDrag) - return false; + return Clutter.EVENT_PROPAGATE; global.display.begin_grab_op(global.screen, dragWindow, @@ -1021,7 +1023,7 @@ const Panel = new Lang.Class({ event.get_time(), stageX, stageY); - return true; + return Clutter.EVENT_STOP; }, toggleAppMenu: function() { diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js index 6f68104fc..9bb1f1bc4 100644 --- a/js/ui/panelMenu.js +++ b/js/ui/panelMenu.js @@ -137,29 +137,30 @@ const Button = new Lang.Class({ _onButtonPress: function(actor, event) { if (!this.menu) - return; + return Clutter.EVENT_PROPAGATE; this.menu.toggle(); + return Clutter.EVENT_PROPAGATE; }, _onSourceKeyPress: function(actor, event) { if (!this.menu) - return false; + return Clutter.EVENT_PROPAGATE; let symbol = event.get_key_symbol(); if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) { this.menu.toggle(); - return true; + return Clutter.EVENT_STOP; } else if (symbol == Clutter.KEY_Escape && this.menu.isOpen) { this.menu.close(); - return true; + return Clutter.EVENT_STOP; } else if (symbol == Clutter.KEY_Down) { if (!this.menu.isOpen) this.menu.toggle(); this.menu.actor.navigate_focus(this.actor, Gtk.DirectionType.DOWN, false); - return true; + return Clutter.EVENT_STOP; } else - return false; + return Clutter.EVENT_PROPAGATE; }, _onVisibilityChanged: function() { @@ -172,7 +173,7 @@ const Button = new Lang.Class({ _onMenuKeyPress: function(actor, event) { if (global.focus_manager.navigate_from_event(event)) - return true; + return Clutter.EVENT_STOP; let symbol = event.get_key_symbol(); if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) { @@ -180,10 +181,10 @@ const Button = new Lang.Class({ if (group) { let direction = (symbol == Clutter.KEY_Left) ? Gtk.DirectionType.LEFT : Gtk.DirectionType.RIGHT; group.navigate_focus(this.actor, direction, false); - return true; + return Clutter.EVENT_STOP; } } - return false; + return Clutter.EVENT_PROPAGATE; }, _onOpenStateChanged: function(menu, open) { diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 4a46d2f73..39b6a2ae1 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -126,7 +126,7 @@ const PopupBaseMenuItem = new Lang.Class({ _onButtonReleaseEvent: function (actor, event) { this.activate(event); - return true; + return Clutter.EVENT_STOP; }, _onKeyPressEvent: function (actor, event) { @@ -134,9 +134,9 @@ const PopupBaseMenuItem = new Lang.Class({ if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) { this.activate(event); - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; }, _onKeyFocusIn: function (actor) { @@ -928,10 +928,10 @@ const PopupSubMenu = new Lang.Class({ if (this.isOpen && event.get_key_symbol() == Clutter.KEY_Left) { this.close(BoxPointer.PopupAnimation.FULL); this.sourceActor._delegate.setActive(true); - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; } }); @@ -1056,10 +1056,10 @@ const PopupSubMenuMenuItem = new Lang.Class({ if (symbol == Clutter.KEY_Right) { this._setOpenState(true); this.menu.actor.navigate_focus(null, Gtk.DirectionType.DOWN, false); - return true; + return Clutter.EVENT_STOP; } else if (symbol == Clutter.KEY_Left && this._getOpenState()) { this._setOpenState(false); - return true; + return Clutter.EVENT_STOP; } return this.parent(actor, event); @@ -1071,6 +1071,7 @@ const PopupSubMenuMenuItem = new Lang.Class({ _onButtonReleaseEvent: function(actor) { this._setOpenState(!this._getOpenState()); + return Clutter.EVENT_PROPAGATE; } }); @@ -1102,7 +1103,7 @@ const PopupMenuManager = new Lang.Class({ if (source) { if (!menu.blockSourceEvents) this._grabHelper.addActor(source); - menudata.enterId = source.connect('enter-event', Lang.bind(this, function() { this._onMenuSourceEnter(menu); })); + menudata.enterId = source.connect('enter-event', Lang.bind(this, function() { return this._onMenuSourceEnter(menu); })); menudata.focusInId = source.connect('key-focus-in', Lang.bind(this, function() { this._onMenuSourceEnter(menu); })); } @@ -1164,13 +1165,13 @@ const PopupMenuManager = new Lang.Class({ _onMenuSourceEnter: function(menu) { if (!this._grabHelper.grabbed) - return false; + return Clutter.EVENT_PROPAGATE; if (this._grabHelper.isActorGrabbed(menu.actor)) - return false; + return Clutter.EVENT_PROPAGATE; this._changeMenu(menu); - return false; + return Clutter.EVENT_PROPAGATE; }, _onMenuDestroy: function(menu) { diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js index 36578d1b9..7d9925375 100644 --- a/js/ui/runDialog.js +++ b/js/ui/runDialog.js @@ -128,7 +128,7 @@ const RunDialog = new Lang.Class({ !this.pushModal()) this.close(); - return true; + return Clutter.EVENT_STOP; } if (symbol == Clutter.Tab) { let text = o.get_text(); @@ -142,9 +142,9 @@ const RunDialog = new Lang.Class({ o.insert_text(postfix, -1); o.set_cursor_position(text.length + postfix.length); } - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; })); }, diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 2321759f0..0ce15285e 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -669,11 +669,11 @@ const ScreenShield = new Lang.Class({ // down after cancel. if (this._lockScreenState != MessageTray.State.SHOWN) - return false; + return Clutter.EVENT_PROPAGATE; let isEnter = (symbol == Clutter.KEY_Return || symbol == Clutter.KEY_KP_Enter); if (!isEnter && !(GLib.unichar_isprint(unichar) || symbol == Clutter.KEY_Escape)) - return false; + return Clutter.EVENT_PROPAGATE; if (this._isLocked && this._ensureUnlockDialog(true, true) && @@ -681,12 +681,12 @@ const ScreenShield = new Lang.Class({ this._dialog.addCharacter(unichar); this._liftShield(true, 0); - return true; + return Clutter.EVENT_STOP; }, _onLockScreenScroll: function(actor, event) { if (this._lockScreenState != MessageTray.State.SHOWN) - return false; + return Clutter.EVENT_PROPAGATE; let delta = 0; if (event.get_scroll_direction() == Clutter.ScrollDirection.UP) @@ -701,7 +701,7 @@ const ScreenShield = new Lang.Class({ this._liftShield(true, 0); } - return true; + return Clutter.EVENT_STOP; }, _inhibitSuspend: function() { @@ -1097,7 +1097,7 @@ const ScreenShield = new Lang.Class({ global.stage.disconnect(motionId); } - return false; + return Clutter.EVENT_PROPAGATE; })); this._cursorTracker.set_pointer_visible(false); diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index 73ca773a9..432a39d5e 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -206,12 +206,12 @@ const SelectArea = new Lang.Class({ if (event.get_key_symbol() == Clutter.Escape) this._destroy(null, false); - return; + return Clutter.EVENT_PROPAGATE; }, _onMotionEvent: function(actor, event) { if (this._startX == -1 || this._startY == -1) - return false; + return Clutter.EVENT_PROPAGATE; [this._lastX, this._lastY] = event.get_coords(); let geometry = this._getGeometry(); @@ -219,19 +219,19 @@ const SelectArea = new Lang.Class({ this._rubberband.set_position(geometry.x, geometry.y); this._rubberband.set_size(geometry.width, geometry.height); - return false; + return Clutter.EVENT_PROPAGATE; }, _onButtonPress: function(actor, event) { [this._startX, this._startY] = event.get_coords(); this._rubberband.set_position(this._startX, this._startY); - return false; + return Clutter.EVENT_PROPAGATE; }, _onButtonRelease: function(actor, event) { this._destroy(this._getGeometry(), true); - return false; + return Clutter.EVENT_PROPAGATE; }, _destroy: function(geometry, fade) { diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js index b7251d135..055e3c5fa 100644 --- a/js/ui/shellEntry.js +++ b/js/ui/shellEntry.js @@ -132,14 +132,14 @@ function _setMenuAlignment(entry, stageX) { function _onButtonPressEvent(actor, event, entry) { if (entry.menu.isOpen) { entry.menu.close(BoxPointer.PopupAnimation.FULL); - return true; + return Clutter.EVENT_STOP; } else if (event.get_button() == 3) { let [stageX, stageY] = event.get_coords(); _setMenuAlignment(entry, stageX); entry.menu.open(BoxPointer.PopupAnimation.FULL); - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; }; function _onPopup(actor, entry) { diff --git a/js/ui/slider.js b/js/ui/slider.js index e098846c5..4a8735509 100644 --- a/js/ui/slider.js +++ b/js/ui/slider.js @@ -111,12 +111,12 @@ const Slider = new Lang.Class({ }, _startDragging: function(actor, event) { - this.startDragging(event); + return this.startDragging(event); }, startDragging: function(event) { if (this._dragging) - return false; + return Clutter.EVENT_PROPAGATE; this._dragging = true; @@ -129,7 +129,7 @@ const Slider = new Lang.Class({ let absX, absY; [absX, absY] = event.get_coords(); this._moveHandle(absX, absY); - return true; + return Clutter.EVENT_STOP; }, _endDragging: function() { @@ -143,7 +143,7 @@ const Slider = new Lang.Class({ this.emit('drag-end'); } - return true; + return Clutter.EVENT_STOP; }, scroll: function(event) { @@ -151,7 +151,7 @@ const Slider = new Lang.Class({ let delta; if (event.is_pointer_emulated()) - return; + return Clutter.EVENT_PROPAGATE; if (direction == Clutter.ScrollDirection.DOWN) { delta = -SLIDER_SCROLL_STEP; @@ -168,17 +168,18 @@ const Slider = new Lang.Class({ this.actor.queue_repaint(); this.emit('value-changed', this._value); + return Clutter.EVENT_STOP; }, _onScrollEvent: function(actor, event) { - this.scroll(event); + return this.scroll(event); }, _motionEvent: function(actor, event) { let absX, absY; [absX, absY] = event.get_coords(); this._moveHandle(absX, absY); - return true; + return Clutter.EVENT_STOP; }, onKeyPressEvent: function (actor, event) { @@ -189,9 +190,9 @@ const Slider = new Lang.Class({ this.actor.queue_repaint(); this.emit('value-changed', this._value); this.emit('drag-end'); - return true; + return Clutter.EVENT_STOP; } - return false; + return Clutter.EVENT_PROPAGATE; }, _moveHandle: function(absX, absY) { diff --git a/js/ui/status/brightness.js b/js/ui/status/brightness.js index 59efc9dcd..96e07909b 100644 --- a/js/ui/status/brightness.js +++ b/js/ui/status/brightness.js @@ -48,7 +48,7 @@ const Indicator = new Lang.Class({ this._item.actor.add(icon); this._item.actor.add(this._slider.actor, { expand: true }); this._item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) { - this._slider.startDragging(event); + return this._slider.startDragging(event); })); this._item.actor.connect('key-press-event', Lang.bind(this, function(actor, event) { return this._slider.onKeyPressEvent(actor, event); diff --git a/js/ui/status/system.js b/js/ui/status/system.js index 665fe3617..83eb92caf 100644 --- a/js/ui/status/system.js +++ b/js/ui/status/system.js @@ -81,7 +81,7 @@ const AltSwitcher = new Lang.Class({ this._sync(); } - return false; + return Clutter.EVENT_PROPAGATE; }, }); diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index 2b3ac0c6b..831b00197 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -42,7 +42,7 @@ const StreamSlider = new Lang.Class({ this.item.actor.add(this._icon); this.item.actor.add(this._slider.actor, { expand: true }); this.item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) { - this._slider.startDragging(event); + return this._slider.startDragging(event); })); this.item.actor.connect('key-press-event', Lang.bind(this, function(actor, event) { return this._slider.onKeyPressEvent(actor, event); @@ -94,7 +94,7 @@ const StreamSlider = new Lang.Class({ }, scroll: function(event) { - this._slider.scroll(event); + return this._slider.scroll(event); }, setValue: function(value) { @@ -276,7 +276,7 @@ const VolumeMenu = new Lang.Class({ }, scroll: function(event) { - this._output.scroll(event); + return this._output.scroll(event); }, _onControlStateChanged: function() { @@ -329,6 +329,6 @@ const Indicator = new Lang.Class({ }, _onScrollEvent: function(actor, event) { - this._volumeMenu.scroll(event); + return this._volumeMenu.scroll(event); } }); diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js index 2e3a72074..3538825e9 100644 --- a/js/ui/switcherPopup.js +++ b/js/ui/switcherPopup.js @@ -194,7 +194,7 @@ const SwitcherPopup = new Lang.Class({ else this._keyPressHandler(keysym, backwards, action); - return true; + return Clutter.EVENT_STOP; }, _keyReleaseEvent: function(actor, event) { @@ -204,11 +204,12 @@ const SwitcherPopup = new Lang.Class({ if (state == 0) this._finish(event.get_time()); - return true; + return Clutter.EVENT_STOP; }, _clickedOutside: function(actor, event) { this.destroy(); + return Clutter.EVENT_PROPAGATE; }, _scrollHandler: function(direction) { @@ -220,6 +221,7 @@ const SwitcherPopup = new Lang.Class({ _scrollEvent: function(actor, event) { this._scrollHandler(event.get_scroll_direction()); + return Clutter.EVENT_PROPAGATE; }, _itemActivatedHandler: function(n) { @@ -403,6 +405,7 @@ const SwitcherList = new Lang.Class({ _onItemEnter: function (index) { this._itemEntered(index); + return Clutter.EVENT_PROPAGATE; }, highlight: function(index, justOutline) { diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index e75f7c9b5..ffe4630c4 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -268,7 +268,7 @@ const ViewSelector = new Lang.Class({ // Ignore events while anything but the overview has // pushed a modal (system modals, looking glass, ...) if (Main.modalCount > 1) - return false; + return Clutter.EVENT_PROPAGATE; let modifiers = event.get_state(); let symbol = event.get_key_symbol(); @@ -280,11 +280,11 @@ const ViewSelector = new Lang.Class({ this._showAppsButton.checked = false; else Main.overview.hide(); - return true; + return Clutter.EVENT_STOP; } else if (this._shouldTriggerSearch(symbol)) { this.startSearch(event); } - return false; + return Clutter.EVENT_PROPAGATE; }, _searchCancelled: function() { @@ -400,7 +400,7 @@ const ViewSelector = new Lang.Class({ if (symbol == Clutter.Escape) { if (this._isActivated()) { this.reset(); - return true; + return Clutter.EVENT_STOP; } } else if (this._searchActive) { let arrowNext, nextDirection; @@ -414,18 +414,18 @@ const ViewSelector = new Lang.Class({ if (symbol == Clutter.Tab) { this._searchResults.navigateFocus(Gtk.DirectionType.TAB_FORWARD); - return true; + return Clutter.EVENT_STOP; } else if (symbol == Clutter.ISO_Left_Tab) { this._focusTrap.can_focus = false; this._searchResults.navigateFocus(Gtk.DirectionType.TAB_BACKWARD); this._focusTrap.can_focus = true; - return true; + return Clutter.EVENT_STOP; } else if (symbol == Clutter.Down) { this._searchResults.navigateFocus(Gtk.DirectionType.DOWN); - return true; + return Clutter.EVENT_STOP; } else if (symbol == arrowNext && this._text.position == -1) { this._searchResults.navigateFocus(nextDirection); - return true; + return Clutter.EVENT_STOP; } else if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) { // We can't connect to 'activate' here because search providers // might want to do something with the modifiers in activateDefault. @@ -434,10 +434,10 @@ const ViewSelector = new Lang.Class({ this._doSearch(); } this._searchResults.activateDefault(); - return true; + return Clutter.EVENT_STOP; } } - return false; + return Clutter.EVENT_PROPAGATE; }, _onCapturedEvent: function(actor, event) { @@ -452,7 +452,7 @@ const ViewSelector = new Lang.Class({ } } - return false; + return Clutter.EVENT_PROPAGATE; }, _doSearch: function () { diff --git a/js/ui/workspace.js b/js/ui/workspace.js index a8b2417cd..20baf4a2f 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -537,15 +537,17 @@ const WindowOverlay = new Lang.Class({ // as the close button will be shown as needed when the overlays // are shown again if (this._hidden) - return; + return Clutter.EVENT_PROPAGATE; this._animateVisible(); this.emit('show-close-button'); + return Clutter.EVENT_PROPAGATE; }, _onLeave: function() { if (this._idleToggleCloseId == 0) this._idleToggleCloseId = Mainloop.timeout_add(750, Lang.bind(this, this._idleToggleCloseButton)); + return Clutter.EVENT_PROPAGATE; }, _idleToggleCloseButton: function() { diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index c3f7e00e1..b82e08bae 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -131,7 +131,7 @@ const WindowClone = new Lang.Class({ _onButtonRelease : function (actor, event) { this.emit('selected', event.get_time()); - return true; + return Clutter.EVENT_STOP; }, _onDragBegin : function (draggable, time) { @@ -562,7 +562,7 @@ const ThumbnailsBox = new Lang.Class({ this._thumbnails = []; - this.actor.connect('button-press-event', function() { return true; }); + this.actor.connect('button-press-event', function() { return Clutter.EVENT_STOP; }); this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease)); Main.overview.connect('showing', @@ -607,7 +607,7 @@ const ThumbnailsBox = new Lang.Class({ } } - return true; + return Clutter.EVENT_STOP; }, _onDragBegin: function() { diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 2af8d05ce..997d1a8b8 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -614,7 +614,7 @@ const WorkspacesDisplay = new Lang.Class({ _onScrollEvent: function(actor, event) { if (!this.actor.mapped) - return false; + return Clutter.EVENT_PROPAGATE; let activeWs = global.screen.get_active_workspace(); let ws; switch (event.get_scroll_direction()) { @@ -625,10 +625,10 @@ const WorkspacesDisplay = new Lang.Class({ ws = activeWs.get_neighbor(Meta.MotionDirection.DOWN); break; default: - return false; + return Clutter.EVENT_PROPAGATE; } Main.wm.actionMoveWorkspace(ws); - return true; + return Clutter.EVENT_STOP; } }); Signals.addSignalMethods(WorkspacesDisplay.prototype);