Skip to content
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

Fixing shift and exclusive mouse mode #472

Merged

Conversation

caffeinepills
Copy link
Collaborator

Fixes an issue with shift not being called correctly on multiple windows. It now follows where your keyboard is focused. Also resets shift state when the focus is lost (will be gained again if still being held on return to window)

Fix multiple issues with exclusive mode:

  1. If the window were to lose focus and you clicked in the title bar, the ClipCursor no longer was bound to the window, and the cursor was unhidden.
  2. Unable to drag and move the window.
  3. Unable to maximize/minimize the Window
  4. Unable to close the window with the X button.
  5. When mouse button is pushed down (not a click) on frame components, it would disappear.
  6. Mouse could sometimes go out of the bounds of the view area into the close and minimize button resulting in issues with the window.

Removed the raw input requiring the view_hwnd, it just goes off of where your keyboard has focus.

Added a raise exception to show information on possible NULL issue with the _view_hwnd.

Was tested in Windows 10. Any feedback and additional testing appreciated.

Note:
There is still an issue with random hierarchy issues where the mouse can become visible again in exclusive mode, if the window rapidly loses/gains focus, but it seems pretty rare. It seems some libraries (SDL2) just have a schedule that checks every so often if the ClipCursor area was superseded by another window and then re-applies it. Not sure we need to go that intensive on it.

@benmoran56
Copy link
Member

We probably don't need to get go as far as SDL just yet.

How do you feel about merging this in for now?

@caffeinepills
Copy link
Collaborator Author

It's fine merging in as is. This does fix the shift issue, and numerous exclusive mode issues to make it more usable.

It's not a perfect solution but I think it's good enough for most uses.

@benmoran56 benmoran56 merged commit a21ae0d into pyglet:pyglet-1.5-maintenance Oct 20, 2021
@caffeinepills caffeinepills deleted the window_fixes branch March 13, 2023 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants