feat: implement will-move event on macOS (#19641)

This commit is contained in:
Erick Zhao 2019-08-20 07:53:43 -07:00 committed by Shelley Vohr
parent cd1b15a155
commit 145b4fae94
2 changed files with 14 additions and 2 deletions

View file

@ -138,6 +138,18 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
shell_->NotifyWindowResize();
}
- (void)windowWillMove:(NSNotification*)notification {
NSWindow* window = [notification object];
NSSize size = [[window contentView] frame].size;
NSRect new_bounds = NSMakeRect(window.frame.origin.x, window.frame.origin.y,
size.width, size.height);
bool prevent_default = false;
// prevent_default has no effect
shell_->NotifyWindowWillMove(gfx::ScreenRectFromNSRect(new_bounds),
&prevent_default);
}
- (void)windowDidMove:(NSNotification*)notification {
[super windowDidMove:notification];
// TODO(zcbenz): Remove the alias after figuring out a proper