# HG changeset patch
# User Yevgen Muntyan <muntyan@fastmail.fm>
# Date 1449479024 28800
# Node ID 16077941410b8aff37c9485fc97e6d34dd789a31
# Parent  eaddf57bc107bd4ab350a4023dc4ea640a4c868a
Handle vertically maximized window state from Windows 7

diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -1128,7 +1128,7 @@
     {
       ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNOACTIVATE);
     }
-  else
+  else if (!IsWindowVisible (GDK_WINDOW_HWND (window)))
     {
       ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
     }
@@ -3585,6 +3585,8 @@
 gdk_window_focus (GdkWindow *window,
                   guint32    timestamp)
 {
+  GdkWindowObject *private = (GdkWindowObject *) window;
+
   g_return_if_fail (GDK_IS_WINDOW (window));
 
   if (GDK_WINDOW_DESTROYED (window))
@@ -3594,10 +3596,13 @@
 			   GDK_WINDOW_HWND (window),
 			   _gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
 
-  if (((GdkWindowObject *) window)->state & GDK_WINDOW_STATE_MAXIMIZED)
+  if (private->state & GDK_WINDOW_STATE_MAXIMIZED)
     ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWMAXIMIZED);
-  else
+  else if (private->state & GDK_WINDOW_STATE_ICONIFIED)
+    ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
+  else if (!IsWindowVisible (GDK_WINDOW_HWND (window)))
     ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
+
   SetFocus (GDK_WINDOW_HWND (window));
 }
 
