8000 fix: BrowserView drag now delegates to the OS when possible by trop[bot] · Pull Request #31178 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: BrowserView drag now delegates to the OS when possible #31178

New issue 8000

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions shell/browser/native_browser_view_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ + (void)load {
}

- (BOOL)mouseDownCanMoveWindow {
return NO;
return
[self.window respondsToSelector:@selector(performWindowDragWithEvent:)];
}

- (BOOL)acceptsFirstMouse:(NSEvent*)event {
Expand All @@ -85,16 +86,15 @@ - (NSView*)hitTest:(NSPoint)point {
- (void)mouseDown:(NSEvent*)event {
[super mouseDown:event];

if ([self.window respondsToSelector:@selector(performWindowDragWithEvent)]) {
if ([self.window respondsToSelector:@selector(performWindowDragWithEvent:)]) {
// According to Google, using performWindowDragWithEvent:
// does not generate a NSWindowWillMoveNotification. Hence post one.
[[NSNotificationCenter defaultCenter]
postNotificationName:NSWindowWillMoveNotification
object:self];

if (@available(macOS 10.11, *)) {
[self.window performWindowDragWithEvent:event];
}
[self.window performWindowDragWithEvent:event];

return;
}

Expand All @@ -106,7 +106,7 @@ - (void)mouseDown:(NSEvent*)event {
}

- (void)mouseDragged:(NSEvent*)event {
if ([self.window respondsToSelector:@selector(performWindowDragWithEvent)]) {
if ([self.window respondsToSelector:@selector(performWindowDragWithEvent:)]) {
return;
}

Expand Down
0