~eliasnaur/gio#209: 
pointer doesn't send "Release" if the window is changed/lost.

I notice some bugs while testing on WASM and Windows (on Windows it's veeeeeery rare). On Android it might be possible to reproduce, but I didn't try, yet.

The issue is that Gio doens't send a pointer.Release if the mouse is never released. The mouse can be "never released" because switch the Window.


Easy way to reproduce the problem:

  1. Open two tabs on Chrome.
  2. In one tab (the first one) open the Gio app which contain some button (the Kitchen demo).
  3. Press some button and keep pressed.
  4. While your mouse still pressed, hit "CTRL + 2". It will switch to another tab (the second one).
  5. Leave your mouse in that second tab.
  6. Return to the Gio app.
  7. Click anywhere in the Gio app (outside of the button).

Result: Even clicking outside of the button, the button will be triggered.

On Windows it's more difficult to reproduce, it happens once and I think it was related to that problem.


Maybe, once the "focus is lost" (system.StageEvent), the pointer must be reseted in somehow?! But the pointer.Push() doesn't have access to the current Stage of the app. 😶

Status
REPORTED
Submitter
~inkeliz
Assigned to
No-one
Submitted
16 days ago
Updated
15 days ago
Labels
No labels applied.

~inkeliz 16 days ago*

That bug is annoying if you are open another window (say window.open("https://google.com") when you click. Then, the mouse gets trapped because it triggers the button every time you return to Gio ( since the mouse is never released).

The workaround is to track the pointer.Released instead of pointer.Press.

~eliasnaur 16 days ago

This is what pointer.Cancel events are for. The wasm backend emits Cancels on "touchcancel", I suppose it also needs to send them at focus loss.

~inkeliz 15 days ago

I tried to add w.w.Event(pointer.Event{Type: pointer.Cancel}) to visibilitychange. The visibilitychange is triggered, I receive the StageEvents, but the pointer.Cancel seems to be ignored, in somehow. It's received in the pointer.Push, but doesn't remove the last click.

I don't know, weird. 😣

~eliasnaur 15 days ago

On Sun Mar 28, 2021 at 13:39, ~inkeliz wrote:

I tried to add w.w.Event(pointer.Event{Type: pointer.Cancel}) to [v isibilitychange](https://git.sr.ht/~eliasnaur/gio/tree/main/item/app/in ternal/wm/os_js.go#L169). The visibilitychange is triggered, I receive the StageEvents, but the pointer.Cancel seems to be ignored, in somehow. It's received in the pointer.Push, but doesn't remove the last click.

I don't know, weird. 😣

I haven't dug into the problem, but perhaps setPointerCapture is a better approach (if available). See[0].

Elias

[0] https://stackoverflow.com/questions/14407869/capture-mouseup-event-outside-of-browser-window

Register here or Log in to comment, or comment via email.