js: Mass move to Clutter.Event getter methods in Clutter.Actor vfuncs
These traditionally got the various ClutterEvent subtype structs as their argument, so it was not allowed to use ClutterEvent generic getter methods in these vfuncs. These methods used direct access to struct fields instead. This got spoiled with the move to make ClutterEvent opaque types, since these are no longer public structs so GNOME Shell most silently failed to fetch the expected values from event fields. But since they are not ClutterEvents either, the getters could not be used on them. Mutter is changing so that these vmethods all contain an alias to the one and only Clutter.Event type, thus lifting those barriers, and making it possible to use the ClutterEvent methods in these vfuncs. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2950 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2872>
This commit is contained in:
parent
5e36a06835
commit
8423ba44fe
@ -133,10 +133,10 @@ export const AuthPrompt = GObject.registerClass({
|
||||
this._userVerifier = null;
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyPressEvent) {
|
||||
if (keyPressEvent.keyval == Clutter.KEY_Escape)
|
||||
vfunc_key_press_event(event) {
|
||||
if (event.get_key_symbol() === Clutter.KEY_Escape)
|
||||
this.cancel();
|
||||
return super.vfunc_key_press_event(keyPressEvent);
|
||||
return super.vfunc_key_press_event(event);
|
||||
}
|
||||
|
||||
_initInputRow() {
|
||||
|
@ -2805,7 +2805,7 @@ export const AppFolderDialog = GObject.registerClass({
|
||||
this._zoomAndFadeIn();
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyEvent) {
|
||||
vfunc_key_press_event(event) {
|
||||
if (global.stage.get_key_focus() != this)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
@ -2828,7 +2828,7 @@ export const AppFolderDialog = GObject.registerClass({
|
||||
// languages
|
||||
let direction;
|
||||
let isLtr = Clutter.get_default_text_direction() == Clutter.TextDirection.LTR;
|
||||
switch (keyEvent.keyval) {
|
||||
switch (event.get_key_symbol()) {
|
||||
case Clutter.KEY_Down:
|
||||
direction = St.DirectionType.TAB_FORWARD;
|
||||
break;
|
||||
@ -3078,28 +3078,29 @@ export const AppIcon = GObject.registerClass({
|
||||
GLib.Source.set_name_by_id(this._menuTimeoutId, '[gnome-shell] this.popupMenu');
|
||||
}
|
||||
|
||||
vfunc_leave_event(crossingEvent) {
|
||||
const ret = super.vfunc_leave_event(crossingEvent);
|
||||
vfunc_leave_event(event) {
|
||||
const ret = super.vfunc_leave_event(event);
|
||||
|
||||
this.fake_release();
|
||||
this._removeMenuTimeout();
|
||||
return ret;
|
||||
}
|
||||
|
||||
vfunc_button_press_event(buttonEvent) {
|
||||
const ret = super.vfunc_button_press_event(buttonEvent);
|
||||
if (buttonEvent.button == 1) {
|
||||
vfunc_button_press_event(event) {
|
||||
const ret = super.vfunc_button_press_event(event);
|
||||
const button = event.get_button();
|
||||
if (button === 1) {
|
||||
this._setPopupTimeout();
|
||||
} else if (buttonEvent.button == 3) {
|
||||
} else if (button === 3) {
|
||||
this.popupMenu();
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
vfunc_touch_event(touchEvent) {
|
||||
const ret = super.vfunc_touch_event(touchEvent);
|
||||
if (touchEvent.type == Clutter.EventType.TOUCH_BEGIN)
|
||||
vfunc_touch_event(event) {
|
||||
const ret = super.vfunc_touch_event(event);
|
||||
if (event.type() === Clutter.EventType.TOUCH_BEGIN)
|
||||
this._setPopupTimeout();
|
||||
|
||||
return ret;
|
||||
|
@ -82,8 +82,8 @@ const CandidateArea = GObject.registerClass({
|
||||
this._cursorPosition = 0;
|
||||
}
|
||||
|
||||
vfunc_scroll_event(scrollEvent) {
|
||||
switch (scrollEvent.direction) {
|
||||
vfunc_scroll_event(event) {
|
||||
switch (event.get_scroll_direction()) {
|
||||
case Clutter.ScrollDirection.UP:
|
||||
this.emit('cursor-up');
|
||||
break;
|
||||
|
@ -1291,8 +1291,8 @@ class HotCorner extends Clutter.Actor {
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
vfunc_leave_event(crossingEvent) {
|
||||
if (crossingEvent.related != this._corner)
|
||||
vfunc_leave_event(event) {
|
||||
if (event.get_related() !== this._corner)
|
||||
this._entered = false;
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
@ -502,13 +502,13 @@ class ObjInspector extends St.ScrollView {
|
||||
this._obj = null;
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyPressEvent) {
|
||||
const symbol = keyPressEvent.keyval;
|
||||
vfunc_key_press_event(event) {
|
||||
const symbol = event.get_key_symbol();
|
||||
if (symbol === Clutter.KEY_Escape) {
|
||||
this.close();
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
return super.vfunc_key_press_event(keyPressEvent);
|
||||
return super.vfunc_key_press_event(event);
|
||||
}
|
||||
|
||||
_onInsert() {
|
||||
@ -1604,20 +1604,20 @@ 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;
|
||||
vfunc_key_press_event(event) {
|
||||
let symbol = event.get_key_symbol();
|
||||
if (symbol == Clutter.KEY_Escape) {
|
||||
this.close();
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
// Ctrl+PgUp and Ctrl+PgDown switches tabs in the notebook view
|
||||
if (keyPressEvent.modifier_state & Clutter.ModifierType.CONTROL_MASK) {
|
||||
if (event.get_state() & Clutter.ModifierType.CONTROL_MASK) {
|
||||
if (symbol == Clutter.KEY_Page_Up)
|
||||
this._notebook.prevTab();
|
||||
else if (symbol == Clutter.KEY_Page_Down)
|
||||
this._notebook.nextTab();
|
||||
}
|
||||
return super.vfunc_key_press_event(keyPressEvent);
|
||||
return super.vfunc_key_press_event(event);
|
||||
}
|
||||
|
||||
open() {
|
||||
|
@ -69,7 +69,7 @@ class URLHighlighter extends St.Label {
|
||||
this.setMarkup(text, allowMarkup);
|
||||
}
|
||||
|
||||
vfunc_button_press_event(buttonEvent) {
|
||||
vfunc_button_press_event(event) {
|
||||
// Don't try to URL highlight when invisible.
|
||||
// The MessageTray doesn't actually hide us, so
|
||||
// we need to check for paint opacities as well.
|
||||
@ -79,14 +79,14 @@ class URLHighlighter extends St.Label {
|
||||
// Keep Notification from seeing this and taking
|
||||
// a pointer grab, which would block our button-release-event
|
||||
// handler, if an URL is clicked
|
||||
return this._findUrlAtPos(buttonEvent) != -1;
|
||||
return this._findUrlAtPos(event) !== -1;
|
||||
}
|
||||
|
||||
vfunc_button_release_event(buttonEvent) {
|
||||
vfunc_button_release_event(event) {
|
||||
if (!this.visible || this.get_paint_opacity() == 0)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
let urlId = this._findUrlAtPos(buttonEvent);
|
||||
const urlId = this._findUrlAtPos(event);
|
||||
if (urlId != -1) {
|
||||
let url = this._urls[urlId].url;
|
||||
if (!url.includes(':'))
|
||||
@ -99,11 +99,11 @@ class URLHighlighter extends St.Label {
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
vfunc_motion_event(motionEvent) {
|
||||
vfunc_motion_event(event) {
|
||||
if (!this.visible || this.get_paint_opacity() == 0)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
let urlId = this._findUrlAtPos(motionEvent);
|
||||
const urlId = this._findUrlAtPos(event);
|
||||
if (urlId != -1 && !this._cursorChanged) {
|
||||
global.display.set_cursor(Meta.Cursor.POINTING_HAND);
|
||||
this._cursorChanged = true;
|
||||
@ -114,7 +114,7 @@ class URLHighlighter extends St.Label {
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
vfunc_leave_event(crossingEvent) {
|
||||
vfunc_leave_event(event) {
|
||||
if (!this.visible || this.get_paint_opacity() == 0)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
@ -122,7 +122,7 @@ class URLHighlighter extends St.Label {
|
||||
this._cursorChanged = false;
|
||||
global.display.set_cursor(Meta.Cursor.DEFAULT);
|
||||
}
|
||||
return super.vfunc_leave_event(crossingEvent);
|
||||
return super.vfunc_leave_event(event);
|
||||
}
|
||||
|
||||
setMarkup(text, allowMarkup) {
|
||||
@ -151,7 +151,7 @@ class URLHighlighter extends St.Label {
|
||||
}
|
||||
|
||||
_findUrlAtPos(event) {
|
||||
let { x, y } = event;
|
||||
let [x, y] = event.get_coords();
|
||||
[, x, y] = this.transform_stage_point(x, y);
|
||||
let findPos = -1;
|
||||
for (let i = 0; i < this.clutter_text.text.length; i++) {
|
||||
@ -541,8 +541,8 @@ export const Message = GObject.registerClass({
|
||||
_onDestroy() {
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyEvent) {
|
||||
let keysym = keyEvent.keyval;
|
||||
vfunc_key_press_event(event) {
|
||||
let keysym = event.get_key_symbol();
|
||||
|
||||
if (keysym == Clutter.KEY_Delete ||
|
||||
keysym == Clutter.KEY_KP_Delete) {
|
||||
@ -551,7 +551,7 @@ export const Message = GObject.registerClass({
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
}
|
||||
return super.vfunc_key_press_event(keyEvent);
|
||||
return super.vfunc_key_press_event(event);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -310,8 +310,8 @@ class ActivitiesButton extends PanelMenu.Button {
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
vfunc_key_release_event(keyEvent) {
|
||||
let symbol = keyEvent.keyval;
|
||||
vfunc_key_release_event(event) {
|
||||
let symbol = event.get_key_symbol();
|
||||
if (symbol == Clutter.KEY_Return || symbol == Clutter.KEY_space) {
|
||||
if (Main.overview.shouldToggleByCornerOrButton()) {
|
||||
Main.overview.toggle();
|
||||
@ -609,14 +609,14 @@ class Panel extends St.Widget {
|
||||
return this._tryDragWindow(event);
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyEvent) {
|
||||
let symbol = keyEvent.keyval;
|
||||
vfunc_key_press_event(event) {
|
||||
let symbol = event.get_key_symbol();
|
||||
if (symbol == Clutter.KEY_Escape) {
|
||||
global.display.focus_default_window(keyEvent.time);
|
||||
global.display.focus_default_window(event.get_time());
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
return super.vfunc_key_press_event(keyEvent);
|
||||
return super.vfunc_key_press_event(event);
|
||||
}
|
||||
|
||||
_toggleMenu(indicator) {
|
||||
|
@ -142,14 +142,14 @@ export const PopupBaseMenuItem = GObject.registerClass({
|
||||
this._parent = parent;
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyEvent) {
|
||||
vfunc_key_press_event(event) {
|
||||
if (global.focus_manager.navigate_from_event(Clutter.get_current_event()))
|
||||
return Clutter.EVENT_STOP;
|
||||
|
||||
if (!this._activatable)
|
||||
return super.vfunc_key_press_event(keyEvent);
|
||||
return super.vfunc_key_press_event(event);
|
||||
|
||||
let state = keyEvent.modifier_state;
|
||||
let state = event.get_state();
|
||||
|
||||
// if user has a modifier down (except capslock and numlock)
|
||||
// then don't handle the key press here
|
||||
@ -160,7 +160,7 @@ export const PopupBaseMenuItem = GObject.registerClass({
|
||||
if (state)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
let symbol = keyEvent.keyval;
|
||||
let symbol = event.get_key_symbol();
|
||||
if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) {
|
||||
this.activate(Clutter.get_current_event());
|
||||
return Clutter.EVENT_STOP;
|
||||
@ -1244,8 +1244,8 @@ class PopupSubMenuMenuItem extends PopupBaseMenuItem {
|
||||
return this.menu.isOpen;
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyPressEvent) {
|
||||
let symbol = keyPressEvent.keyval;
|
||||
vfunc_key_press_event(event) {
|
||||
let symbol = event.get_key_symbol();
|
||||
|
||||
if (symbol == Clutter.KEY_Right) {
|
||||
this._setOpenState(true);
|
||||
@ -1256,7 +1256,7 @@ class PopupSubMenuMenuItem extends PopupBaseMenuItem {
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
return super.vfunc_key_press_event(keyPressEvent);
|
||||
return super.vfunc_key_press_event(event);
|
||||
}
|
||||
|
||||
activate(_event) {
|
||||
|
@ -123,7 +123,7 @@ class RunDialog extends ModalDialog.ModalDialog {
|
||||
}
|
||||
|
||||
vfunc_key_release_event(event) {
|
||||
if (event.keyval === Clutter.KEY_Escape) {
|
||||
if (event.get_key_symbol() === Clutter.KEY_Escape) {
|
||||
this.close();
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
@ -430,19 +430,20 @@ const UIAreaSelector = GObject.registerClass({
|
||||
if (this._dragButton)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
const cursor = this._computeCursorType(event.x, event.y);
|
||||
const [x, y] = event.get_coords();
|
||||
const cursor = this._computeCursorType(x, y);
|
||||
|
||||
// Clicking outside of the selection, or using the right mouse button,
|
||||
// or with Ctrl results in dragging a new selection from scratch.
|
||||
if (cursor === Meta.Cursor.CROSSHAIR ||
|
||||
button === Clutter.BUTTON_SECONDARY ||
|
||||
(event.modifier_state & Clutter.ModifierType.CONTROL_MASK)) {
|
||||
(event.get_state() & Clutter.ModifierType.CONTROL_MASK)) {
|
||||
this._dragButton = button;
|
||||
|
||||
this._dragCursor = Meta.Cursor.CROSSHAIR;
|
||||
global.display.set_cursor(Meta.Cursor.CROSSHAIR);
|
||||
|
||||
[this._startX, this._startY] = [event.x, event.y];
|
||||
[this._startX, this._startY] = event.get_coords();
|
||||
this._lastX = this._startX = Math.floor(this._startX);
|
||||
this._lastY = this._startY = Math.floor(this._startY);
|
||||
|
||||
@ -452,8 +453,7 @@ const UIAreaSelector = GObject.registerClass({
|
||||
this._dragButton = button;
|
||||
|
||||
this._dragCursor = cursor;
|
||||
this._dragStartX = event.x;
|
||||
this._dragStartY = event.y;
|
||||
[this._dragStartX, this._dragStartY] = event.get_coords();
|
||||
|
||||
const [leftX, topY, width, height] = this.getGeometry();
|
||||
const rightX = leftX + width - 1;
|
||||
@ -517,14 +517,16 @@ const UIAreaSelector = GObject.registerClass({
|
||||
|
||||
// We might have finished creating a new selection, so we need to
|
||||
// update the cursor.
|
||||
this._updateCursor(event.x, event.y);
|
||||
const [x, y] = event.get_coords();
|
||||
this._updateCursor(x, y);
|
||||
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
_onMotion(event, sequence) {
|
||||
if (!this._dragButton) {
|
||||
this._updateCursor(event.x, event.y);
|
||||
const [x, y] = event.get_coords();
|
||||
this._updateCursor(x, y);
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
@ -532,12 +534,13 @@ const UIAreaSelector = GObject.registerClass({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
if (this._dragCursor === Meta.Cursor.CROSSHAIR) {
|
||||
[this._lastX, this._lastY] = [event.x, event.y];
|
||||
[this._lastX, this._lastY] = event.get_coords();
|
||||
this._lastX = Math.floor(this._lastX);
|
||||
this._lastY = Math.floor(this._lastY);
|
||||
} else {
|
||||
let dx = Math.round(event.x - this._dragStartX);
|
||||
let dy = Math.round(event.y - this._dragStartY);
|
||||
const [x, y] = event.get_coords();
|
||||
let dx = Math.round(x - this._dragStartX);
|
||||
let dy = Math.round(y - this._dragStartY);
|
||||
|
||||
if (this._dragCursor === Meta.Cursor.MOVE_OR_RESIZE_WINDOW) {
|
||||
const [,, selectionWidth, selectionHeight] = this.getGeometry();
|
||||
@ -658,17 +661,19 @@ const UIAreaSelector = GObject.registerClass({
|
||||
}
|
||||
|
||||
vfunc_button_press_event(event) {
|
||||
if (event.button === Clutter.BUTTON_PRIMARY ||
|
||||
event.button === Clutter.BUTTON_SECONDARY)
|
||||
return this._onPress(event, event.button, null);
|
||||
const button = event.get_button();
|
||||
if (button === Clutter.BUTTON_PRIMARY ||
|
||||
button === Clutter.BUTTON_SECONDARY)
|
||||
return this._onPress(event, button, null);
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
vfunc_button_release_event(event) {
|
||||
if (event.button === Clutter.BUTTON_PRIMARY ||
|
||||
event.button === Clutter.BUTTON_SECONDARY)
|
||||
return this._onRelease(event, event.button, null);
|
||||
const button = event.get_button();
|
||||
if (button === Clutter.BUTTON_PRIMARY ||
|
||||
button === Clutter.BUTTON_SECONDARY)
|
||||
return this._onRelease(event, button, null);
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
@ -678,12 +683,13 @@ const UIAreaSelector = GObject.registerClass({
|
||||
}
|
||||
|
||||
vfunc_touch_event(event) {
|
||||
if (event.type === Clutter.EventType.TOUCH_BEGIN)
|
||||
return this._onPress(event, 'touch', event.sequence);
|
||||
else if (event.type === Clutter.EventType.TOUCH_END)
|
||||
return this._onRelease(event, 'touch', event.sequence);
|
||||
else if (event.type === Clutter.EventType.TOUCH_UPDATE)
|
||||
return this._onMotion(event, event.sequence);
|
||||
const eventType = event.type();
|
||||
if (eventType === Clutter.EventType.TOUCH_BEGIN)
|
||||
return this._onPress(event, 'touch', event.get_event_sequence());
|
||||
else if (eventType === Clutter.EventType.TOUCH_END)
|
||||
return this._onRelease(event, 'touch', event.get_event_sequence());
|
||||
else if (eventType === Clutter.EventType.TOUCH_UPDATE)
|
||||
return this._onMotion(event, event.get_event_sequence());
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
@ -1999,9 +2005,9 @@ export const ScreenshotUI = GObject.registerClass({
|
||||
}
|
||||
|
||||
vfunc_key_press_event(event) {
|
||||
const symbol = event.keyval;
|
||||
const symbol = event.get_key_symbol();
|
||||
if (symbol === Clutter.KEY_Return || symbol === Clutter.KEY_space ||
|
||||
((event.modifier_state & Clutter.ModifierType.CONTROL_MASK) &&
|
||||
((event.get_state() & Clutter.ModifierType.CONTROL_MASK) &&
|
||||
(symbol === Clutter.KEY_c || symbol === Clutter.KEY_C))) {
|
||||
this._onCaptureButtonClicked();
|
||||
return Clutter.EVENT_STOP;
|
||||
@ -2656,11 +2662,11 @@ class SelectArea extends St.Widget {
|
||||
});
|
||||
}
|
||||
|
||||
vfunc_motion_event(motionEvent) {
|
||||
vfunc_motion_event(event) {
|
||||
if (this._startX == -1 || this._startY == -1 || this._result)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
[this._lastX, this._lastY] = [motionEvent.x, motionEvent.y];
|
||||
[this._lastX, this._lastY] = event.get_coords();
|
||||
this._lastX = Math.floor(this._lastX);
|
||||
this._lastY = Math.floor(this._lastY);
|
||||
let geometry = this._getGeometry();
|
||||
@ -2672,11 +2678,11 @@ class SelectArea extends St.Widget {
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
vfunc_button_press_event(buttonEvent) {
|
||||
vfunc_button_press_event(event) {
|
||||
if (this._result)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
[this._startX, this._startY] = [buttonEvent.x, buttonEvent.y];
|
||||
[this._startX, this._startY] = event.get_coords();
|
||||
this._startX = Math.floor(this._startX);
|
||||
this._startY = Math.floor(this._startY);
|
||||
this._rubberband.set_position(this._startX, this._startY);
|
||||
@ -2913,8 +2919,8 @@ class PickPixel extends St.Widget {
|
||||
this._previewCursor.show();
|
||||
}
|
||||
|
||||
vfunc_motion_event(motionEvent) {
|
||||
const { x, y } = motionEvent;
|
||||
vfunc_motion_event(event) {
|
||||
const [x, y] = event.get_coords();
|
||||
this._pickColor(x, y);
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ const ShellMountQuestionDialog = GObject.registerClass({
|
||||
}
|
||||
|
||||
vfunc_key_release_event(event) {
|
||||
if (event.keyval === Clutter.KEY_Escape) {
|
||||
if (event.get_key_symbol() === Clutter.KEY_Escape) {
|
||||
this.emit('response', -1);
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
@ -491,7 +491,7 @@ const ShellProcessesDialog = GObject.registerClass({
|
||||
}
|
||||
|
||||
vfunc_key_release_event(event) {
|
||||
if (event.keyval === Clutter.KEY_Escape) {
|
||||
if (event.get_key_symbol() === Clutter.KEY_Escape) {
|
||||
this.emit('response', -1);
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
@ -177,14 +177,14 @@ export const Slider = GObject.registerClass({
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyPressEvent) {
|
||||
let key = keyPressEvent.keyval;
|
||||
vfunc_key_press_event(event) {
|
||||
let key = event.get_key_symbol();
|
||||
if (key == Clutter.KEY_Right || key == Clutter.KEY_Left) {
|
||||
let delta = key == Clutter.KEY_Right ? 0.1 : -0.1;
|
||||
this.value = Math.max(0, Math.min(this._value + delta, this._maxValue));
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
return super.vfunc_key_press_event(keyPressEvent);
|
||||
return super.vfunc_key_press_event(event);
|
||||
}
|
||||
|
||||
_moveHandle(absX, _absY) {
|
||||
|
@ -183,10 +183,10 @@ export const SwitcherPopup = GObject.registerClass({
|
||||
throw new GObject.NotImplementedError(`_keyPressHandler in ${this.constructor.name}`);
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyEvent) {
|
||||
let keysym = keyEvent.keyval;
|
||||
vfunc_key_press_event(event) {
|
||||
let keysym = event.get_key_symbol();
|
||||
let action = global.display.get_keybinding_action(
|
||||
keyEvent.hardware_keycode, keyEvent.modifier_state);
|
||||
event.get_key_code(), event.get_state());
|
||||
|
||||
this._disableHover();
|
||||
|
||||
@ -206,18 +206,18 @@ export const SwitcherPopup = GObject.registerClass({
|
||||
keysym === Clutter.KEY_Return ||
|
||||
keysym === Clutter.KEY_KP_Enter ||
|
||||
keysym === Clutter.KEY_ISO_Enter)
|
||||
this._finish(keyEvent.time);
|
||||
this._finish(event.get_time());
|
||||
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
vfunc_key_release_event(keyEvent) {
|
||||
vfunc_key_release_event(event) {
|
||||
if (this._modifierMask) {
|
||||
let [x_, y_, mods] = global.get_pointer();
|
||||
let state = mods & this._modifierMask;
|
||||
|
||||
if (state == 0)
|
||||
this._finish(keyEvent.time);
|
||||
this._finish(event.get_time());
|
||||
} else {
|
||||
this._resetNoModsTimeout();
|
||||
}
|
||||
@ -238,10 +238,10 @@ export const SwitcherPopup = GObject.registerClass({
|
||||
this._select(this._next());
|
||||
}
|
||||
|
||||
vfunc_scroll_event(scrollEvent) {
|
||||
vfunc_scroll_event(event) {
|
||||
this._disableHover();
|
||||
|
||||
this._scrollHandler(scrollEvent.direction);
|
||||
this._scrollHandler(event.get_scroll_direction());
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
|
@ -607,19 +607,19 @@ export const UnlockDialog = GObject.registerClass({
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyEvent) {
|
||||
vfunc_key_press_event(event) {
|
||||
if (this._activePage === this._promptBox ||
|
||||
(this._promptBox && this._promptBox.visible))
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
const { keyval } = keyEvent;
|
||||
const keyval = event.get_key_symbol();
|
||||
if (keyval === Clutter.KEY_Shift_L ||
|
||||
keyval === Clutter.KEY_Shift_R ||
|
||||
keyval === Clutter.KEY_Shift_Lock ||
|
||||
keyval === Clutter.KEY_Caps_Lock)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
let unichar = keyEvent.unicode_value;
|
||||
let unichar = event.get_key_unicode();
|
||||
|
||||
this._showPrompt();
|
||||
|
||||
|
@ -557,18 +557,18 @@ export const WindowPreview = GObject.registerClass({
|
||||
this.emit('selected', global.get_current_time());
|
||||
}
|
||||
|
||||
vfunc_enter_event(crossingEvent) {
|
||||
vfunc_enter_event(event) {
|
||||
this.showOverlay(true);
|
||||
return super.vfunc_enter_event(crossingEvent);
|
||||
return super.vfunc_enter_event(event);
|
||||
}
|
||||
|
||||
vfunc_leave_event(crossingEvent) {
|
||||
vfunc_leave_event(event) {
|
||||
if (this._destroyed)
|
||||
return super.vfunc_leave_event(crossingEvent);
|
||||
return super.vfunc_leave_event(event);
|
||||
|
||||
if ((crossingEvent.flags & Clutter.EventFlags.FLAG_GRAB_NOTIFY) !== 0 &&
|
||||
if ((event.get_flags() & Clutter.EventFlags.FLAG_GRAB_NOTIFY) !== 0 &&
|
||||
global.stage.get_grab_actor() === this._closeButton)
|
||||
return super.vfunc_leave_event(crossingEvent);
|
||||
return super.vfunc_leave_event(event);
|
||||
|
||||
if (this._idleHideOverlayId > 0)
|
||||
GLib.source_remove(this._idleHideOverlayId);
|
||||
@ -589,7 +589,7 @@ export const WindowPreview = GObject.registerClass({
|
||||
|
||||
GLib.Source.set_name_by_id(this._idleHideOverlayId, '[gnome-shell] this._idleHideOverlayId');
|
||||
|
||||
return super.vfunc_leave_event(crossingEvent);
|
||||
return super.vfunc_leave_event(event);
|
||||
}
|
||||
|
||||
vfunc_key_focus_in() {
|
||||
@ -604,15 +604,15 @@ export const WindowPreview = GObject.registerClass({
|
||||
this.hideOverlay(true);
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyEvent) {
|
||||
let symbol = keyEvent.keyval;
|
||||
vfunc_key_press_event(event) {
|
||||
let symbol = event.get_key_symbol();
|
||||
let isEnter = symbol == Clutter.KEY_Return || symbol == Clutter.KEY_KP_Enter;
|
||||
if (isEnter) {
|
||||
this._activate();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.vfunc_key_press_event(keyEvent);
|
||||
return super.vfunc_key_press_event(event);
|
||||
}
|
||||
|
||||
_restack() {
|
||||
|
Loading…
Reference in New Issue
Block a user