]> khamidou — GitHub mirrors - electron.git/commitdiff
alias move and moved event on OS X
authordeepak1556 <hop2deep@gmail.com>
Wed, 20 May 2015 08:37:13 +0000 (14:07 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Fri, 22 May 2015 06:54:12 +0000 (12:24 +0530)
atom/browser/api/atom_api_window.cc
atom/browser/api/atom_api_window.h
atom/browser/native_window.cc
atom/browser/native_window.h
atom/browser/native_window_mac.mm
atom/browser/native_window_observer.h
atom/browser/native_window_views.cc
docs/api/browser-window.md

index f7f6c7239fef3dba853b11510ce35c21ae7e782e..4e3aadd47ba5384982bd2d28eed7c961b77697f1 100644 (file)
@@ -132,6 +132,10 @@ void Window::OnWindowMove() {
   Emit("move");
 }
 
+void Window::OnWindowMoved() {
+  Emit("moved");
+}
+
 void Window::OnWindowEnterFullScreen() {
   Emit("enter-full-screen");
 }
index efe196bd55fc9aaf67d1c871ce92ed3b6308f9f7..f9c85e75fef96760990c9fdca7c0672e1cea620d 100644 (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;
index 9bc97d5d192e01169e6d7640f5f955f9ca647fa4..dd1a389228c6432b2aacc1eadf4784173e67a6df 100644 (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());
index 7f72ebdf5e02c65e0dd807bc40f03250081d623e..d95f7faf9178bf9989ae30a18fd552bf8b3e607b 100644 (file)
@@ -209,6 +209,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
   void NotifyWindowRestore();
   void NotifyWindowMove();
   void NotifyWindowResize();
+  void NotifyWindowMoved();
   void NotifyWindowEnterFullScreen();
   void NotifyWindowLeaveFullScreen();
   void NotifyWindowEnterHtmlFullScreen();
index 6a21f33b2ffc50122ac8491c401c3960ce361d4a..8130d2c0fedd42e0bc80ded9d763ccac03fda242 100644 (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 {
index 1db1fed7cbfa2ccb228fbde516392a3668181fa5..417731fb3474b15f931d159d0b3e910c1ab2ebcf 100644 (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() {}
index 630c7e086f60bbde85b24ae13af4cafa05b3a4a0..69c595f1df464d2912a8c1166526cce767a9f037 100644 (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);
 
index 00e2ceb46945350acf47c7248b11bbee6adf5d41..5476275bd502fbf8f47f9b9a24627978ac5f4d5e 100644 (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'