alias move and moved event on OS X

This commit is contained in:
deepak1556 2015-05-20 14:07:13 +05:30
parent f46fcd158a
commit 9a60fde59b
8 changed files with 21 additions and 3 deletions

View file

@ -132,6 +132,10 @@ void Window::OnWindowMove() {
Emit("move");
}
void Window::OnWindowMoved() {
Emit("moved");
}
void Window::OnWindowEnterFullScreen() {
Emit("enter-full-screen");
}

View file

@ -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;

View file

@ -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());

View file

@ -209,6 +209,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
void NotifyWindowRestore();
void NotifyWindowMove();
void NotifyWindowResize();
void NotifyWindowMoved();
void NotifyWindowEnterFullScreen();
void NotifyWindowLeaveFullScreen();
void NotifyWindowEnterHtmlFullScreen();

View file

@ -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 {

View file

@ -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() {}

View file

@ -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);

View file

@ -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'