Author: jimtabor
Date: Wed Jun 21 06:14:09 2006
New Revision: 22443
URL:
http://svn.reactos.ru/svn/reactos?rev=22443&view=rev
Log:
Sync to wine, User32. Tested with winefile, explorer with out any problems and no real
improvements.
Modified:
trunk/reactos/dll/win32/user32/windows/defwnd.c
Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/user32/windows/de…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/defwnd.c (original)
+++ trunk/reactos/dll/win32/user32/windows/defwnd.c Wed Jun 21 06:14:09 2006
@@ -37,8 +37,12 @@
HBRUSH SysBrushes[NUM_SYSCOLORS] = {0};
/* 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 *****************************************************************/
void
@@ -922,6 +926,39 @@
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
DefWndScreenshot(HWND hWnd)
{
@@ -960,11 +997,18 @@
return (DefWndNCHitTest(hWnd, Point));
}
+ case WM_LBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ iF10Key = iMenuSysKey = 0;
+ break;
+
case WM_NCLBUTTONDOWN:
{
return (DefWndNCLButtonDown(hWnd, wParam, lParam));
}
+ case WM_LBUTTONDBLCLK:
case WM_NCLBUTTONDBLCLK:
{
return (DefWndNCLButtonDblClk(hWnd, wParam, lParam));
@@ -978,6 +1022,16 @@
case WM_WINDOWPOSCHANGED:
{
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:
@@ -1001,6 +1055,15 @@
}
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:
{
@@ -1057,7 +1120,7 @@
case WM_PRINT:
{
- /* FIXME: Implement. */
+ DefWndPrint(hWnd, (HDC)wParam, lParam);
return (0);
}
@@ -1196,6 +1259,9 @@
case WM_CTLCOLORSTATIC:
case WM_CTLCOLORSCROLLBAR:
return (LRESULT) DefWndControlColor((HDC)wParam, Msg - WM_CTLCOLORMSGBOX);
+
+ case WM_CTLCOLOR:
+ return (LRESULT) DefWndControlColor((HDC)wParam, HIWORD(lParam));
case WM_SETCURSOR:
{
@@ -1233,19 +1299,25 @@
return (DefWndHandleSysCommand(hWnd, wParam, Pt));
}
- /* FIXME: Handle key messages. */
-/*
+
case WM_KEYDOWN:
- case WM_KEYUP:
- case WM_SYSKEYUP:
- case WM_SYSCHAR:
-*/
+ if(wParam == VK_F10) iF10Key = VK_F10;
+ break;
/* FIXME: This is also incomplete. */
case WM_SYSKEYDOWN:
{
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 */
{
HWND top = GetAncestor(hWnd, GA_ROOT);
@@ -1262,6 +1334,42 @@
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;
}
@@ -1270,17 +1378,11 @@
LONG Style;
INT Ret = 0;
- if (!lParam)
- return 0;
+ if (!lParam) return 0;
Style = GetWindowLongW(hWnd, GWL_STYLE);
-// if (!(Style & WS_POPUP))
-// return 0;
- if ((Style & WS_VISIBLE) && wParam)
- return 0;
- if (!(Style & WS_VISIBLE) && !wParam)
- return 0;
- if (!GetWindow(hWnd, GW_OWNER))
- return 0;
+ if ((Style & WS_VISIBLE) && wParam) 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);
if(Ret)
{
@@ -1293,7 +1395,9 @@
case WM_CANCELMODE:
{
+ iMenuSysKey = 0;
/* FIXME: Check for a desktop. */
+ if (!(GetWindowLongW( hWnd, GWL_STYLE ) & WS_CHILD)) EndMenu();
if (GetCapture() == hWnd)
{
ReleaseCapture();
@@ -1306,8 +1410,7 @@
return (-1);
/*
case WM_DROPOBJECT:
-
- break;
+ return DRAG_FILE;
*/
case WM_QUERYDROPOBJECT:
{
@@ -1403,6 +1506,11 @@
{
return (1);
}
+
+ case WM_ENDSESSION:
+ if (wParam) PostQuitMessage(0);
+ return 0;
+
}
return 0;
}