~eliasnaur/gio#87: 
gesture.Click stays focused after mouse out

I'm not sure if this is expected behaviour, but it doesn't align with other pointer events that I'm familiar with (which is mostly from the browser). The problem could also be that the use of the word "focused" doesn't match that of the browser. Right now it seems like a hybrid of hover and focus: mouseover to focus, click elsewhere to unfocus.

So, I assumed focus means hover in browser speak, and dug into the internals.

It looks like router.Events() only returns pointer.Move events when the pointer is intersecting with the specified area thus not giving a chance to "unfocus". I had to stop at once I hit the ops package since I'm new here and everything's still way over my head.

My goal is to create a gesture.Hover that works like that of the browser.

Status
REPORTED
Submitter
~ssttevee
Assigned to
No-one
Submitted
5 months ago
Updated
5 months ago
Labels
No labels applied.

~eliasnaur 5 months ago

On Tue Feb 25, 2020 at 07:11, ~ssttevee wrote:

I'm not sure if this is expected behaviour, but it doesn't align with other pointer events that I'm familiar with (which is mostly from the browser). The problem could also be that the use of the word "focused" doesn't match that of the browser. Right now it seems like a hybrid of hover and focus: mouseover to focus, click elsewhere to unfocus.

So, I assumed focus means hover in browser speak, and dug into the internals.

It looks like router.Events() only returns pointer.Move events when the pointer is intersecting with the specified area thus not giving a chance to "unfocus". I had to stop at once I hit the ops package since I'm new here and everything's still way over my head.

My goal is to create a gesture.Hover that works like that of the browser.

I believe the correct fix is to introduce two new pointer.Types, Enter and Leave. Then io/router/pointer.go needs to track the topmost handler and send Enter/Leave events whenever it changes.

Do you want to take a stab at it? Other than adding the new Types, I believe pointerQueue.Push

https://git.sr.ht/~eliasnaur/gio/tree/master/io/router/pointer.go#L192

is the right location for tracking the "focused" handler.

~ssttevee 5 months ago

Thanks for the pointers, I've submitted a patch introducing the Enter and Leave pointer.Types.

Should the "focused" state of gesture.Click be updated to reflect a css hover or a focus like a html button?

~eliasnaur 5 months ago

On Tue Feb 25, 2020 at 20:49, ~ssttevee wrote:

Thanks for the pointers, I've submitted a patch introducing the Enter and Leave pointer.Types.

Should the "focused" state of gesture.Click be updated to reflect a css hover or a focus like a html button?

It should behave like a CSS hover.

~ssttevee 5 months ago

I've been thinking about whether the "focused" state belong as a state of a "click". Under the current model, an area cannot be both hovered and pressed simultaneously, which by logic is possible.

I can convince myself that a click gesture only involves whether or not the switch on my mouse is depressed and not necessarily the position of the pointer. In contrast, the definition of a hover gesture is whether or not the pointer is within the region, which does depend on the position of the pointer.

Taking this into account, I think the focused state should be moved into its own unit or removed all together.

~eliasnaur 5 months ago

On Wed Feb 26, 2020 at 4:39 AM, ~ssttevee wrote:

I've been thinking about whether the "focused" state belong as a state of a "click". Under the current model, an area cannot be both hovered and pressed simultaneously, which by logic is possible.

I can convince myself that a click gesture only involves whether or not the switch on my mouse is depressed and not necessarily the position of the pointer. In contrast, the definition of a hover gesture is whether or not the pointer is within the region, which does depend on the position of the pointer.

Taking this into account, I think the focused state should be moved into its own unit or removed all together.

SGTM. Perhaps change the state field into two bools, Pressed and Focused. Dropping Focused altogether is also ok with me.

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