electron/patches/chromium/render_widget_host_view_mac.patch
electron-roller[bot] 5261e08d0c
chore: bump chromium to 113.0.5660.0 (main) (#37612)
* chore: bump chromium in DEPS to 113.0.5657.0

* chore: bump chromium in DEPS to 113.0.5660.0

* chore: update patches

printing.patch
https://chromium-review.googlesource.com/c/chromium/src/+/4347664
https://chromium-review.googlesource.com/c/chromium/src/+/4347664
https://chromium-review.googlesource.com/c/chromium/src/+/4338810
https://chromium-review.googlesource.com/c/chromium/src/+/4339496

mas_disable_remote_layer.patch
https://chromium-review.googlesource.com/c/chromium/src/+/4334544
https://chromium-review.googlesource.com/c/chromium/src/+/4335299

* Add API to verify `TOP_LEVEL_STORAGE_ACCESS` permission status

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

* Move os_crypt into a sync/ subdirectory.

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

* chore: generate libc++ headers

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2023-03-20 07:06:57 -04:00

87 lines
3.3 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`.
Additionally, disables usage of some private APIs in MAS builds.
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 179badac1553e4692022347fbfb22c57e9d00527..949f9a615d1842be4be496a4523411aa4e97a3a6 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
@@ -155,6 +155,15 @@ void ExtractUnderlines(NSAttributedString* string,
} // namespace
+@interface NSWindow (AtomCustomMethods)
+- (BOOL)acceptsFirstMouse;
+- (BOOL)disableAutoHideCursor;
+@end
+
+@interface NSView (ElectronCustomMethods)
+- (BOOL)shouldIgnoreMouseEvent;
+@end
+
// RenderWidgetHostViewCocoa ---------------------------------------------------
// Private methods:
@@ -594,6 +603,9 @@ - (BOOL)acceptsMouseEventsWhenInactive {
}
- (BOOL)acceptsFirstMouse:(NSEvent*)theEvent {
+ if ([self.window respondsToSelector:@selector(acceptsFirstMouse)] &&
+ [self.window acceptsFirstMouse])
+ return YES;
return [self acceptsMouseEventsWhenInactive];
}
@@ -670,6 +682,10 @@ - (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] &&
@@ -989,6 +1005,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, latency_info);
@@ -1801,9 +1821,11 @@ - (NSAccessibilityRole)accessibilityRole {
// Since this implementation doesn't have to wait any IPC calls, this doesn't
// make any key-typing jank. --hbono 7/23/09
//
+#if !IS_MAS_BUILD()
extern "C" {
extern NSString* NSTextInputReplacementRangeAttributeName;
}
+#endif
- (NSArray*)validAttributesForMarkedText {
// This code is just copied from WebKit except renaming variables.
@@ -1812,7 +1834,10 @@ - (NSArray*)validAttributesForMarkedText {
initWithObjects:NSUnderlineStyleAttributeName,
NSUnderlineColorAttributeName,
NSMarkedClauseSegmentAttributeName,
- NSTextInputReplacementRangeAttributeName, nil]);
+#if !IS_MAS_BUILD()
+ NSTextInputReplacementRangeAttributeName,
+#endif
+ nil]);
}
return _validAttributesForMarkedText.get();
}