Closed Bug 1451587 Opened 6 years ago Closed 6 years ago

XINPUT2 touchscreen scrolling breaks after long-press text selection

Categories

(Core :: Widget: Gtk, defect)

59 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1321069

People

(Reporter: steven, Unassigned)

Details

(Keywords: dupeme)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0
Build ID: 20180326161258

Steps to reproduce:

From an otherwise clean firefox profile with MOZ_USE_XINPUT2=1 set in the environment, first long-press a point in a webpage to trigger GTK3's blue selection handles, then attempt to scroll a webpage by using the touchscreen with a single finger.

Environment: 

Ubuntu 16.04, kernel 4.13.0
touchscreen: 04f3:0254 Elan Microelectronics Corp
MOZ_USE_XINPUT2=1 environment variable set
clean firefox profile, no about:config changes.


Actual results:

The webpage zooms in and out instead as you move your finger on the touchscreen, or sometimes scrolls in unexpected ways. It seems as if the long-press to select text "freezes" a false multitouch coordinate, so continuing to scroll behaves like the two finger pinch zoom gesture.

This buggy behaviour persists until the firefox process is restarted, across all tabs and windows. Restarting restores the correct scrolling behaviour, but a single inadvertent long-press will break scrolling again.

Aside: touchscreen text selection doesn't work either. The GTK menu for copy/etc doesn't pop up, nor can the selection handles be manipulated, possibly for the same "stuck event" reason.




Expected results:

The page should continue to scroll with a touchscreen finger as normal.

I recorded a quick screencast comparing to our good friend Chromium's behaviour here:

https://www.youtube.com/watch?v=Gt_fr6AgoGo

There's unfortunately no indication where I'm touching, but I hope it's illustrative. (Also shown is chromium's smooth pinch-to-zoom behaviour compared to firefox's quantized zoom, but I imagine that's a feature request somewhere else).
Setting component, but we don't have the hardware to be able to test something like this.
Component: Untriaged → Widget: Gtk
Product: Firefox → Core
Keywords: dupeme
I've experienced this bug too. The craziness with the zoom only seems to start after the long press event and goes away after restart. It's as if the release of that long press you used when calling up the context menu was never registered and it thinks you're still pressing down, even though you're not. It interprets all subsequent touches as multi-touches. This behavior only appears when the context menu comes out and not before, so the bug is probably in there somewhere. Devs should also be aware that this is an X11 only bug. I've built FF wayland (now that Fedora's FFwayland project has been merged as of 59.0) and the context menu bug is no longer there. Unfortunately as of 59.02, FF wayland is still too unstable to be used as a daily driver (it has some intense problems with clipboard drops and crashes alot).

This is my work around for the touch stability problem on FF in X11. I've disabled context menu and use a double tap to bring up the selection caret. It's a bit drastic but everything else works perfectly now and I'd rather loose the context menu if it means I have some stability for the rest of the gestures. 


Here's how you do it:

Step 1) Learn how to compile Firefox. It takes a few hours but there's a lot of good tutorials out there and it's very doable. If you're not a dev, I'd recommend doing it in a VM rather than bloating your OS with tons of dev packages you won't need afterwards. 
     Build Instructions for Linux: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Source_Code/Mercurial
     I'm  on Ubuntu 17.10 and I found that the following packages were missing for me:
     apt-get install mercurial gpp cmake autoconf2.13 llvm-dev clang libgconf2-dev libgconf2.0-cil-dev libdbus-glib-1-dev yasm libxt-dev rustc cargo
     Source can be found here: https://archive.mozilla.org/pub/firefox/releases
     59.02: https://hg.mozilla.org/releases/mozilla-release/rev/239e434d6d2b8e1e2b697c3416d1e96d48fe98e5

Step 2) Download Firefox code and goto <source_top_level>/gfx/thebes/gfxPrefs.h
Step 3) Open that file and look for ui.click_hold_context_menus.delay (the full line is 
     DECL_GFX_PREF(Live, "ui.click_hold_context_menus.delay", UiClickHoldContextMenusDelay, int32_t, 500);
Step 4) You want to change that 500 at the very end to 9999 (that's 500ms of delay to 10 second)
     DECL_GFX_PREF(Live, "ui.click_hold_context_menus.delay", UiClickHoldContextMenusDelay, int32_t, 9999);


I would recommend Tablet Gestures addons to give FF touch gesture parity with Chromium: https://addons.mozilla.org/en-US/firefox/addon/tablet-gestures/?src=search (I use to do a 2 finger swipe to go back and forward, up and down to switch tabs). Keep your fingers glued together to do the gestures or it won't work.

Tab to Tab gives you the ability to open links in new tabs with a double tap: https://addons.mozilla.org/en-US/firefox/addon/tap-to-tab/

Gnome-Shell Extension Right Click for Touch Screen adds system wide right click (it doesn't work very well on links but it's pretty useful otherwise): https://extensions.gnome.org/extension/1248/right-click-support-for-touch-screen/
I was about to put this bug in, confirmed with Ubuntu 18.04 LTS, Firefox 59.0.2 (64-bit).  Seems innocent enough but causes the entirety of Ubuntu's web experience to be fairly unusable till restart Firefox.  Otherwise, seems to work very well.
(In reply to Fadi R from comment #2)
> Here's how you do it:
> 
> Step 1) Learn how to compile Firefox.

Note that the steps you're doing can be accomplished without having to compile firefox. Just go to about:config and add/change the ui.click_hold_context_menus.delay pref to 9999. You don't need to change it in the source.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.