Skip to content

Commit 9c954cd

Browse files
committed
virtualKeyboard.js: Fix extended keys when interacting with
clutter entries. also, layout.js: Revise a comment related to struts.
1 parent f5ec111 commit 9c954cd

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

js/ui/layout.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,10 +1007,10 @@ Chrome.prototype = {
10071007
let monitor = this.findMonitorForActor(actorData.actor);
10081008
let side;
10091009
if (x1 <= monitor.x && x2 >= monitor.x + monitor.width) {
1010+
// Allow the keyboard box to become chrome even though it's only adjacent to a panel
1011+
// rather than a monitor edge.
10101012
if (y1 <= monitor.y + (actorData.actor.name === "keyboardBox" ? 100 : 0))
10111013
side = Meta.Side.TOP;
1012-
// Hack to let the keyboardBox be considered struts even though it's off the edge of the monitor
1013-
// by some panel height amount.
10141014
else if (y2 >= monitor.y + monitor.height - (actorData.actor.name === "keyboardBox" ? 100 : 0))
10151015
side = Meta.Side.BOTTOM;
10161016
else

js/ui/virtualKeyboard.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ var Key = GObject.registerClass({
249249

250250
this._capturedEventId = 0;
251251
this._unmapId = 0;
252-
this._longPress = false;
253252
}
254253

255254
updateKey(label, icon = null) {
@@ -294,20 +293,19 @@ var Key = GObject.registerClass({
294293
_press(key) {
295294
this.emit('activated');
296295

297-
if (key !== this.key || this._extendedKeys.length === 0)
296+
if (this._extendedKeys.length === 0)
298297
this.emit('pressed', this._getKeyval(key), key);
299298

300299
if (key == this.key) {
301300
this._pressTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
302301
KEY_LONG_PRESS_TIME,
303302
() => {
304-
this._longPress = true;
305303
this._pressTimeoutId = 0;
306304

307305
this.emit('long-press');
308306

309307
if (this._extendedKeys.length > 0) {
310-
this._touchPressed = false;
308+
this._touchPressSlot = null;
311309
this._ensureExtendedKeysPopup();
312310
this.keyButton.set_hover(false);
313311
this.keyButton.fake_release();
@@ -325,20 +323,19 @@ var Key = GObject.registerClass({
325323
this._pressTimeoutId = 0;
326324
}
327325

328-
if (!this._longPress && key === this.key && this._extendedKeys.length > 0)
326+
if (this._extendedKeys.length > 0)
329327
this.emit('pressed', this._getKeyval(key), key);
330328

331329
this.emit('released', this._getKeyval(key), key);
332330
this._hideSubkeys();
333-
this._longPress = false;
334331
}
335332

336333
cancel() {
337334
if (this._pressTimeoutId != 0) {
338335
GLib.source_remove(this._pressTimeoutId);
339336
this._pressTimeoutId = 0;
340337
}
341-
this._touchPressed = false;
338+
this._touchPressSlot = null;
342339
this.keyButton.set_hover(false);
343340
this.keyButton.fake_release();
344341
}
@@ -425,14 +422,19 @@ var Key = GObject.registerClass({
425422
if (!Meta.is_wayland_compositor())
426423
return Clutter.EVENT_PROPAGATE;
427424

428-
if (!this._touchPressed &&
425+
const slot = event.get_event_sequence().get_slot();
426+
427+
if (!this._touchPressSlot &&
429428
event.type() == Clutter.EventType.TOUCH_BEGIN) {
430-
this._touchPressed = true;
429+
this._touchPressSlot = slot;
431430
this._press(key);
432-
} else if (this._touchPressed &&
433-
event.type() == Clutter.EventType.TOUCH_END) {
434-
this._touchPressed = false;
435-
this._release(key);
431+
} else if (event.type() === Clutter.EventType.TOUCH_END) {
432+
if (!this._touchPressSlot ||
433+
this._touchPressSlot === slot)
434+
this._release(key);
435+
436+
if (this._touchPressSlot === slot)
437+
this._touchPressSlot = null;
436438
}
437439
return Clutter.EVENT_PROPAGATE;
438440
});

0 commit comments

Comments
 (0)