GNOME Bugzilla – Bug 678272
Touchscreen event handling
Last modified: 2018-05-22 11:42:48 UTC
Add touchscreen event handling. At the moment, it is possible to single tap a tile to reveal it or single tap a revealed tile to reveal others around it when the mines are marked. It is not possible to mark a mine without a mouse. I suggest that a double tap on a touchscreen is registered as adding a flag instead of as two individual taps. Another double tap should change the red flag to a blue flag when blue flags are enabled or remove the red flag when blue flags are disabled.
Allan wants a flag button, described at Bug #710616. I'm not sure if we want to implement both of these? I don't have a touch device so this is a very uneducated comment, but one possible concern is that if double-tapping isn't very accurate, you could accidentally explode a mine instead of flagging it.
(In reply to comment #1) > Allan wants a flag button, described at Bug #710616. I'm not sure if we want > to implement both of these? Given that it's a timed game and the aim is to complete it in the shortest time possibly, I wouldn't be too keen to have only mode switching by button. > I don't have a touch device so this is a very uneducated comment, but one > possible concern is that if double-tapping isn't very accurate, you could > accidentally explode a mine instead of flagging it. That is true, although I have not had this problem myself.
Press-and-hold gestures are a well-known workaround to emulate double-clicks on touch-enabled devices.
That would be interesting to try out…
*** Bug 724824 has been marked as a duplicate of this bug. ***
(In reply to comment #1) > Allan wants a flag button, described at Bug #710616. I'm not sure if we want > to implement both of these? We're not going to make this a button after all. (In reply to comment #3) > Press-and-hold gestures are a well-known workaround to emulate double-clicks on > touch-enabled devices. I think this is what we're going to do. As far as I know, we have to handle this manually. Can you estimate roughly how long a touch would be appropriate for it to be considered a flag placement?
"As far as I know, we have to handle this manually." Are you *entirely* sure about this? Long press is such a universal action, and I know it's already used in certain other areas of GNOME 3 (though I'm blanking on a specific example ATM). It seems almost inconceivable that it wouldn't be available from some generic library already, and if it isn't, it absolutely *should* be. It seems entirely absurd for every app to re-implement it.
(In reply to comment #7) > "As far as I know, we have to handle this manually." > > Are you *entirely* sure about this? No. I think we have to listen to GdkEvents emitted by GtkWidget::touch-event, because that's the only relevant API in GTK+ with the word "touch" in its name, but I am most definitely not sure there's not some better way to do this.
(In reply to comment #7) > Are you *entirely* sure about this? Nowadays we have [1] which looks easy enough that we could probably write the code without a touchscreen and maybe get it right. (But this is brand new. I guessed right five months ago. :) [1] https://developer.gnome.org/gtk3/unstable/GtkGestureLongPress.html
(In reply to comment #9) > (In reply to comment #7) > > Are you *entirely* sure about this? > > Nowadays we have [1] which looks easy enough that we could probably write the > code without a touchscreen and maybe get it right. Yup, and GtkInspector nowadays has touchscreen emulation, so I will take a look at it this week. > > (But this is brand new. I guessed right five months ago. :) > > [1] https://developer.gnome.org/gtk3/unstable/GtkGestureLongPress.html
After thinking a bit about this, I am leaning towards having double-tap as flagging action, because the goal of the game is to find all the mines as fast as possible, and speed being important for best results, having to long-tap for a flag would increase the time required to complete the game.
Indeed, this seems like the best solution. This is also the reason that I would like the game to have consistent behaviour between keyboard+mouse, keyboard+touchpad and keyboard+touchscreen (see bug 678271).
Created attachment 314534 [details] [review] Proposed patch Another alternative to double clicking or hold clicking is a swipe gesture. The proposed patch implements this functionality. Slide right to toggle flags and slide left to remove a flag. Sliding up or down cancels the gesture/click. Tested on my touch screen. Seems to work fine, sometimes with a little lag though. Perhaps it would be better to convert to integers instead of doubles for the gesture code and do a bound box check rather than a radius check. The click radius could also be computed or set in the application properties. Perhaps there is a better way to implement this? Any suggestions?
Created attachment 314681 [details] [review] Proposed patch (version 2)
Hmmm... I didn't think about swipe until now, it sound better than long-tap or double-tap indeed, but this must be implemented carefully, to: * work only on touch, and not do the same thing if I mouse-press, move the mouse a bit, and mouse-release * swipe gesture must be explained in an "interactive tutorial" @Kat: what do you think about Isaac's proposal to use swipe gestures for flagging and resetting flag?
One way of documenting the swipe gesture would be to use the new GtkShortcutsWindow: https://developer.gnome.org/gtk3/3.19/GtkShortcutsWindow.html#GtkShortcutsWindow.description Specifically, a GtkShortcutsGesture.
(In reply to Robert Roth from comment #15) > Hmmm... I didn't think about swipe until now, it sound better than long-tap > or double-tap indeed, but this must be implemented carefully, to: > * work only on touch, and not do the same thing if I mouse-press, move the > mouse a bit, and mouse-release > * swipe gesture must be explained in an "interactive tutorial" Would be awesome if we can think of a way to have an overlay over the UI and get the user to repeat the actions, but alternatively can do video in the user help although a UI simulation there would also be a pretty cool idea. > @Kat: what do you think about Isaac's proposal to use swipe gestures for > flagging and resetting flag? Sounds like an interesting solution. Needs to react quite quickly…
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-mines/issues/4.