]> khamidou — GitHub mirrors - electron.git/commitdiff
views: Return restored bounds when window is minimized, fixes #473.
authorCheng Zhao <zcbenz@gmail.com>
Sat, 26 Jul 2014 06:03:37 +0000 (14:03 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Sat, 26 Jul 2014 06:20:50 +0000 (14:20 +0800)
On Window the minimized window would have a fake bounds that is out of
the screen, which is not consistent to other platforms' behavior.

atom/browser/native_window_views.cc

index 738a2577836940583131dea1727acfd054fbc534..b63b8ae463336b7f740bb8d9795d56061c511c76 100644 (file)
@@ -204,6 +204,11 @@ void NativeWindowViews::SetSize(const gfx::Size& size) {
 }
 
 gfx::Size NativeWindowViews::GetSize() {
+#if defined(OS_WIN)
+  if (IsMinimized())
+    return window_->GetRestoredBounds().size();
+#endif
+
   return window_->GetWindowBoundsInScreen().size();
 }
 
@@ -287,6 +292,11 @@ void NativeWindowViews::SetPosition(const gfx::Point& position) {
 }
 
 gfx::Point NativeWindowViews::GetPosition() {
+#if defined(OS_WIN)
+  if (IsMinimized())
+    return window_->GetRestoredBounds().origin();
+#endif
+
   return window_->GetWindowBoundsInScreen().origin();
 }