- Move the window showing/hiding notifications from co_WinPosShowWindow to co_WinPosS...
authorFilip Navara <filip.navara@gmail.com>
Mon, 19 Sep 2005 07:35:31 +0000 (07:35 +0000)
committerFilip Navara <filip.navara@gmail.com>
Mon, 19 Sep 2005 07:35:31 +0000 (07:35 +0000)
- Call the redraw routine on parent window if possible in co_WinPosSetWindowPos. Should fix bug #735.

svn path=/trunk/; revision=17928

reactos/subsys/win32k/ntuser/winpos.c

index 6a1aafb..be04b9d 100644 (file)
@@ -1064,10 +1064,20 @@ co_WinPosSetWindowPos(
       /* Clear the update region */
       co_UserRedrawWindow(Window, NULL, 0, RDW_VALIDATE | RDW_NOFRAME |
                           RDW_NOERASE | RDW_NOINTERNALPAINT | RDW_ALLCHILDREN);
+      if ((Window->Style & WS_VISIBLE) &&
+          Window->Parent == UserGetDesktopWindow())
+      {
+         co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Window->hSelf);
+      }
       Window->Style &= ~WS_VISIBLE;
    }
    else if (WinPos.flags & SWP_SHOWWINDOW)
    {
+      if (!(Window->Style & WS_VISIBLE) &&
+          Window->Parent == UserGetDesktopWindow())
+      {
+         co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->hSelf);
+      }
       Window->Style |= WS_VISIBLE;
    }
 
@@ -1199,11 +1209,22 @@ co_WinPosSetWindowPos(
          }
          if (RgnType != ERROR && RgnType != NULLREGION)
          {
-            NtGdiOffsetRgn(DirtyRgn,
-                           Window->WindowRect.left - Window->ClientRect.left,
-                           Window->WindowRect.top - Window->ClientRect.top);
-            co_UserRedrawWindow(Window, NULL, DirtyRgn,
-                                RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
+            if (Window->Parent)
+            {
+               NtGdiOffsetRgn(DirtyRgn,
+                  Window->WindowRect.left - Window->Parent->ClientRect.left,
+                  Window->WindowRect.top - Window->Parent->ClientRect.top);
+               co_UserRedrawWindow(Window->Parent, NULL, DirtyRgn,
+                  RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
+            }
+            else
+            {
+               NtGdiOffsetRgn(DirtyRgn,
+                  Window->WindowRect.left - Window->ClientRect.left,
+                  Window->WindowRect.top - Window->ClientRect.top);
+               co_UserRedrawWindow(Window, NULL, DirtyRgn,
+                  RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
+            }
          }
          NtGdiDeleteObject(DirtyRgn);
       }
@@ -1363,14 +1384,6 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
    if (ShowFlag != WasVisible)
    {
       co_IntSendMessage(Window->hSelf, WM_SHOWWINDOW, ShowFlag, 0);
-      /*
-       * FIXME: Need to check the window wasn't destroyed during the
-       * window procedure.
-       */
-      if (!(Window->Parent))
-      {
-         co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->hSelf);
-      }
    }
 
    /* We can't activate a child window */
@@ -1409,11 +1422,6 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
          //faxme: as long as we have ref on Window, we also, indirectly, have ref on parent...
          co_UserSetFocus(Window->Parent);
       }
-
-      if (!(Window->Parent))
-      {
-         co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Window->hSelf);
-      }
    }
 
    /* FIXME: Check for window destruction. */