зеркало из https://github.com/electron/electron.git
fix: BrowserView drag now delegates to the OS when possible (#31114)
This commit is contained in:
Родитель
4da66b9d68
Коммит
abf6f1cf78
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче