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