-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capture first mouse event on macOS. #842
Conversation
This is interesting; it's |
This is I think it's completely reasonable to have it as |
The downside is clicking in a background window to gain focus, and accidentally initiating some interaction, like deselecting some selected text or applying some edit to an image in an image editor, etc. Notes does not have this behaviour if you click in the text region; it does not change the selection. (select all in notes, focus another app, click in the selected region; the selection is unchanged). I agree that there's an annoyance here where we can't set this to be true for specific widgets. I'm not sure what we could do about that. In any case: my preference for |
Okay, so there are two scenarios here that should be replicated to achieve a macOS feel.
Just having We could however add a new field to This approach will allow us to modify widgets like |
Not sure if other platforms besides macOS need to be taken into account here, but in X11 at least this is the case when using window manager reparented windows/decorations. |
I tested Ubuntu 19.04 with the bundled calculator and text editor. It seems to behave exactly like Windows. Which is to say the first focusing mouse click goes to the app and works both as a button press and also changes text selection. @ratmice are you seeing different behavior? What distro/WM? |
@xStrom Most of this I just know from having written a window manager before, by default my window manager seems to send the event by default. I know that the windowmaker has settings for this, and tested with that with both settings. With that enabled we see the weird behavior that when non-focused we still highlight buttons on With it disabled we get the highlight on Anyhow I just wanted to note that X11 is very hard to pin down any sort of feel in this regard. |
Yeah I think this isn't going to be a problem if the user expects this kind of behavior. Druid matching the X11 feel will depend on what that configuration setting is for them. If the click gets sent, druid handles it and everything works. If the click doesn't get sent due to that X11 setting then that's fine too, because the user doesn't expect it to work, because it doesn't work that way with any other app on their desktop. It's simple because it's a simple boolean setting. Windows is also simple, because it's a simple boolean that's always However with macOS it's trickier because it's context/widget dependant. Thus I think the solution here is to allow druid apps to also handle the focusing click differently, however each widget wants. |
This sounds like an elegant solution to me. |
I pushed a new iteration of this. The information about the click being the focusing one is now made available to users. I also updated the |
hmm, slightly confused here; with both master and this patch, if I run the calculator and have it not be focused, a click gives it focus but is not handled. |
That's interesting. I just re-tested and the calculator works fine, it registers the click and a new number appears on the calc display. I'm running macOS Catalina 10.15.4. Maybe double check that the code you have checked out matches the latest tip here and perhaps also try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, this is working for me; not sure what was going on.
My gut feeling is that this behaviour should be opt-in, not opt-out, but I'm happy enough to get this in and then see how it feels.
This PR allows druid to receive the first mouse click when the click also makes the druid window active.
When you open the macOS calculator, switch to another app, then click a calculator button it will register the click even though it wasn't active. This does not work with the druid calculator example. With this PRs change applied, the druid calculator will also receive the click event.