Skip to content

Make open/save dialogs block window input while open (fixes #4583) #4590

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 2 commits into from
Jan 2, 2024

Conversation

svobs
Copy link
Contributor

@svobs svobs commented Aug 17, 2023


Description:

This fixes the use of arrow key navigation in the following open/save dialogs:

  1. "Load external audio file" (Audio Settings sidebar)
  2. "Load external subtitle" (Subtitles menu)
  3. "Load subtitle..." (Subtitles Settings sidebar)
  4. "Save downloaded subtitle" (Subtitles menu)

Some users were complaining that mpv bindings were getting activated in response to arrow keys when they wanted to use them to navigate within the file picker dialog. This ensures that they will work, but it comes at some cost. They now use Apple's tyrannical modal dialog state, which clings onto the window and won't let the user do anything with it until the dialog is dismissed. I'm not a fan, although using it is probably adheres more closely to Apple's HIG than using an independent window.

…w key navigation works inside them instead of activating menu items: (1) "Load external audio file", (2) "Load external subtitle" (Subtitles menu), (3) "Load subtitle..." (Quick Settings button), (4) "Save downloaded subtitle" (Subtitles menu)
@svobs svobs force-pushed the pr-player-window-modal-dialogs branch from 0b64733 to a9e0eb5 Compare August 17, 2023 08:01
@low-batt
Copy link
Contributor

I too am not a fan of sheets, but…

On the question of what the HIG has to say, Panels says:

In a macOS app, a panel typically floats above other open windows providing supplementary controls, options, or information related to the active window or current selection.

The HIG section on sheets can be found here.

I did not find the HIG that helpful. Looking at the behavior of TextEdit the convention seems to be that you use a floating panel for an operation that is not tied to a specific window, but if the operation is specific to a particular window then a sheet is used.

Applied to IINA that suggests operations such as loading an external subtitle file should be a sheet as it is to be applied to a specific window.

This certainly is a significant change that will be noticed by users.

The NSOpenPanel put up by AppDelegate.openFile does not exhibit the problem of passing key strokes to the player window. That panel is displayed using runModal.

As a side issue, that portion of the HIG also contains the following which IINA is violating:

Refer to panels by title in your interface and in help documentation. In menus, use the panel’s title without including the term panel: for example, “Show Fonts,” “Show Colors,” and “Show Inspector.”

Copy link
Contributor

@low-batt low-batt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The menu item Save Current Playlist… under the File menu still exhibits the the problem.

@low-batt low-batt requested a review from lhc70000 August 18, 2023 19:04
@svobs
Copy link
Contributor Author

svobs commented Aug 23, 2023

The NSOpenPanel put up by AppDelegate.openFile does not exhibit the problem of passing key strokes to the player window. That panel is displayed using runModal.

This is very interesting. I suppose it's a special case because its action is attached to AppDelegate and thus automagically considered to be an app-wide feature (maybe), rather than an action tied to a player window. However it blocks key events to all the windows in the app, which is even less desirable. I think I'd be happier with sheets if they were easier to resize vertically and move around - seems very unintuitive that you are expected to grab the title bar of the window behind it, the one which is otherwise blocked from all events.

The menu item Save Current Playlist… under the File menu still exhibits the the problem.

Added a new commit to include this.

As a side issue, that portion of the HIG also contains the following which IINA is violating:

Refer to panels by title in your interface and in help documentation. In menus, use the panel’s title without including the term panel: for example, “Show Fonts,” “Show Colors,” and “Show Inspector.”

Ah, do you mean that Load Subtitle..., et al, should be renamed Open Subtitle...? Yeah I think I agree with that - it would be more "Mac-like".

@low-batt
Copy link
Contributor

No, it was this part of the HIG requirement I was thinking of:

without including the term panel

Which means the menu item Show Video Panel and others are clearly in violation. Bummer. Right now I think we should pretend I did not notice this.

Copy link
Contributor

@low-batt low-batt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled latest commit and tested. Changes look good.

@low-batt
Copy link
Contributor

By the way I'm now using the GitHub CLI to checkout PRs:

gh pr checkout 4590

The CLI automatically handles the case where the author has forced pushed changes to the PR.

Copy link
Member

@uiryuu uiryuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the proposed the changes are reasonable.

@uiryuu uiryuu merged commit ac6d17c into iina:develop Jan 2, 2024
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.

Pressing arrow keys to move the cursor in some input fields affects playback
3 participants