cef/patch/patches/mac_render_widget_3680.patch
Nik Pavlov 5d817b20a6 Update to Chromium version 131.0.6768.0 (#1366576)
mac: Switch to Xcode 16.0 16A242d with macOS SDK 15.0 24A336
2024-10-24 11:24:17 -04:00

35 lines
1.2 KiB
Diff

diff --git content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
index f7ead5e49e4ba..85fb9738cd980 100644
--- content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
+++ content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
@@ -171,6 +171,13 @@ void ExtractUnderlines(NSAttributedString* string,
// RenderWidgetHostViewCocoa ---------------------------------------------------
+@interface NSWindow (CefCustomMethods)
+- (int)acceptsFirstMouse;
+@end
+
+constexpr int kStateEnabled = 1;
+constexpr int kStateDisabled = 2;
+
// Private methods:
@interface RenderWidgetHostViewCocoa ()
@@ -767,6 +774,15 @@ void ExtractUnderlines(NSAttributedString* string,
}
- (BOOL)acceptsFirstMouse:(NSEvent*)theEvent {
+ if ([self.window respondsToSelector:@selector(acceptsFirstMouse)]) {
+ const auto mode = [self.window acceptsFirstMouse];
+ if (mode == kStateEnabled) {
+ return YES;
+ } else if (mode == kStateDisabled) {
+ return NO;
+ }
+ }
+
// Enable "click-through" if mouse clicks are accepted in inactive windows
return [self acceptsMouseEventsOption] > kAcceptMouseEventsInActiveWindow;
}