- More painting bugfixes. Still many bugs are left :-(

- Temporary disabled buggy code for setting window focus, because it causes many applications to crash.
- Fixed one FIXME in IntSetCursor.

svn path=/trunk/; revision=6732
This commit is contained in:
Filip Navara 2003-11-20 21:21:29 +00:00
parent ef60bea82e
commit ef9cbc6dbf
7 changed files with 318 additions and 76 deletions

View file

@ -113,6 +113,193 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return TRUE;
}
struct {
char *Name;
ULONG Id;
} Messages[] =
{
{"WM_ACTIVATE", WM_ACTIVATE},
{"WM_ACTIVATEAPP", WM_ACTIVATEAPP},
{"WM_ASKCBFORMATNAME", WM_ASKCBFORMATNAME},
{"WM_CANCELJOURNAL", WM_CANCELJOURNAL},
{"WM_CANCELMODE", WM_CANCELMODE},
{"WM_CAPTURECHANGED", 533},
{"WM_CHANGECBCHAIN", 781},
{"WM_CHAR", 258},
{"WM_CHARTOITEM", 47},
{"WM_CHILDACTIVATE", 34},
{"WM_CLEAR", 771},
{"WM_CLOSE", 16},
{"WM_COMMAND", 273},
{"WM_COMMNOTIFY", 68},
{"WM_COMPACTING", 65},
{"WM_COMPAREITEM", 57},
{"WM_CONTEXTMENU", 123},
{"WM_COPY", 769},
{"WM_COPYDATA", 74},
{"WM_CREATE", 1},
{"WM_CTLCOLORBTN", 309},
{"WM_CTLCOLORDLG", 310},
{"WM_CTLCOLOREDIT", 307},
{"WM_CTLCOLORLISTBOX", 308},
{"WM_CTLCOLORMSGBOX", 306},
{"WM_CTLCOLORSCROLLBAR", 311},
{"WM_CTLCOLORSTATIC", 312},
{"WM_CUT", 768},
{"WM_DEADCHAR", 259},
{"WM_DELETEITEM", 45},
{"WM_DESTROY", 2},
{"WM_DESTROYCLIPBOARD", 775},
{"WM_DEVICECHANGE", 537},
{"WM_DEVMODECHANGE", 27},
{"WM_DISPLAYCHANGE", 126},
{"WM_DRAWCLIPBOARD", 776},
{"WM_DRAWITEM", 43},
{"WM_DROPFILES", 563},
{"WM_ENABLE", 10},
{"WM_ENDSESSION", 22},
{"WM_ENTERIDLE", 289},
{"WM_ENTERMENULOOP", 529},
{"WM_ENTERSIZEMOVE", 561},
{"WM_ERASEBKGND", 20},
{"WM_EXITMENULOOP", 530},
{"WM_EXITSIZEMOVE", 562},
{"WM_FONTCHANGE", 29},
{"WM_GETDLGCODE", 135},
{"WM_GETFONT", 49},
{"WM_GETHOTKEY", 51},
{"WM_GETICON", 127},
{"WM_GETMINMAXINFO", 36},
{"WM_GETTEXT", 13},
{"WM_GETTEXTLENGTH", 14},
{"WM_HANDHELDFIRST", 856},
{"WM_HANDHELDLAST", 863},
{"WM_HELP", 83},
{"WM_HOTKEY", 786},
{"WM_HSCROLL", 276},
{"WM_HSCROLLCLIPBOARD", 782},
{"WM_ICONERASEBKGND", 39},
{"WM_INITDIALOG", 272},
{"WM_INITMENU", 278},
{"WM_INITMENUPOPUP", 279},
{"WM_INPUTLANGCHANGE", 81},
{"WM_INPUTLANGCHANGEREQUEST", 80},
{"WM_KEYDOWN", 256},
{"WM_KEYUP", 257},
{"WM_KILLFOCUS", 8},
{"WM_MDIACTIVATE", 546},
{"WM_MDICASCADE", 551},
{"WM_MDICREATE", 544},
{"WM_MDIDESTROY", 545},
{"WM_MDIGETACTIVE", 553},
{"WM_MDIICONARRANGE", 552},
{"WM_MDIMAXIMIZE", 549},
{"WM_MDINEXT", 548},
{"WM_MDIREFRESHMENU", 564},
{"WM_MDIRESTORE", 547},
{"WM_MDISETMENU", 560},
{"WM_MDITILE", 550},
{"WM_MEASUREITEM", 44},
{"WM_MENURBUTTONUP", 290},
{"WM_MENUCHAR", 288},
{"WM_MENUSELECT", 287},
{"WM_NEXTMENU", 531},
{"WM_MOVE", 3},
{"WM_MOVING", 534},
{"WM_NCACTIVATE", 134},
{"WM_NCCALCSIZE", 131},
{"WM_NCCREATE", 129},
{"WM_NCDESTROY", 130},
{"WM_NCHITTEST", 132},
{"WM_NCLBUTTONDBLCLK", 163},
{"WM_NCLBUTTONDOWN", 161},
{"WM_NCLBUTTONUP", 162},
{"WM_NCMBUTTONDBLCLK", 169},
{"WM_NCMBUTTONDOWN", 167},
{"WM_NCMBUTTONUP", 168},
{"WM_NCMOUSEMOVE", 160},
{"WM_NCPAINT", 133},
{"WM_NCRBUTTONDBLCLK", 166},
{"WM_NCRBUTTONDOWN", 164},
{"WM_NCRBUTTONUP", 165},
{"WM_NEXTDLGCTL", 40},
{"WM_NEXTMENU", 531},
{"WM_NOTIFY", 78},
{"WM_NOTIFYFORMAT", 85},
{"WM_NULL", 0},
{"WM_PAINT", 15},
{"WM_PAINTCLIPBOARD", 777},
{"WM_PAINTICON", 38},
{"WM_PALETTECHANGED", 785},
{"WM_PALETTEISCHANGING", 784},
{"WM_PARENTNOTIFY", 528},
{"WM_PASTE", 770},
{"WM_PENWINFIRST", 896},
{"WM_PENWINLAST", 911},
{"WM_POWER", 72},
{"WM_POWERBROADCAST", 536},
{"WM_PRINT", 791},
{"WM_PRINTCLIENT", 792},
{"WM_QUERYDRAGICON", 55},
{"WM_QUERYENDSESSION", 17},
{"WM_QUERYNEWPALETTE", 783},
{"WM_QUERYOPEN", 19},
{"WM_QUEUESYNC", 35},
{"WM_QUIT", 18},
{"WM_RENDERALLFORMATS", 774},
{"WM_RENDERFORMAT", 773},
{"WM_SETCURSOR", 32},
{"WM_SETFOCUS", 7},
{"WM_SETFONT", 48},
{"WM_SETHOTKEY", 50},
{"WM_SETICON", 128},
{"WM_SETREDRAW", 11},
{"WM_SETTEXT", 12},
{"WM_SETTINGCHANGE", 26},
{"WM_SHOWWINDOW", 24},
{"WM_SIZE", 5},
{"WM_SIZECLIPBOARD", 779},
{"WM_SIZING", 532},
{"WM_SPOOLERSTATUS", 42},
{"WM_STYLECHANGED", 125},
{"WM_STYLECHANGING", 124},
{"WM_SYSCHAR", 262},
{"WM_SYSCOLORCHANGE", 21},
{"WM_SYSCOMMAND", 274},
{"WM_SYSDEADCHAR", 263},
{"WM_SYSKEYDOWN", 260},
{"WM_SYSKEYUP", 261},
{"WM_TCARD", 82},
{"WM_TIMECHANGE", 30},
{"WM_TIMER", 275},
{"WM_UNDO", 772},
{"WM_USER", 1024},
{"WM_USERCHANGED", 84},
{"WM_VKEYTOITEM", 46},
{"WM_VSCROLL", 277},
{"WM_VSCROLLCLIPBOARD", 778},
{"WM_WINDOWPOSCHANGED", 71},
{"WM_WINDOWPOSCHANGING", 70},
{"WM_WININICHANGE", 26},
{"WM_KEYFIRST", 256},
{"WM_KEYLAST", 264},
{"WM_SYNCPAINT", 136},
{"WM_MOUSEACTIVATE", 33},
{"WM_MOUSEMOVE", 512},
{"WM_LBUTTONDOWN", 513},
{"WM_LBUTTONUP", 514},
{"WM_LBUTTONDBLCLK", 515},
{"WM_RBUTTONDOWN", 516},
{"WM_RBUTTONUP", 517},
{"WM_RBUTTONDBLCLK", 518},
{"WM_MBUTTONDOWN", 519},
{"WM_MBUTTONUP", 520},
{"WM_MBUTTONDBLCLK", 521},
{"WM_MOUSEWHEEL", 522},
{"WM_MOUSEHOVER", 0x2A1},
{"WM_MOUSELEAVE", 0x2A3}
};
/*******************************************************************************
*
* FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
@ -130,6 +317,25 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
/* ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA); */
static ChildWnd* pChildWnd;
{
int i;
char *name = NULL;
for (i = sizeof(Messages) / sizeof(Messages[0]); i--; )
if (message == Messages[i].Id)
{
name = Messages[i].Name;
break;
}
if (name)
DbgPrint("Window: %x Message: %s (%x) wParam: %x lParam: %x\n",
hWnd, name, message, wParam, lParam);
else
DbgPrint("Window: %x Message: %x wParam: %x lParam: %x\n",
hWnd, message, wParam, lParam);
}
switch (message) {
case WM_CREATE:
pChildWnd = (ChildWnd*)((LPCREATESTRUCT)lParam)->lpCreateParams;

View file

@ -27,11 +27,6 @@ typedef struct _WINDOW_OBJECT
UNICODE_STRING WindowName;
/* Style. */
DWORD Style;
/* Initial window position. */
INT x;
INT y;
INT Width;
INT Height;
/* Context help id */
DWORD ContextHelpId;
/* system menu handle. */
@ -93,6 +88,7 @@ typedef struct _WINDOW_OBJECT
#define WINDOWOBJECT_NEED_ERASEBKGND (0x00000002)
#define WINDOWOBJECT_NEED_NCPAINT (0x00000004)
#define WINDOWOBJECT_NEED_INTERNALPAINT (0x00000008)
#define WINDOWOBJECT_MAPPING (0x00000010)
#define WINDOWOBJECT_RESTOREMAX (0x00000020)
inline BOOL IntIsDesktopWindow(PWINDOW_OBJECT WindowObject);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: painting.c,v 1.35 2003/11/19 09:10:36 navaraf Exp $
* $Id: painting.c,v 1.36 2003/11/20 21:21:29 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -585,6 +585,8 @@ IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread)
}
ExAcquireFastMutex(&Window->ChildrenListLock);
#if 0
for (Child = Window->FirstChild; Child; Child = Child->NextSibling)
{
if (Child->Style & WS_VISIBLE &&
@ -599,6 +601,7 @@ IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread)
if (hFoundWnd == NULL)
{
#endif
for (Child = Window->FirstChild; Child; Child = Child->NextSibling)
{
if (Child->Style & WS_VISIBLE)
@ -608,7 +611,9 @@ IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread)
break;
}
}
#if 0
}
#endif
ExReleaseFastMutex(&Window->ChildrenListLock);
IntReleaseWindowObject(Window);
@ -628,7 +633,18 @@ IntGetPaintMessage(PWINDOW_OBJECT Wnd, PW32THREAD Thread, MSG *Message)
Message->hwnd = IntFindWindowToRepaint(NULL, PsGetWin32Thread());
if (Message->hwnd == NULL)
{
PUSER_MESSAGE_QUEUE MessageQueue;
DPRINT1("PAINTING BUG: Thread marked as containing dirty windows, but no dirty windows found!\n");
MessageQueue = (PUSER_MESSAGE_QUEUE)Thread->MessageQueue;
ExAcquireFastMutex(&MessageQueue->Lock);
DPRINT1("Current paint count: %d\n", MessageQueue->PaintCount);
MessageQueue->PaintCount = 0;
MessageQueue->PaintPosted = FALSE;
ExReleaseFastMutex(&MessageQueue->Lock);
return FALSE;
}
Window = IntGetWindowObject(Message->hwnd);
if (Window != NULL)

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: windc.c,v 1.36 2003/11/19 09:10:36 navaraf Exp $
/* $Id: windc.c,v 1.37 2003/11/20 21:21:29 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -455,7 +455,7 @@ NtUserGetDCEx(HWND hWnd, HANDLE ClipRegion, ULONG Flags)
}
*/
}
Flags &= DCX_INTERSECTRGN;
Flags |= DCX_INTERSECTRGN;
}
if (NULL != ClipRegion)

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: window.c,v 1.139 2003/11/20 15:35:33 weiden Exp $
/* $Id: window.c,v 1.140 2003/11/20 21:21:29 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -467,10 +467,6 @@ IntCreateDesktopWindow(PWINSTATION_OBJECT WindowStation,
WindowObject->ExStyle = 0;
WindowObject->Style = WS_VISIBLE;
WindowObject->Flags = 0;
WindowObject->x = 0;
WindowObject->y = 0;
WindowObject->Width = Width;
WindowObject->Height = Height;
WindowObject->Parent = NULL;
WindowObject->Owner = NULL;
WindowObject->IDMenu = 0;
@ -756,6 +752,7 @@ IntLinkWindow(
*
* Change the focus window, sending the WM_SETFOCUS and WM_KILLFOCUS messages
*/
#if 0
static HWND FASTCALL
set_focus_window(HWND New, PWINDOW_OBJECT Window, HWND Previous)
{
@ -802,10 +799,12 @@ set_focus_window(HWND New, PWINDOW_OBJECT Window, HWND Previous)
return Previous;
}
#endif
HWND FASTCALL
IntSetFocusWindow(HWND hWnd)
{
#if 0
PUSER_MESSAGE_QUEUE OldMessageQueue;
PDESKTOP_OBJECT DesktopObject;
PWINDOW_OBJECT WindowObject;
@ -921,6 +920,8 @@ IntSetFocusWindow(HWND hWnd)
DPRINT("hWndOldFocus = 0x%x\n", hWndOldFocus);
return hWndOldFocus;
#endif
return 0;
}
@ -1435,10 +1436,6 @@ NtUserCreateWindowEx(DWORD dwExStyle,
else
WindowObject->SystemMenu = (HANDLE)0;
WindowObject->x = x;
WindowObject->y = y;
WindowObject->Width = nWidth;
WindowObject->Height = nHeight;
WindowObject->ContextHelpId = 0;
WindowObject->IDMenu = (UINT)hMenu;
WindowObject->Instance = hInstance;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: winpos.c,v 1.43 2003/11/20 09:18:49 navaraf Exp $
/* $Id: winpos.c,v 1.44 2003/11/20 21:21:29 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -744,7 +744,15 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return FALSE;
}
if (Window->Flags & WINDOWOBJECT_MAPPING)
{
/* FIXME: SetLastWin32Error */
return FALSE;
}
Window->Flags |= WINDOWOBJECT_MAPPING;
WinPos.hwnd = Wnd;
WinPos.hwndInsertAfter = WndInsertAfter;
WinPos.x = x;
@ -810,9 +818,9 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
ParentWindow = Window->Parent;
if (ParentWindow)
{
if (WndInsertAfter == HWND_TOP)
if (WinPos.hwndInsertAfter == HWND_TOP)
InsertAfterWindow = NULL;
else if (WndInsertAfter == HWND_BOTTOM)
else if (WinPos.hwndInsertAfter == HWND_BOTTOM)
InsertAfterWindow = ParentWindow->LastChild;
else
InsertAfterWindow = IntGetWindowObject(WinPos.hwndInsertAfter);
@ -866,21 +874,11 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
Window->Style |= WS_VISIBLE;
}
#if 0
if (WvrFlags & WVR_REDRAW)
{
IntRedrawWindow(Window, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME);
}
#endif
if (!(WinPos.flags & SWP_NOACTIVATE))
{
WinPosChangeActiveWindow(WinPos.hwnd, FALSE);
}
/* FIXME: Check some conditions before doing this. */
IntSendWINDOWPOSCHANGEDMessage(WinPos.hwnd, &WinPos);
/* Determine the new visible region */
VisAfter = VIS_ComputeVisibleRegion(
PsGetWin32Thread()->Desktop, Window, FALSE,
@ -900,7 +898,7 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
* change.
*/
if (VisBefore != NULL && VisAfter != NULL && !(WinPos.flags & SWP_NOCOPYBITS) &&
((WinPos.flags & SWP_NOSIZE) || !(Window->Class->style & (CS_HREDRAW | CS_VREDRAW))))
((WinPos.flags & SWP_NOSIZE) || !(WvrFlags & WVR_REDRAW)))
{
CopyRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
RgnType = NtGdiCombineRgn(CopyRgn, VisAfter, VisBefore, RGN_AND);
@ -1025,6 +1023,17 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
NtGdiDeleteObject(VisAfter);
}
if (!(WinPos.flags & SWP_NOREDRAW))
{
/* FIXME: Call IntRedrawWindow to erase *all* touched windows. */
IntRedrawWindow(Window, NULL, 0, RDW_ALLCHILDREN | RDW_ERASENOW);
}
/* FIXME: Check some conditions before doing this. */
IntSendWINDOWPOSCHANGEDMessage(WinPos.hwnd, &WinPos);
Window->Flags &= ~WINDOWOBJECT_MAPPING;
IntReleaseWindowObject(Window);
return TRUE;
@ -1042,13 +1051,18 @@ WinPosShowWindow(HWND Wnd, INT Cmd)
{
BOOLEAN WasVisible;
PWINDOW_OBJECT Window;
NTSTATUS Status;
UINT Swp = 0;
RECT NewPos = {0, 0, 0, 0};
RECT NewPos;
BOOLEAN ShowFlag;
/* HRGN VisibleRgn;*/
HRGN VisibleRgn;
Window = IntGetWindowObject(Wnd);
if (!Window)
Status =
ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
Wnd,
otWindow,
(PVOID*)&Window);
if (!NT_SUCCESS(Status))
{
return(FALSE);
}
@ -1139,50 +1153,60 @@ WinPosShowWindow(HWND Wnd, INT Cmd)
*/
}
/* We can't activate a child window */
if ((Window->Style & WS_CHILD) &&
!(Window->ExStyle & WS_EX_MDICHILD))
if (Window->Style & WS_CHILD &&
!IntIsWindowVisible(Window->Parent->Self) &&
(Swp & (SWP_NOSIZE | SWP_NOMOVE)) == (SWP_NOSIZE | SWP_NOMOVE))
{
Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
}
WinPosSetWindowPos(Wnd, HWND_TOP, NewPos.left, NewPos.top,
NewPos.right, NewPos.bottom, LOWORD(Swp));
if (Cmd == SW_HIDE)
{
/* FIXME: This will cause the window to be activated irrespective
* of whether it is owned by the same thread. Has to be done
* asynchronously.
*/
if (Wnd == IntGetActiveWindow())
{
WinPosActivateOtherWindow(Window);
}
/* Revert focus to parent */
if (Wnd == IntGetFocusWindow() ||
IntIsChildWindow(Wnd, IntGetFocusWindow()))
if (Cmd == SW_HIDE)
{
IntSetFocusWindow(Window->Parent->Self);
VisibleRgn = VIS_ComputeVisibleRegion(PsGetWin32Thread()->Desktop, Window,
FALSE, FALSE, FALSE);
Window->Style &= ~WS_VISIBLE;
VIS_WindowLayoutChanged(PsGetWin32Thread()->Desktop, Window, VisibleRgn);
NtGdiDeleteObject(VisibleRgn);
}
else
{
Window->Style |= WS_VISIBLE;
}
}
if (!IntIsWindow(Wnd))
else
{
IntReleaseWindowObject(Window);
return WasVisible;
}
else if (Window->Style & WS_MINIMIZE)
{
WinPosShowIconTitle(Window, TRUE);
if (Window->Style & WS_CHILD &&
!(Window->ExStyle & WS_EX_MDICHILD))
{
Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
}
if (!(Swp & MINMAX_NOSWP))
{
WinPosSetWindowPos(Wnd, HWND_TOP, NewPos.left, NewPos.top,
NewPos.right, NewPos.bottom, LOWORD(Swp));
if (Cmd == SW_HIDE)
{
/* Hide the window. */
if (Wnd == IntGetActiveWindow())
{
WinPosActivateOtherWindow(Window);
}
/* Revert focus to parent. */
if (Wnd == IntGetFocusWindow() ||
IntIsChildWindow(Wnd, IntGetFocusWindow()))
{
IntSetFocusWindow(Window->Parent->Self);
}
}
}
/* FIXME: Check for window destruction. */
/* Show title for minimized windows. */
if (Window->Style & WS_MINIMIZE)
{
WinPosShowIconTitle(Window, TRUE);
}
}
if (Window->Flags & WINDOWOBJECT_NEED_SIZE)
{
/* should happen only in CreateWindowEx() */
int wParam = SIZE_RESTORED;
WPARAM wParam = SIZE_RESTORED;
Window->Flags &= ~WINDOWOBJECT_NEED_SIZE;
if (Window->Style & WS_MAXIMIZE)
@ -1210,8 +1234,8 @@ WinPosShowWindow(HWND Wnd, INT Cmd)
WinPosChangeActiveWindow(Wnd, FALSE);
}
IntReleaseWindowObject(Window);
return WasVisible;
ObmDereferenceObject(Window);
return(WasVisible);
}
BOOL STATIC FASTCALL

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: cursoricon.c,v 1.20 2003/11/18 19:59:51 weiden Exp $ */
/* $Id: cursoricon.c,v 1.21 2003/11/20 21:21:29 navaraf Exp $ */
#undef WIN32_LEAN_AND_MEAN
@ -69,6 +69,7 @@ IntCopyBitmap(HBITMAP bmp)
HCURSOR FASTCALL
IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL ForceChange)
{
HDC hDC;
PDC dc;
PSURFOBJ SurfObj;
PSURFGDI SurfGDI;
@ -92,11 +93,13 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL Fo
goto done;
/* FIXME use the desktop's HDC instead of using ScreenDeviceContext */
dc = DC_LockDc(ScreenDeviceContext);
hDC = NtUserGetDC(0);
dc = DC_LockDc(hDC);
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
DevInfo = dc->DevInfo;
DC_UnlockDc(ScreenDeviceContext);
DC_UnlockDc(hDC);
NtUserReleaseDC(0, hDC);
if(!NewCursor && (CurInfo->CurrentCursorObject || ForceChange))
{