Author: fireball Date: Wed Dec 30 14:26:24 2009 New Revision: 44812
URL: http://svn.reactos.org/svn/reactos?rev=44812&view=rev Log: - Pass swp flags to SWM and cleanup usermode part of WindowPosChanged. - SWM: Silence debug prints. - SWM: Warn when the zorder change is requested but not performed (and window's zorder doesn't match the requested one). - SWM: Don't use SwmBringToFront in SwmShowWindow and make it respect the SWP_NOZORDER flag.
Modified: branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c branches/arwinss/reactos/include/reactos/win32k/rosuser.h branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db
Modified: branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c [iso-8859-1] Wed Dec 30 14:26:24 2009 @@ -892,9 +892,6 @@ const RECT *visible_rect, const RECT *valid_rects ) { RECT old_whole_rect, old_client_rect; - //RECT whole_rect = *visible_rect; - //RECT client_rect = *rectClient; - struct ntdrv_win_data *data = NTDRV_get_win_data(hwnd);
if (!data) return; @@ -939,22 +936,13 @@
/* Sync position change */ if (!(swp_flags & SWP_NOREDRAW)) // HACK: When removing this explorer's start menu start to appear partially. Investigate! - SwmPosChanged(hwnd, &data->whole_rect, &old_whole_rect); + SwmPosChanged(hwnd, &data->whole_rect, &old_whole_rect, insert_after, swp_flags);
/* Pass show/hide information to the window manager */ if (swp_flags & SWP_SHOWWINDOW) - { - if (swp_flags & SWP_NOZORDER) FIXME("no zorder change for hwnd %x, ignoring!\n", hwnd); - //if (swp_flags & SWP_NOACTIVATE) FIXME("no activate change, ignoring!\n"); - - //SwmSetForeground(hwnd); - SwmShowWindow(hwnd, TRUE); - } + SwmShowWindow(hwnd, TRUE, swp_flags); else if (swp_flags & SWP_HIDEWINDOW) - SwmShowWindow(hwnd, FALSE); - -// visible: 0x1843, hide: 0x1883. 1843 = 1 + 2 + 64 + 2048 + 4096 - //RosDrv_UpdateZOrder(hwnd, (RECT*)visible_rect); + SwmShowWindow(hwnd, FALSE, swp_flags); }
/* EOF */
Modified: branches/arwinss/reactos/include/reactos/win32k/rosuser.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/reactos/... ============================================================================== --- branches/arwinss/reactos/include/reactos/win32k/rosuser.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/reactos/win32k/rosuser.h [iso-8859-1] Wed Dec 30 14:26:24 2009 @@ -169,12 +169,12 @@ SwmPosChanging(HWND hWnd, const RECT *WindowRect);
VOID NTAPI -SwmPosChanged(HWND hWnd, const RECT *WindowRect, const RECT *OldRect); +SwmPosChanged(HWND hWnd, const RECT *WindowRect, const RECT *OldRect, HWND hWndAfter, UINT SwpFlags);
HWND NTAPI SwmGetWindowFromPoint(LONG x, LONG y);
VOID NTAPI -SwmShowWindow(HWND hWnd, BOOLEAN Show); +SwmShowWindow(HWND hWnd, BOOLEAN Show, UINT SwpFlags);
#endif /* __WIN32K_NTUSER_H */
Modified: branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c [iso-8859-1] Wed Dec 30 14:26:24 2009 @@ -95,7 +95,7 @@ req.window = (UINT_PTR)Window->hwnd; req_update_window_zorder(&req, &reply); } - DbgPrint("\n"); + //DbgPrint("\n");
/* Convert region to client coordinates */ offset_region(ClientRegion, -Window->Window.left, -Window->Window.top); @@ -300,8 +300,8 @@ { PSWM_WINDOW Win;
- DPRINT1("SwmAddWindow %x\n", hWnd); - DPRINT1("rect (%d,%d)-(%d,%d)\n", WindowRect->left, WindowRect->top, WindowRect->right, WindowRect->bottom); + DPRINT("SwmAddWindow %x\n", hWnd); + DPRINT("rect (%d,%d)-(%d,%d)\n", WindowRect->left, WindowRect->top, WindowRect->right, WindowRect->bottom);
/* Acquire the lock */ SwmAcquire(); @@ -416,7 +416,7 @@ /* Acquire the lock */ SwmAcquire();
- DPRINT1("SwmRemoveWindow %x\n", hWnd); + DPRINT("SwmRemoveWindow %x\n", hWnd);
/* Allocate entry */ Win = SwmFindByHwnd(hWnd); @@ -536,9 +536,9 @@
VOID NTAPI -SwmPosChanged(HWND hWnd, const RECT *WindowRect, const RECT *OldRect) -{ - PSWM_WINDOW SwmWin; +SwmPosChanged(HWND hWnd, const RECT *WindowRect, const RECT *OldRect, HWND hWndAfter, UINT SwpFlags) +{ + PSWM_WINDOW SwmWin, SwmPrev;
/* Acquire the lock */ SwmAcquire(); @@ -552,8 +552,9 @@ return; }
- /* Check if window really moved anywhere */ - if (WindowRect->left - OldRect->left == 0 && + /* Check if window really moved anywhere (origin, size or z order) */ + if (hWndAfter == 0 && + WindowRect->left - OldRect->left == 0 && WindowRect->top - OldRect->top == 0 && WindowRect->right - OldRect->right == 0 && WindowRect->bottom - OldRect->bottom == 0) @@ -562,14 +563,28 @@ SwmRelease(); return; } -//DPRINT1("rect (%d,%d)-(%d,%d)\n", TmpRect.left, TmpRect.top, TmpRect.right, TmpRect.bottom); - DPRINT1("SwmPosChanged hwnd %x, new rect (%d,%d)-(%d,%d)\n", hWnd, WindowRect->left, WindowRect->top, WindowRect->right, WindowRect->bottom); + + DPRINT("SwmPosChanged hwnd %x, new rect (%d,%d)-(%d,%d)\n", hWnd, + WindowRect->left, WindowRect->top, WindowRect->right, WindowRect->bottom);
SwmWin->Window.left = WindowRect->left; SwmWin->Window.top = WindowRect->top; SwmWin->Window.right = WindowRect->right; SwmWin->Window.bottom = WindowRect->bottom;
+ /* Check if we need to change zorder */ + if (hWndAfter && !(SwpFlags & SWP_NOZORDER)) + { + /* Get the previous window */ + SwmPrev = CONTAINING_RECORD(SwmWin->Entry.Blink, SWM_WINDOW, Entry); + + /* Check if they are different */ + if (SwmPrev->hwnd != hWndAfter) + { + DPRINT1("WARNING: Change in zorder is requested but ignored! Previous hwnd %x, but should be %x\n", SwmPrev->hwnd, hWndAfter); + } + } + /* Recalculate all clipping */ SwmClipAllWindows();
@@ -579,7 +594,7 @@
VOID NTAPI -SwmShowWindow(HWND hWnd, BOOLEAN Show) +SwmShowWindow(HWND hWnd, BOOLEAN Show, UINT SwpFlags) { PSWM_WINDOW Win; struct region *OldRegion; @@ -601,13 +616,28 @@ if (Show && Win->Hidden) { /* Change state from hidden to visible */ - DPRINT1("Unhiding %x, rect (%d,%d)-(%d,%d)\n", Win->hwnd, Win->Window.left, Win->Window.top, Win->Window.right, Win->Window.bottom); + DPRINT("Unhiding %x, rect (%d,%d)-(%d,%d)\n", Win->hwnd, Win->Window.left, Win->Window.top, Win->Window.right, Win->Window.bottom); Win->Hidden = FALSE; - SwmBringToFront(Win); + + /* Make it topmost window if needed */ + if (!(SwpFlags & SWP_NOZORDER)) + { + /* Remove it from the list */ + RemoveEntryList(&Win->Entry); + + /* Add it to the head of the list */ + InsertHeadList(&SwmWindows, &Win->Entry); + } + + /* Calculate visible regions for all windows */ + SwmClipAllWindows(); + + /* Draw the newly appeared window */ + SwmInvalidateRegion(Win, Win->Visible, NULL); } else if (!Show && !Win->Hidden) { - DPRINT1("Hiding %x\n", Win->hwnd); + DPRINT("Hiding %x\n", Win->hwnd); /* Change state from visible to hidden */ Win->Hidden = TRUE;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] Wed Dec 30 14:26:24 2009 @@ -91,6 +91,6 @@ SwmRemoveWindow 1 SwmSetForeground 1 SwmPosChanging 2 -SwmPosChanged 3 +SwmPosChanged 5 SwmGetWindowFromPoint 2 -SwmShowWindow 2 +SwmShowWindow 3