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"); Emit("move");
} }
void Window::OnWindowMoved() {
Emit("moved");
}
void Window::OnWindowEnterFullScreen() { void Window::OnWindowEnterFullScreen() {
Emit("enter-full-screen"); Emit("enter-full-screen");
} }

View file

@ -66,6 +66,7 @@ class Window : public mate::EventEmitter,
void OnWindowRestore() override; void OnWindowRestore() override;
void OnWindowResize() override; void OnWindowResize() override;
void OnWindowMove() override; void OnWindowMove() override;
void OnWindowMoved() override;
void OnWindowEnterFullScreen() override; void OnWindowEnterFullScreen() override;
void OnWindowLeaveFullScreen() override; void OnWindowLeaveFullScreen() override;
void OnWindowEnterHtmlFullScreen() override; void OnWindowEnterHtmlFullScreen() override;

View file

@ -543,6 +543,10 @@ void NativeWindow::NotifyWindowMove() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowMove()); FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowMove());
} }
void NativeWindow::NotifyWindowMoved() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowMoved());
}
void NativeWindow::NotifyWindowEnterFullScreen() { void NativeWindow::NotifyWindowEnterFullScreen() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
OnWindowEnterFullScreen()); OnWindowEnterFullScreen());

View file

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

View file

@ -103,7 +103,10 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
} }
- (void)windowDidMove:(NSNotification*)notification { - (void)windowDidMove:(NSNotification*)notification {
// TODO(zcbenz): Remove the alias after figuring out a proper
// way to disptach move.
shell_->NotifyWindowMove(); shell_->NotifyWindowMove();
shell_->NotifyWindowMoved();
} }
- (void)windowDidMiniaturize:(NSNotification*)notification { - (void)windowDidMiniaturize:(NSNotification*)notification {

View file

@ -49,6 +49,7 @@ class NativeWindowObserver {
virtual void OnWindowRestore() {} virtual void OnWindowRestore() {}
virtual void OnWindowResize() {} virtual void OnWindowResize() {}
virtual void OnWindowMove() {} virtual void OnWindowMove() {}
virtual void OnWindowMoved() {}
virtual void OnWindowEnterFullScreen() {} virtual void OnWindowEnterFullScreen() {}
virtual void OnWindowLeaveFullScreen() {} virtual void OnWindowLeaveFullScreen() {}
virtual void OnWindowEnterHtmlFullScreen() {} virtual void OnWindowEnterHtmlFullScreen() {}

View file

@ -176,6 +176,7 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents,
options.Get(switches::kWidth, &width); options.Get(switches::kWidth, &width);
options.Get(switches::kHeight, &height); options.Get(switches::kHeight, &height);
gfx::Rect bounds(0, 0, width, height); gfx::Rect bounds(0, 0, width, height);
widget_size_ = bounds.size();
window_->AddObserver(this); window_->AddObserver(this);

View file

@ -173,12 +173,15 @@ Emitted when window is restored from minimized state.
### Event: 'resize' ### Event: 'resize'
Emitted when window is getting resized on all platforms. Emitted when window is getting resized.
### Event: 'move' ### Event: 'move'
Emitted once when the window is moved to a new position on `OSX` and emitted during the process Emitted when the window is getting moved to a new position.
of moving on `Linux` and `Windows`.
### Event: 'moved'
Emitted once when the window is moved to a new position.
### Event: 'enter-full-screen' ### Event: 'enter-full-screen'