mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
mac: views: Add customization point for acceptsFirstMouse (fixes #3680)
This commit is contained in:
committed by
Marshall Greenblatt
parent
96dc172980
commit
744a194a6e
@@ -752,5 +752,10 @@ patches = [
|
||||
# https://github.com/chromiumembedded/cef/issues/3610
|
||||
# https://issues.chromium.org/issues/40280130#comment7
|
||||
'name': 'linux_gtk_theme_3610'
|
||||
},
|
||||
{
|
||||
# views: mac: Add customization point to acceptsFirstMouse.
|
||||
# https://github.com/chromiumembedded/cef/issues/3680
|
||||
'name': 'mac_render_widget_3680'
|
||||
}
|
||||
]
|
||||
|
33
patch/patches/mac_render_widget_3680.patch
Normal file
33
patch/patches/mac_render_widget_3680.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
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 5649f120ccefa..c6c1a676a24cf 100644
|
||||
--- content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
+++ content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
@@ -164,6 +164,13 @@ void ExtractUnderlines(NSAttributedString* string,
|
||||
|
||||
// RenderWidgetHostViewCocoa ---------------------------------------------------
|
||||
|
||||
+@interface NSWindow (CefCustomMethods)
|
||||
+- (int)acceptsFirstMouse;
|
||||
+@end
|
||||
+
|
||||
+constexpr int kStateEnabled = 1;
|
||||
+constexpr int kStateDisabled = 2;
|
||||
+
|
||||
// Private methods:
|
||||
@interface RenderWidgetHostViewCocoa ()
|
||||
|
||||
@@ -744,6 +751,14 @@ 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;
|
||||
+ }
|
||||
+ }
|
||||
return [self acceptsMouseEventsWhenInactive];
|
||||
}
|
||||
|
Reference in New Issue
Block a user