Files
electron/patches/chromium/render_widget_host_view_mac.patch
electron-roller[bot] a22511a196 chore: bump chromium to 144.0.7514.0 (main) (#48840)
* chore: bump chromium in DEPS to 144.0.7514.0

* chore: update patches

* 7119882: Reorganize //ui/gfx GN build target

https://chromium-review.googlesource.com/c/chromium/src/+/7119882

* Replace includes with forward declares in rect_conversions.h

https://chromium-review.googlesource.com/c/chromium/src/+/7127098

* Add ssl info to TrustedHeaderClient

https://chromium-review.googlesource.com/c/chromium/src/+/7106780

* Replace ContentPluginInfo with WebPluginInfo

https://chromium-review.googlesource.com/c/chromium/src/+/7127893

* Reland "[temporal] Unflag Temporal"

https://chromium-review.googlesource.com/c/v8/v8/+/7123876

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-11-10 13:27:35 +01:00

61 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
Date: Thu, 20 Sep 2018 17:46:28 -0700
Subject: render_widget_host_view_mac.patch
This allows Electron to override `acceptsFirstMouse` on Mac so that windows can
respond to the first mouse click in their window, which is desirable for some
kinds of utility windows. Similarly for `disableAutoHideCursor`.
diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
index b17bc8928cc86536fa01bd85b921020a2c656ca3..f69cd6100f2ac5ccb6f185e0d0bf186073ed5953 100644
--- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
+++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
@@ -167,6 +167,15 @@ void ExtractUnderlines(NSAttributedString* string,
} // namespace
+@interface NSWindow (AtomCustomMethods)
+- (BOOL)acceptsFirstMouse;
+- (BOOL)disableAutoHideCursor;
+@end
+
+@interface NSView (ElectronCustomMethods)
+- (BOOL)shouldIgnoreMouseEvent;
+@end
+
// RenderWidgetHostViewCocoa ---------------------------------------------------
// Private methods:
@@ -781,6 +790,10 @@ - (AcceptMouseEvents)acceptsMouseEventsOption {
}
- (BOOL)acceptsFirstMouse:(NSEvent*)theEvent {
+ if ([self.window respondsToSelector:@selector(acceptsFirstMouse)] &&
+ [self.window acceptsFirstMouse])
+ return YES;
+
// Enable "click-through" if mouse clicks are accepted in inactive windows.
return
[self acceptsMouseEventsOption] > AcceptMouseEvents::kWhenInActiveWindow;
@@ -933,6 +946,8 @@ - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent {
// its parent view.
BOOL hitSelf = NO;
while (view) {
+ if ([view respondsToSelector:@selector(shouldIgnoreMouseEvent)] && ![view shouldIgnoreMouseEvent])
+ return NO;
if (view == self)
hitSelf = YES;
if ([view isKindOfClass:[self class]] && ![view isEqual:self] &&
@@ -1267,6 +1282,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv {
eventType == NSEventTypeKeyDown &&
!(modifierFlags & NSEventModifierFlagCommand);
+ if ([theEvent.window respondsToSelector:@selector(disableAutoHideCursor)] &&
+ [theEvent.window disableAutoHideCursor])
+ shouldAutohideCursor = NO;
+
// We only handle key down events and just simply forward other events.
if (eventType != NSEventTypeKeyDown) {
_hostHelper->ForwardKeyboardEvent(event, latencyInfo);