fix: BrowserView drag now delegates to the OS when possible (#31114)

This commit is contained in:
Aidan Nulman 2021-09-28 15:12:22 -04:00 коммит произвёл GitHub
Родитель 4da66b9d68
Коммит abf6f1cf78
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -59,7 +59,8 @@ const NSAutoresizingMaskOptions kDefaultAutoResizingMask =
}
- (BOOL)mouseDownCanMoveWindow {
return NO;
return
[self.window respondsToSelector:@selector(performWindowDragWithEvent:)];
}
- (BOOL)acceptsFirstMouse:(NSEvent*)event {
@ -85,16 +86,15 @@ const NSAutoresizingMaskOptions kDefaultAutoResizingMask =
- (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];
}
return;
}
@ -106,7 +106,7 @@ const NSAutoresizingMaskOptions kDefaultAutoResizingMask =
}
- (void)mouseDragged:(NSEvent*)event {
if ([self.window respondsToSelector:@selector(performWindowDragWithEvent)]) {
if ([self.window respondsToSelector:@selector(performWindowDragWithEvent:)]) {
return;
}