edemaine / cocreate

Cocreate Shared Whiteboard/Drawing
MIT License
209 stars 27 forks source link

Tool not released using stylus on Chromium/X11 #218

Closed groszdaniel closed 1 year ago

groszdaniel commented 1 year ago

On Linux, X11 & Chromium, the following issue shows up when using a laptop with an active stylus as well as a mouse.

  1. Select the pen tool (to make the effects the most obvious. (But the other tools are affected too.)
  2. Switch away from the Chromium window, while keeping it visible. (Alternatively, click on an empty area of a Cocreate toolbar, and keep the mouse cursor there.)
  3. Draw with the stylus, then release it.
  4. Move the mouse. Result: Drawing is continued as the mouse moves. A straight line is added connecting the point where the stylus first touched the screen, and where it is released.

I've found that this is because Chromium on X11 sends two pointerenter events when you start to draw with the stylus, if the window is previously inactive: one with the id of the stylus, and one with the id of the mouse. No mouseleave event corresponding to the latter is sent when the stylus is released. As a result, Cocreate continues to think that the mouse button is pressed, until you click with the mouse.

The issue doesn't seem to come up with Firefox, nor on Chrome on Wayland.