Author: gadamopoulos
Date: Fri Mar 1 14:43:00 2013
New Revision: 58386
URL:
http://svn.reactos.org/svn/reactos?rev=58386&view=rev
Log:
[win32k]
- Make NtUserSwitchDesktop hide the previous desktop window and show the new one. This
doesn't change much yet as winlogon still uses only one desktop
Modified:
trunk/reactos/win32ss/gdi/ntgdi/device.c
trunk/reactos/win32ss/user/ntuser/desktop.c
trunk/reactos/win32ss/user/ntuser/desktop.h
Modified: trunk/reactos/win32ss/gdi/ntgdi/device.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/device.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/device.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/device.c [iso-8859-1] Fri Mar 1 14:43:00 2013
@@ -57,7 +57,7 @@
DPRINT1("No DESKTOP Window!!!!!\n");
}
}
- co_IntShowDesktop(rpDesk, SurfSize.cx, SurfSize.cy);
+ co_IntShowDesktop(rpDesk, SurfSize.cx, SurfSize.cy, TRUE);
// Init Primary Displays Device Capabilities.
PDEVOBJ_vGetDeviceCaps(gppdevPrimary, &GdiHandleTable->DevCaps);
Modified: trunk/reactos/win32ss/user/ntuser/desktop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/deskto…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] Fri Mar 1 14:43:00 2013
@@ -647,7 +647,19 @@
{
UserDereferenceObject(pcurOld);
}
+ return TRUE;
}
+
+ case WM_WINDOWPOSCHANGING:
+ {
+ PWINDOWPOS pWindowPos = (PWINDOWPOS)lParam;
+ if((pWindowPos->flags & SWP_SHOWWINDOW) != 0)
+ {
+ HDESK hdesk = IntGetDesktopObjectHandle(gpdeskInputDesktop);
+ IntSetThreadDesktop(hdesk, FALSE);
+ }
+ }
+
}
return TRUE; /* We are done. Do not do any callbacks to user mode */
}
@@ -737,20 +749,20 @@
NTSTATUS FASTCALL
-co_IntShowDesktop(PDESKTOP Desktop, ULONG Width, ULONG Height)
-{
- PWND Window;
-
- Window = IntGetWindowObject(Desktop->DesktopWindow);
-
- if (!Window)
- {
- ERR("No Desktop window.\n");
- return STATUS_UNSUCCESSFUL;
- }
- co_WinPosSetWindowPos(Window, NULL, 0, 0, Width, Height,
SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW);
-
- co_UserRedrawWindow( Window, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN);
+co_IntShowDesktop(PDESKTOP Desktop, ULONG Width, ULONG Height, BOOL bRedraw)
+{
+ PWND pwnd = Desktop->pDeskInfo->spwnd;
+ UINT flags = SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW;
+ ASSERT(pwnd);
+
+ if(!bRedraw)
+ flags |= SWP_NOREDRAW;
+
+ co_WinPosSetWindowPos(pwnd, NULL, 0, 0, Width, Height, flags);
+
+ if(bRedraw)
+ co_UserRedrawWindow( pwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN |
RDW_INVALIDATE );
+
return STATUS_SUCCESS;
}
@@ -1607,6 +1619,7 @@
{
PDESKTOP pdesk;
NTSTATUS Status;
+ BOOL bRedrawDesktop;
DECLARE_RETURN(BOOL);
UserEnterExclusive();
@@ -1617,6 +1630,12 @@
{
ERR("Validation of desktop handle (0x%p) failed\n", hdesk);
RETURN(FALSE);
+ }
+
+ if(pdesk == gpdeskInputDesktop)
+ {
+ WARN("NtUserSwitchDesktop called for active desktop\n");
+ RETURN(TRUE);
}
/*
@@ -1642,11 +1661,29 @@
desktop such as Winlogon or Screen-Saver */
/* FIXME: Connect to input device */
+ TRACE("Switching from desktop 0x%p to 0x%p\n", gpdeskInputDesktop, pdesk);
+
+ bRedrawDesktop = FALSE;
+
+ /* The first time SwitchDesktop is called, gpdeskInputDesktop is NULL */
+ if(gpdeskInputDesktop != NULL)
+ {
+ if((gpdeskInputDesktop->pDeskInfo->spwnd->style & WS_VISIBLE) ==
WS_VISIBLE)
+ bRedrawDesktop = TRUE;
+
+ /* Hide the previous desktop window */
+ IntHideDesktop(gpdeskInputDesktop);
+ }
+
/* Set the active desktop in the desktop's window station. */
InputWindowStation->ActiveDesktop = pdesk;
/* Set the global state. */
gpdeskInputDesktop = pdesk;
+
+ /* Show the new desktop window */
+ co_IntShowDesktop(pdesk, UserGetSystemMetrics(SM_CXSCREEN),
UserGetSystemMetrics(SM_CYSCREEN), bRedrawDesktop);
+
TRACE("SwitchDesktop gpdeskInputDesktop 0x%p\n",gpdeskInputDesktop);
ObDereferenceObject(pdesk);
Modified: trunk/reactos/win32ss/user/ntuser/desktop.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/deskto…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/desktop.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/desktop.h [iso-8859-1] Fri Mar 1 14:43:00 2013
@@ -132,7 +132,7 @@
IntGetActiveDesktop(VOID);
NTSTATUS FASTCALL
-co_IntShowDesktop(PDESKTOP Desktop, ULONG Width, ULONG Height);
+co_IntShowDesktop(PDESKTOP Desktop, ULONG Width, ULONG Height, BOOL Redraw);
NTSTATUS FASTCALL
IntHideDesktop(PDESKTOP Desktop);