Fix TAB & ESC key bindings not working in main player & music mode windows (fixes #4465) #4464
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Uses
NSWindow
subclasses forMainWindow
andMiniPlayerWIndow
, and overrideskeyDown()
so that it bypasses MacOS's built-in diversion of theTAB
&ESC
keys for keyboard navigation, which IINA does not desire to use for these windows. This allowsTAB
andESC
key bindings to work. (Note thatESC
was working forMainWindow
due to a workaround, but notMiniPlayerWIndow
; whileTAB
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 fromNSWindow
. Originally I tried to create a common base class which inherited fromNSWindow
, and then have both windows inherit from that, but that didn't seem to work.Removes the workaround for
ESC
fromMainWindow
, because it's no longer needed. Removes the workaround for sendingSPACE
fromPlaylistViewController
, 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.