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
This commit is contained in:
Florian Müllner 2013-11-29 18:17:34 +00:00
parent 751a3f0e94
commit deb2f30b37
31 changed files with 178 additions and 143 deletions

View File

@ -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,

View File

@ -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;
}));
},

View File

@ -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() {

View File

@ -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) {

View File

@ -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() {

View File

@ -497,6 +497,7 @@ const Calendar = new Lang.Class({
this._onNextMonthButtonClicked();
break;
}
return Clutter.EVENT_PROPAGATE;
},
_onPrevMonthButtonClicked: function() {

View File

@ -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;
},
/**

View File

@ -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;
},
});

View File

@ -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;
}));
}

View File

@ -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) {

View File

@ -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;
}
});

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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) {

View File

@ -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() {

View File

@ -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) {

View File

@ -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) {

View File

@ -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;
}));
},

View File

@ -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);

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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);

View File

@ -81,7 +81,7 @@ const AltSwitcher = new Lang.Class({
this._sync();
}
return false;
return Clutter.EVENT_PROPAGATE;
},
});

View File

@ -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);
}
});

View File

@ -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) {

View File

@ -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 () {

View File

@ -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() {

View File

@ -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() {

View File

@ -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);