Win32k/User32:

- Removed NtUserGetSystemMetric, updated all related.
- Add GetConnected, this is needed, sometimes global pointers are initilized with zeros. This is normal.
- Fix prototype for NtUserDragDetect, and add the Esc key hit to DragDetect.

svn path=/trunk/; revision=34370
This commit is contained in:
James Tabor 2008-07-08 18:58:07 +00:00
parent 0a953de77e
commit ef1f9bd06c
7 changed files with 44 additions and 34 deletions

View file

@ -115,3 +115,4 @@ PWINDOW FASTCALL ValidateHwndOrDesk(HWND hwnd);
PWINDOW FASTCALL GetThreadDesktopWnd(VOID); PWINDOW FASTCALL GetThreadDesktopWnd(VOID);
PVOID FASTCALL ValidateHandleNoErr(HANDLE handle, UINT uType); PVOID FASTCALL ValidateHandleNoErr(HANDLE handle, UINT uType);
PWINDOW FASTCALL ValidateHwndNoErr(HWND hwnd); PWINDOW FASTCALL ValidateHwndNoErr(HWND hwnd);
VOID FASTCALL GetConnected(VOID);

View file

@ -99,12 +99,10 @@ LogFontW2A(LPLOGFONTA pA, CONST LOGFONTW *pW)
int STDCALL int STDCALL
GetSystemMetrics(int nIndex) GetSystemMetrics(int nIndex)
{ {
GetConnected();
// FIXME("Global Sever Data -> %x\n",g_psi); // FIXME("Global Sever Data -> %x\n",g_psi);
if (nIndex < 0 || nIndex >= SM_CMETRICS) return 0; if (nIndex < 0 || nIndex >= SM_CMETRICS) return 0;
if (g_psi)
return g_psi->SystemMetrics[nIndex]; return g_psi->SystemMetrics[nIndex];
else
return(NtUserGetSystemMetrics(nIndex));
} }

View file

@ -295,3 +295,25 @@ DllMain(
return TRUE; return TRUE;
} }
VOID
FASTCALL
GetConnected(VOID)
{
PW32PROCESSINFO pi;
if ((PW32THREADINFO)NtCurrentTeb()->Win32ThreadInfo == NULL)
NtUserGetThreadState(THREADSTATE_GETTHREADINFO);
if (g_pi && g_kpi && g_psi) return;
pi = GetW32ProcessInfo();
if (!g_pi) g_pi = pi;
if (!g_kpi) g_kpi = SharedPtrToKernel(pi);
if (!g_psi) g_psi = SharedPtrToUser(pi->psi);
if (!g_psi) { WARN("Global Share Information has not been initialized!\n"); }
if (!gHandleTable) gHandleTable = SharedPtrToUser(pi->UserHandleTable);
if (!gHandleEntries) gHandleEntries = SharedPtrToUser(gHandleTable->handles);
}

View file

@ -50,13 +50,13 @@ DragDetect(
POINT pt) POINT pt)
{ {
#if 0 #if 0
return NtUserDragDetect(hWnd, pt.x, pt.y); return NtUserDragDetect(hWnd, pt);
#else #else
MSG msg; MSG msg;
RECT rect; RECT rect;
POINT tmp; POINT tmp;
ULONG dx = NtUserGetSystemMetrics(SM_CXDRAG); ULONG dx = GetSystemMetrics(SM_CXDRAG);
ULONG dy = NtUserGetSystemMetrics(SM_CYDRAG); ULONG dy = GetSystemMetrics(SM_CYDRAG);
rect.left = pt.x - dx; rect.left = pt.x - dx;
rect.right = pt.x + dx; rect.right = pt.x + dx;
@ -67,12 +67,15 @@ DragDetect(
for (;;) for (;;)
{ {
while (PeekMessageW(&msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE)) while (
PeekMessageW(&msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) ||
PeekMessageW(&msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE)
)
{ {
if (msg.message == WM_LBUTTONUP) if (msg.message == WM_LBUTTONUP)
{ {
ReleaseCapture(); ReleaseCapture();
return 0; return FALSE;
} }
if (msg.message == WM_MOUSEMOVE) if (msg.message == WM_MOUSEMOVE)
{ {
@ -81,7 +84,15 @@ DragDetect(
if (!PtInRect(&rect, tmp)) if (!PtInRect(&rect, tmp))
{ {
ReleaseCapture(); ReleaseCapture();
return 1; return TRUE;
}
}
if (msg.message == WM_KEYDOWN)
{
if (msg.wParam == VK_ESCAPE)
{
ReleaseCapture();
return TRUE;
} }
} }
} }

View file

@ -1062,8 +1062,7 @@ BOOL
NTAPI NTAPI
NtUserDragDetect( NtUserDragDetect(
HWND hWnd, HWND hWnd,
LONG x, POINT pt);
LONG y);
DWORD DWORD
NTAPI NTAPI
@ -2718,10 +2717,6 @@ HWND
NTAPI NTAPI
NtUserGetShellWindow(); NtUserGetShellWindow();
ULONG
NTAPI
NtUserGetSystemMetrics(ULONG Index);
HWND HWND
NTAPI NTAPI
NtUserGetWindow(HWND hWnd, UINT Relationship); NtUserGetWindow(HWND hWnd, UINT Relationship);

View file

@ -885,8 +885,7 @@ BOOL
STDCALL STDCALL
NtUserDragDetect( NtUserDragDetect(
HWND hWnd, HWND hWnd,
LONG x, POINT pt) // Just like the User call.
LONG y)
{ {
UNIMPLEMENTED UNIMPLEMENTED
return 0; return 0;

View file

@ -467,21 +467,5 @@ UserGetSystemMetrics(ULONG Index)
} }
} }
ULONG STDCALL
NtUserGetSystemMetrics(ULONG Index)
{
DECLARE_RETURN(ULONG);
DPRINT("Enter NtUserGetSystemMetrics\n");
UserEnterShared();
RETURN(UserGetSystemMetrics(Index));
CLEANUP:
DPRINT("Leave NtUserGetSystemMetrics, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
/* EOF */ /* EOF */