Sync to wine, User32. Tested with winefile, explorer with out any problems and no real improvements.

svn path=/trunk/; revision=22443
This commit is contained in:
James Tabor 2006-06-21 02:14:09 +00:00
parent 12a01a7706
commit cc6f45970b

View file

@ -37,7 +37,11 @@ HPEN SysPens[NUM_SYSCOLORS] = {0};
HBRUSH SysBrushes[NUM_SYSCOLORS] = {0}; HBRUSH SysBrushes[NUM_SYSCOLORS] = {0};
/* Bits in the dwKeyData */ /* Bits in the dwKeyData */
#define KEYDATA_ALT 0x2000 #define KEYDATA_ALT 0x2000
#define KEYDATA_PREVSTATE 0x4000
static short iF10Key = 0;
static short iMenuSysKey = 0;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -922,6 +926,39 @@ DefWndControlColor(HDC hDC, UINT ctlType)
return GetSysColorBrush(COLOR_WINDOW); return GetSysColorBrush(COLOR_WINDOW);
} }
static void DefWndPrint( HWND hwnd, HDC hdc, ULONG uFlags)
{
/*
* Visibility flag.
*/
if ( (uFlags & PRF_CHECKVISIBLE) &&
!IsWindowVisible(hwnd) )
return;
/*
* Unimplemented flags.
*/
if ( (uFlags & PRF_CHILDREN) ||
(uFlags & PRF_OWNED) ||
(uFlags & PRF_NONCLIENT) )
{
DPRINT1("WM_PRINT message with unsupported flags\n");
}
/*
* Background
*/
if ( uFlags & PRF_ERASEBKGND)
SendMessageW(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0);
/*
* Client area
*/
if ( uFlags & PRF_CLIENT)
SendMessageW(hwnd, WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT);
}
VOID FASTCALL VOID FASTCALL
DefWndScreenshot(HWND hWnd) DefWndScreenshot(HWND hWnd)
{ {
@ -960,11 +997,18 @@ User32DefWindowProc(HWND hWnd,
return (DefWndNCHitTest(hWnd, Point)); return (DefWndNCHitTest(hWnd, Point));
} }
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
iF10Key = iMenuSysKey = 0;
break;
case WM_NCLBUTTONDOWN: case WM_NCLBUTTONDOWN:
{ {
return (DefWndNCLButtonDown(hWnd, wParam, lParam)); return (DefWndNCLButtonDown(hWnd, wParam, lParam));
} }
case WM_LBUTTONDBLCLK:
case WM_NCLBUTTONDBLCLK: case WM_NCLBUTTONDBLCLK:
{ {
return (DefWndNCLButtonDblClk(hWnd, wParam, lParam)); return (DefWndNCLButtonDblClk(hWnd, wParam, lParam));
@ -980,6 +1024,16 @@ User32DefWindowProc(HWND hWnd,
return (DefWndHandleWindowPosChanged(hWnd, (WINDOWPOS*)lParam)); return (DefWndHandleWindowPosChanged(hWnd, (WINDOWPOS*)lParam));
} }
case WM_NCRBUTTONDOWN:
{
/* in Windows, capture is taken when right-clicking on the caption bar */
if (wParam == HTCAPTION)
{
SetCapture(hWnd);
}
break;
}
case WM_RBUTTONUP: case WM_RBUTTONUP:
{ {
POINT Pt; POINT Pt;
@ -1002,6 +1056,15 @@ User32DefWindowProc(HWND hWnd,
break; break;
} }
case WM_NCRBUTTONUP:
/*
* FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
* in Windows), but what _should_ we do? According to MSDN :
* "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
* message to the window". When is it appropriate?
*/
break;
case WM_CONTEXTMENU: case WM_CONTEXTMENU:
{ {
if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD)
@ -1057,7 +1120,7 @@ User32DefWindowProc(HWND hWnd,
case WM_PRINT: case WM_PRINT:
{ {
/* FIXME: Implement. */ DefWndPrint(hWnd, (HDC)wParam, lParam);
return (0); return (0);
} }
@ -1197,6 +1260,9 @@ User32DefWindowProc(HWND hWnd,
case WM_CTLCOLORSCROLLBAR: case WM_CTLCOLORSCROLLBAR:
return (LRESULT) DefWndControlColor((HDC)wParam, Msg - WM_CTLCOLORMSGBOX); return (LRESULT) DefWndControlColor((HDC)wParam, Msg - WM_CTLCOLORMSGBOX);
case WM_CTLCOLOR:
return (LRESULT) DefWndControlColor((HDC)wParam, HIWORD(lParam));
case WM_SETCURSOR: case WM_SETCURSOR:
{ {
ULONG Style = GetWindowLongW(hWnd, GWL_STYLE); ULONG Style = GetWindowLongW(hWnd, GWL_STYLE);
@ -1233,19 +1299,25 @@ User32DefWindowProc(HWND hWnd,
return (DefWndHandleSysCommand(hWnd, wParam, Pt)); return (DefWndHandleSysCommand(hWnd, wParam, Pt));
} }
/* FIXME: Handle key messages. */
/*
case WM_KEYDOWN: case WM_KEYDOWN:
case WM_KEYUP: if(wParam == VK_F10) iF10Key = VK_F10;
case WM_SYSKEYUP: break;
case WM_SYSCHAR:
*/
/* FIXME: This is also incomplete. */ /* FIXME: This is also incomplete. */
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
{ {
if (HIWORD(lParam) & KEYDATA_ALT) if (HIWORD(lParam) & KEYDATA_ALT)
{ {
/* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
if ( (wParam == VK_MENU || wParam == VK_LMENU
|| wParam == VK_RMENU) && !iMenuSysKey )
iMenuSysKey = 1;
else
iMenuSysKey = 0;
iF10Key = 0;
if (wParam == VK_F4) /* Try to close the window */ if (wParam == VK_F4) /* Try to close the window */
{ {
HWND top = GetAncestor(hWnd, GA_ROOT); HWND top = GetAncestor(hWnd, GA_ROOT);
@ -1262,6 +1334,42 @@ User32DefWindowProc(HWND hWnd,
DefWndScreenshot(hWnd); DefWndScreenshot(hWnd);
} }
} }
else if( wParam == VK_F10 )
iF10Key = 1;
else if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
SendMessageW( hWnd, WM_SYSCOMMAND, SC_KEYMENU, ' ' );
break;
}
case WM_KEYUP:
case WM_SYSKEYUP:
{
/* Press and release F10 or ALT */
if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
&& iMenuSysKey) || ((wParam == VK_F10) && iF10Key))
SendMessageW( GetAncestor( hWnd, GA_ROOT ), WM_SYSCOMMAND, SC_KEYMENU, 0L );
iMenuSysKey = iF10Key = 0;
break;
}
case WM_SYSCHAR:
{
iMenuSysKey = 0;
if (wParam == '\r' && IsIconic(hWnd))
{
PostMessageW( hWnd, WM_SYSCOMMAND, SC_RESTORE, 0L );
break;
}
if ((HIWORD(lParam) & KEYDATA_ALT) && wParam)
{
if (wParam == '\t' || wParam == '\x1b') break;
if (wParam == ' ' && (GetWindowLongW( hWnd, GWL_STYLE ) & WS_CHILD))
SendMessageW( GetParent(hWnd), Msg, wParam, lParam );
else
SendMessageW( hWnd, WM_SYSCOMMAND, SC_KEYMENU, wParam );
}
else /* check for Ctrl-Esc */
if (wParam != '\x1b') MessageBeep(0);
break; break;
} }
@ -1270,17 +1378,11 @@ User32DefWindowProc(HWND hWnd,
LONG Style; LONG Style;
INT Ret = 0; INT Ret = 0;
if (!lParam) if (!lParam) return 0;
return 0;
Style = GetWindowLongW(hWnd, GWL_STYLE); Style = GetWindowLongW(hWnd, GWL_STYLE);
// if (!(Style & WS_POPUP)) if ((Style & WS_VISIBLE) && wParam) return 0;
// return 0; if (!(Style & WS_VISIBLE) && !wParam) return 0;
if ((Style & WS_VISIBLE) && wParam) if (!GetWindow(hWnd, GW_OWNER)) return 0;
return 0;
if (!(Style & WS_VISIBLE) && !wParam)
return 0;
if (!GetWindow(hWnd, GW_OWNER))
return 0;
Ret = NtUserCallTwoParam((DWORD) hWnd, (DWORD) wParam, TWOPARAM_ROUTINE_ROS_SHOWWINDOW); Ret = NtUserCallTwoParam((DWORD) hWnd, (DWORD) wParam, TWOPARAM_ROUTINE_ROS_SHOWWINDOW);
if(Ret) if(Ret)
{ {
@ -1293,7 +1395,9 @@ User32DefWindowProc(HWND hWnd,
case WM_CANCELMODE: case WM_CANCELMODE:
{ {
iMenuSysKey = 0;
/* FIXME: Check for a desktop. */ /* FIXME: Check for a desktop. */
if (!(GetWindowLongW( hWnd, GWL_STYLE ) & WS_CHILD)) EndMenu();
if (GetCapture() == hWnd) if (GetCapture() == hWnd)
{ {
ReleaseCapture(); ReleaseCapture();
@ -1306,8 +1410,7 @@ User32DefWindowProc(HWND hWnd,
return (-1); return (-1);
/* /*
case WM_DROPOBJECT: case WM_DROPOBJECT:
return DRAG_FILE;
break;
*/ */
case WM_QUERYDROPOBJECT: case WM_QUERYDROPOBJECT:
{ {
@ -1403,6 +1506,11 @@ User32DefWindowProc(HWND hWnd,
{ {
return (1); return (1);
} }
case WM_ENDSESSION:
if (wParam) PostQuitMessage(0);
return 0;
} }
return 0; return 0;
} }