mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: add Chromium patch to fix RTL window buttons (#22016)
Classes that inherit from `NSThemeFrame` seem to show window buttons in the incorrect position when the primary MacOS language is set to an RTL (right-to-left) language like Arabic or Hebrew. The fix in this commit mirrors that of `tabbed_browser_window.mm` (https://chromium-review.googlesource.com/c/chromium/src/+/562603/10/chrome/browser/ui/cocoa/tabbed_browser_window.mm#88). This change should be upstreamed, and then this patch can be removed.
This commit is contained in:
@@ -81,3 +81,4 @@ feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch
|
||||
accessible_pane_view.patch
|
||||
fixme_grit_conflicts.patch
|
||||
fix_use_the_new_mediaplaypause_key_listener_for_internal_chrome.patch
|
||||
fix_use_native_window_button_positions_when_macos_locale_is_rtl.patch
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sesh Sadasivam <sesh@fb.com>
|
||||
Date: Fri, 31 Jan 2020 19:02:27 -0800
|
||||
Subject: fix: use native window button positions when MacOS locale is RTL
|
||||
|
||||
Classes that inherit from `NSThemeFrame` seem to show window buttons in the
|
||||
incorrect position when the primary MacOS language is set to an RTL
|
||||
(right-to-left) language like Arabic or Hebrew. The fix in this commit mirrors
|
||||
that of `tabbed_browser_window.mm`
|
||||
(https://chromium-review.googlesource.com/c/chromium/src/+/562603/10/chrome/browser/ui/cocoa/tabbed_browser_window.mm#88).
|
||||
|
||||
This change should be upstreamed, and then this patch can be removed.
|
||||
|
||||
diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
|
||||
index 9905e1c8914f852e250480797f43d17bf9d7f794..0016cc129805726d6518036fb181a2a9715af8c5 100644
|
||||
--- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
|
||||
+++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
|
||||
@@ -69,6 +69,13 @@ - (void)mouseDown:(NSEvent*)event {
|
||||
- (BOOL)usesCustomDrawing {
|
||||
return NO;
|
||||
}
|
||||
+// AppKit's implementation only returns YES if [self class] == [NSThemeFrame
|
||||
+// class]. See:
|
||||
+// https://chromium-review.googlesource.com/c/chromium/src/+/562603/10/chrome/browser/ui/cocoa/tabbed_browser_window.mm#88
|
||||
+- (BOOL)_shouldFlipTrafficLightsForRTL API_AVAILABLE(macosx(10.13)) {
|
||||
+ return self.window.windowTitlebarLayoutDirection ==
|
||||
+ NSUserInterfaceLayoutDirectionRightToLeft;
|
||||
+}
|
||||
@end
|
||||
|
||||
@implementation NativeWidgetMacNSWindowBorderlessFrame
|
||||
Reference in New Issue
Block a user