Skip to content
New issue

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

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

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

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

- (BOOL)shouldIgnoreMouseEvent {
Expand All @@ -81,16 +82,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 @@ -102,7 +102,7 @@ - (void)mouseDown:(NSEvent*)event {
}

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

Expand Down