Skip to content

Fix TAB & ESC key bindings not working in main player & music mode windows (fixes #4465) #4464

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

Merged
merged 1 commit into from
Jul 15, 2023

Conversation

svobs
Copy link
Contributor

@svobs svobs commented Jun 15, 2023


Description:
Uses NSWindow subclasses for MainWindow and MiniPlayerWIndow, and overrides keyDown() so that it bypasses MacOS's built-in diversion of the TAB & ESC keys for keyboard navigation, which IINA does not desire to use for these windows. This allows TAB and ESC key bindings to work. (Note that ESC was working for MainWindow due to a workaround, but not MiniPlayerWIndow; while TAB was not working for either).

I ended up duplicating the code for keyDown() in each window class, because I found I needed separate subclasses for each window which inherited directly from NSWindow. Originally I tried to create a common base class which inherited from NSWindow, and then have both windows inherit from that, but that didn't seem to work.

Removes the workaround for ESC from MainWindow, because it's no longer needed. Removes the workaround for sending SPACE from PlaylistViewController, because it now was sending a second unwanted space.

One wrinkle with this solution is that it drew a focus ring around either the Playlist or Chapters tab button because it was detected as the first responder. I was unable to find a way to say "no first responder please", but setting refusesFirstResponder="YES" for each of these got rid of the focus rings.

…ndows. Remove previous workarounds for ESC & SPACE since they are no longer necessary.
@svobs svobs changed the title Fix TAB & ESC key bindings not working in main player & music mode windows Fix TAB & ESC key bindings not working in main player & music mode windows (fixes #4465) Jun 15, 2023
@low-batt low-batt linked an issue Jun 16, 2023 that may be closed by this pull request
1 task
@uiryuu uiryuu merged commit 0bc3691 into iina:develop Jul 15, 2023
@uiryuu
Copy link
Member

uiryuu commented Jul 15, 2023

Tested and worked. Thanks!

@lhc70000
Copy link
Member

lhc70000 commented Aug 8, 2023

I found that after this commit, any menu item with key equivalent that

  1. is not a mpv keybinding, and
  2. doesn't contain Command (e.g. D or Option+D, but not Cmd+Option+D)

will not work anymore.

If this is a mpv keybinding, IINA can still trigger the action when it's passed to the main window, however there are still some menu items with user-defined non-mpv key shortcuts, for example, custom filters and menus added by plugins.

I'm finding a solution right now.

lhc70000 added a commit that referenced this pull request Aug 14, 2023
* Plugin: Add input API

* Add getAllKeyBindings API, provide default priority values

* Fix some menu items not working after commit 0bc3691 (#4464)

* Add back the ability to handle mouseDown and mouseDrag
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.

TAB key doesn't work in player window
3 participants