mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
alias move and moved event on OS X
This commit is contained in:
@@ -132,6 +132,10 @@ void Window::OnWindowMove() {
|
||||
Emit("move");
|
||||
}
|
||||
|
||||
void Window::OnWindowMoved() {
|
||||
Emit("moved");
|
||||
}
|
||||
|
||||
void Window::OnWindowEnterFullScreen() {
|
||||
Emit("enter-full-screen");
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ class Window : public mate::EventEmitter,
|
||||
void OnWindowRestore() override;
|
||||
void OnWindowResize() override;
|
||||
void OnWindowMove() override;
|
||||
void OnWindowMoved() override;
|
||||
void OnWindowEnterFullScreen() override;
|
||||
void OnWindowLeaveFullScreen() override;
|
||||
void OnWindowEnterHtmlFullScreen() override;
|
||||
|
||||
@@ -543,6 +543,10 @@ void NativeWindow::NotifyWindowMove() {
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowMove());
|
||||
}
|
||||
|
||||
void NativeWindow::NotifyWindowMoved() {
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowMoved());
|
||||
}
|
||||
|
||||
void NativeWindow::NotifyWindowEnterFullScreen() {
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
||||
OnWindowEnterFullScreen());
|
||||
|
||||
@@ -209,6 +209,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||
void NotifyWindowRestore();
|
||||
void NotifyWindowMove();
|
||||
void NotifyWindowResize();
|
||||
void NotifyWindowMoved();
|
||||
void NotifyWindowEnterFullScreen();
|
||||
void NotifyWindowLeaveFullScreen();
|
||||
void NotifyWindowEnterHtmlFullScreen();
|
||||
|
||||
@@ -103,7 +103,10 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
|
||||
}
|
||||
|
||||
- (void)windowDidMove:(NSNotification*)notification {
|
||||
// TODO(zcbenz): Remove the alias after figuring out a proper
|
||||
// way to disptach move.
|
||||
shell_->NotifyWindowMove();
|
||||
shell_->NotifyWindowMoved();
|
||||
}
|
||||
|
||||
- (void)windowDidMiniaturize:(NSNotification*)notification {
|
||||
|
||||
@@ -49,6 +49,7 @@ class NativeWindowObserver {
|
||||
virtual void OnWindowRestore() {}
|
||||
virtual void OnWindowResize() {}
|
||||
virtual void OnWindowMove() {}
|
||||
virtual void OnWindowMoved() {}
|
||||
virtual void OnWindowEnterFullScreen() {}
|
||||
virtual void OnWindowLeaveFullScreen() {}
|
||||
virtual void OnWindowEnterHtmlFullScreen() {}
|
||||
|
||||
@@ -176,6 +176,7 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents,
|
||||
options.Get(switches::kWidth, &width);
|
||||
options.Get(switches::kHeight, &height);
|
||||
gfx::Rect bounds(0, 0, width, height);
|
||||
widget_size_ = bounds.size();
|
||||
|
||||
window_->AddObserver(this);
|
||||
|
||||
|
||||
@@ -173,12 +173,15 @@ Emitted when window is restored from minimized state.
|
||||
|
||||
### Event: 'resize'
|
||||
|
||||
Emitted when window is getting resized on all platforms.
|
||||
Emitted when window is getting resized.
|
||||
|
||||
### Event: 'move'
|
||||
|
||||
Emitted once when the window is moved to a new position on `OSX` and emitted during the process
|
||||
of moving on `Linux` and `Windows`.
|
||||
Emitted when the window is getting moved to a new position.
|
||||
|
||||
### Event: 'moved'
|
||||
|
||||
Emitted once when the window is moved to a new position.
|
||||
|
||||
### Event: 'enter-full-screen'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user