keyboard: Always emit ::pressed late on keys with variants
When we press a key with variants, we used to prevent an early ::pressed, because a long press could show the options popover, and the press be undone. In addition, this long press could move to one of the suboptions, and be released there. For this case we also want this late emission of the ::pressed signal. This makes the "tap, drag, release" pattern work on the regular OSK keys, in addition to the emoji panel. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1789>
This commit is contained in:
parent
40e53492ab
commit
82c2f293a0
@ -296,7 +296,6 @@ var Key = GObject.registerClass({
|
||||
|
||||
this._capturedEventId = 0;
|
||||
this._unmapId = 0;
|
||||
this._longPress = false;
|
||||
}
|
||||
|
||||
_onDestroy() {
|
||||
@ -334,14 +333,13 @@ var Key = GObject.registerClass({
|
||||
_press(key) {
|
||||
this.emit('activated');
|
||||
|
||||
if (key !== this.key || this._extendedKeys.length === 0)
|
||||
if (this._extendedKeys.length === 0)
|
||||
this.emit('pressed', this._getKeyval(key), key);
|
||||
|
||||
if (key == this.key) {
|
||||
this._pressTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
|
||||
KEY_LONG_PRESS_TIME,
|
||||
() => {
|
||||
this._longPress = true;
|
||||
this._pressTimeoutId = 0;
|
||||
|
||||
this.emit('long-press');
|
||||
@ -365,12 +363,11 @@ var Key = GObject.registerClass({
|
||||
this._pressTimeoutId = 0;
|
||||
}
|
||||
|
||||
if (!this._longPress && key === this.key && this._extendedKeys.length > 0)
|
||||
if (this._extendedKeys.length > 0)
|
||||
this.emit('pressed', this._getKeyval(key), key);
|
||||
|
||||
this.emit('released', this._getKeyval(key), key);
|
||||
this._hideSubkeys();
|
||||
this._longPress = false;
|
||||
}
|
||||
|
||||
cancel() {
|
||||
|
Loading…
Reference in New Issue
Block a user