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

Fix RTL language causes OSC to malfunction, #4878 #4879

Merged
merged 1 commit into from May 25, 2024
Merged

Fix RTL language causes OSC to malfunction, #4878 #4879

merged 1 commit into from May 25, 2024

Conversation

low-batt
Copy link
Contributor

@low-batt low-batt commented Apr 13, 2024

This commit will:

  • Add initializers to TimeLabelOverflowedStackView, TimeLabelOverflowedView and TouchBarPlaySliderCell that set userInterfaceLayoutDirection to be leftToRight
  • Change MainWindowController.windowDidLoad to set the userInterfaceLayoutDirection property of fragControlView and oscFloatingTopView to be leftToRight
  • Change constraints from leading/trailing to left/right for several OSC components to prevent them from moving when a RTL language is used
  • Change MainWindowController methods mouseDown and mouseDragged to take into account the userInterfaceLayoutDirection setting during playlist resizing
  • Change ControlBarView.mouseDragged to take into account the userInterfaceLayoutDirection setting when repositioning the floating OSC
  • Rename the play property in the Constants struct to be blackRightPointingTriangle
  • Add a blackLeftPointingTriangle property to the Constants struct
  • Change PlaylistViewController.tableView to use a right or left arrow based on the userInterfaceLayoutDirection setting
  • Change the language-direction of the pip and volume related icons and the playlist icon from Fixed to Left to Right, Mirrors

This adjusts IINA's behavior to match Apple's guidance that video controls and timeline indicators should not flip in a right-to-left language. Other controls, such as the volume control and the pip and playlist buttons are flipped for RTL languages.

This also corrects problems dragging the floating OSC and resizing the playlist when a right to left language is configured.


Description:

@low-batt low-batt linked an issue Apr 13, 2024 that may be closed by this pull request
1 task
@low-batt
Copy link
Contributor Author

Found another problem. Dragging the floating OSC is messed up. Putting this in draft mode until I can fix that.

This commit will:
- Add initializers to TimeLabelOverflowedStackView,
  TimeLabelOverflowedView and TouchBarPlaySliderCell that set
  userInterfaceLayoutDirection to be leftToRight
- Change MainWindowController.windowDidLoad to set the
  userInterfaceLayoutDirection property of fragControlView and
  oscFloatingTopView to be leftToRight
- Change constraints from leading/trailing to left/right for several OSC
  components to prevent them from moving when a RTL language is used
- Change MainWindowController methods mouseDown and mouseDragged to take
  into account the userInterfaceLayoutDirection setting during playlist
  resizing
- Change ControlBarView.mouseDragged to take into account the
  userInterfaceLayoutDirection setting when repositioning the floating
  OSC
- Rename the play property in the Constants struct to be
  blackRightPointingTriangle
- Add a blackLeftPointingTriangle property to the Constants struct
- Change PlaylistViewController.tableView to use a right or left arrow
  based on the userInterfaceLayoutDirection setting
- Change the language-direction of the pip and volume related icons and
  the playlist icon from Fixed to Left to Right, Mirrors

This adjusts IINA's behavior to match Apple's guidance that video
controls and timeline indicators should not flip in a right-to-left
language. Other controls, such as the volume control and the pip and
playlist buttons are flipped for RTL languages.

This also corrects problems dragging the floating OSC and resizing the
playlist when a right to left language is configured.
@uiryuu
Copy link
Member

uiryuu commented May 24, 2024

The changes look harmless. If @ShlomoCode agrees to all the changes, then we can merge.

@ShlomoCode
Copy link

ShlomoCode commented May 24, 2024

I've actually been using a local build of these changes for a few weeks now, and it's working great. One thing I feel uncomfortable with is the order of the custom buttons, discussed in this comment and below and was not decided: #4878 (comment)

Another little thing is this icon:
CleanShot 2024-05-24 at 07 31 25@2x
Its direction is determined by the language of the application, but it should be determined by the language of the operating system, because it is the system language that determines the PIP location.
That is, in case the system language is RTL, even if the language defined for the application is LTR, the PIP will open on the left side, and vice versa.

@uiryuu uiryuu changed the base branch from develop to enable-he May 25, 2024 01:04
@uiryuu uiryuu merged commit 3c165f3 into enable-he May 25, 2024
1 check passed
@uiryuu uiryuu deleted the he-osc branch May 25, 2024 01:04
@ShlomoCode
Copy link

🤔

@uiryuu
Copy link
Member

uiryuu commented May 26, 2024

@ShlomoCode Please try the latest version on enable-he branch and report anything looks incorrect and file an issue.

Screenshot 2024-05-26 at 9 36 54

The custom buttons are on the left now.

As for the PIP button direction problem, please file another issue for that, thank you!

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.

RTL language causes OSC to malfunction
3 participants