From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/user32/defwnd.c | 90 +------------------------------------------- dlls/win32u/defwnd.c | 80 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 89 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index 45f1842714f..2cfc0b14ff5 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -36,15 +36,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(win);
- /* bits in the dwKeyData */ -#define KEYDATA_ALT 0x2000 -#define KEYDATA_PREVSTATE 0x4000 - #define DRAG_FILE 0x454C4946
-static short iF10Key = 0; -static short iMenuSysKey = 0; - /*********************************************************************** * DEFWND_HandleWindowPosChanged * @@ -169,12 +162,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa DEFWND_HandleWindowPosChanged( hwnd, (const WINDOWPOS *)lParam ); break;
- case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_MBUTTONDOWN: - iF10Key = iMenuSysKey = 0; - break; - case WM_RBUTTONUP: { POINT pt; @@ -222,69 +209,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_SYSCOMMAND: return NC_HandleSysCommand( hwnd, wParam, lParam );
- case WM_KEYDOWN: - if(wParam == VK_F10) iF10Key = VK_F10; - break; - - 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 = NtUserGetAncestor( hwnd, GA_ROOT ); - if (!(GetClassLongW( top, GCL_STYLE ) & CS_NOCLOSE)) - PostMessageW( top, WM_SYSCOMMAND, SC_CLOSE, 0 ); - } - } - else if( wParam == VK_F10 ) - { - if (NtUserGetKeyState(VK_SHIFT) & 0x8000) - SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, -1 ); - iF10Key = 1; - } - else if (wParam == VK_ESCAPE && (NtUserGetKeyState(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( NtUserGetAncestor( 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; - } - case WM_SHOWWINDOW: { LONG style = GetWindowLongW( hwnd, GWL_STYLE ); @@ -310,11 +234,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa break; }
- case WM_CANCELMODE: - iMenuSysKey = 0; - NtUserMessageCall( hwnd, msg, wParam, lParam, 0, NtUserDefWindowProc, FALSE ); - break; - case WM_VKEYTOITEM: case WM_CHARTOITEM: return -1; @@ -485,6 +404,7 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam break;
case WM_SETTEXT: + case WM_SYSCHAR: result = NtUserMessageCall( hwnd, msg, wParam, lParam, 0, NtUserDefWindowProc, TRUE ); break;
@@ -556,14 +476,6 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam } break;
- case WM_SYSCHAR: - { - CHAR ch = LOWORD(wParam); - WCHAR wch; - MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wch, 1); - wParam = MAKEWPARAM( wch, HIWORD(wParam) ); - } - /* fall through */ default: result = DEFWND_DefWinProc( hwnd, msg, wParam, lParam ); break; diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index b67f4de2dd9..71429884b2f 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -31,6 +31,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
+/* bits in the dwKeyData */ +#define KEYDATA_ALT 0x2000 +#define KEYDATA_PREVSTATE 0x4000 + +static short f10_key = 0; +static short menu_sys_key = 0; + static BOOL has_dialog_frame( UINT style, UINT ex_style ) { return (ex_style & WS_EX_DLGMODALFRAME) || ((style & WS_DLGFRAME) && !(style & WS_THICKFRAME)); @@ -2404,6 +2411,7 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, break;
case WM_CANCELMODE: + menu_sys_key = 0; end_menu( hwnd ); if (get_capture() == hwnd) release_capture(); break; @@ -2443,6 +2451,78 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, result = handle_sys_command( hwnd, wparam, lparam ); break;
+ case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_MBUTTONDOWN: + f10_key = menu_sys_key = 0; + break; + + case WM_KEYDOWN: + if (wparam == VK_F10) f10_key = VK_F10; + break; + + case WM_SYSKEYDOWN: + if (HIWORD( lparam ) & KEYDATA_ALT) + { + if ((wparam == VK_MENU || wparam == VK_LMENU || wparam == VK_RMENU) && !menu_sys_key) + menu_sys_key = 1; + else + menu_sys_key = 0; + + f10_key = 0; + + if (wparam == VK_F4) /* try to close the window */ + { + HWND top = NtUserGetAncestor( hwnd, GA_ROOT ); + if (!(get_class_long( top, GCL_STYLE, FALSE ) & CS_NOCLOSE)) + NtUserPostMessage( top, WM_SYSCOMMAND, SC_CLOSE, 0 ); + } + } + else if (wparam == VK_F10) + { + if (NtUserGetKeyState(VK_SHIFT) & 0x8000) + send_message( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, -1 ); + f10_key = 1; + } + else if (wparam == VK_ESCAPE && (NtUserGetKeyState( VK_SHIFT ) & 0x8000)) + send_message( 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) && menu_sys_key) || + (wparam == VK_F10 && f10_key)) + send_message( NtUserGetAncestor( hwnd, GA_ROOT ), WM_SYSCOMMAND, SC_KEYMENU, 0 ); + menu_sys_key = f10_key = 0; + break; + + case WM_SYSCHAR: + menu_sys_key = 0; + if (wparam == '\r' && is_iconic( hwnd )) + { + NtUserPostMessage( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 ); + break; + } + if ((HIWORD( lparam ) & KEYDATA_ALT) && wparam) + { + WCHAR wch; + if (ansi) + { + char ch = wparam; + win32u_mbtowc( &ansi_cp, &wch, 1, &ch, 1 ); + } + else wch = wparam; + if (wch == '\t' || wch == '\x1b') break; + if (wch == ' ' && (get_window_long( hwnd, GWL_STYLE ) & WS_CHILD)) + send_message( get_parent( hwnd ), msg, wch, lparam ); + else + send_message( hwnd, WM_SYSCOMMAND, SC_KEYMENU, wch ); + } + else if (wparam != '\x1b') /* Ctrl-Esc */ + message_beep(0); + break; + case WM_KEYF1: { HELPINFO hi;
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/user32/defwnd.c | 10 ---------- dlls/user32/hook.c | 15 --------------- dlls/user32/win.h | 2 -- dlls/win32u/defwnd.c | 10 ++++++++++ dlls/win32u/sysparams.c | 7 ------- include/ntuser.h | 1 - 6 files changed, 10 insertions(+), 35 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index 2cfc0b14ff5..3eebc952ee1 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -283,16 +283,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa } break;
- case WM_APPCOMMAND: - { - HWND parent = GetParent(hwnd); - if(!parent) - HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam, TRUE); - else - SendMessageW( parent, msg, wParam, lParam ); - break; - } - case WM_INPUTLANGCHANGEREQUEST: NtUserActivateKeyboardLayout( (HKL)lParam, 0 ); break; diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c index 7dddfb02638..4ef1e029609 100644 --- a/dlls/user32/hook.c +++ b/dlls/user32/hook.c @@ -334,21 +334,6 @@ void *get_hook_proc( void *proc, const WCHAR *module, HMODULE *free_module ) }
-/*********************************************************************** - * HOOK_CallHooks - */ -LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ) -{ - struct win_hook_params params; - params.id = id; - params.code = code; - params.wparam = wparam; - params.lparam = lparam; - params.next_unicode = unicode; - return NtUserCallOneParam( (UINT_PTR)¶ms, NtUserCallHooks ); -} - - /*********************************************************************** * SetWindowsHookA (USER32.@) */ diff --git a/dlls/user32/win.h b/dlls/user32/win.h index 1dfc8eb0ad1..5e4ac056c60 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -54,8 +54,6 @@ static inline void WIN_ReleasePtr( WND *ptr ) release_user_handle_ptr( ptr ); }
-extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ) DECLSPEC_HIDDEN; - extern void WINPOS_ActivateOtherWindow( HWND hwnd ) DECLSPEC_HIDDEN;
extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 71429884b2f..b3726bf8e88 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2549,6 +2549,16 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, send_message( hwnd, WM_HELP, 0, (LPARAM)&hi ); break; } + + case WM_APPCOMMAND: + { + HWND parent = get_parent( hwnd ); + if (!parent) + call_hooks( WH_SHELL, HSHELL_APPCOMMAND, wparam, lparam, TRUE ); + else + send_message( parent, msg, wparam, lparam ); + break; + } }
return result; diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 01469c345c2..a8c1d977c7d 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -4814,13 +4814,6 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) return TRUE;
/* temporary exports */ - case NtUserCallHooks: - { - const struct win_hook_params *params = (struct win_hook_params *)arg; - return call_hooks( params->id, params->code, params->wparam, params->lparam, - params->next_unicode ); - } - case NtUserGetDeskPattern: return get_entry( &entry_DESKPATTERN, 256, (WCHAR *)arg );
diff --git a/include/ntuser.h b/include/ntuser.h index 679179851a9..6e6819038ac 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -797,7 +797,6 @@ enum NtUserCallOneParam_SetCaretBlinkTime, NtUserCallOneParam_SetProcessDefaultLayout, /* temporary exports */ - NtUserCallHooks, NtUserGetDeskPattern, NtUserGetWinProcPtr, NtUserLock,
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=117307
Your paranoid android.
=== debian11 (64 bit WoW report) ===
user32: win.c:11770: Test succeeded inside todo block: child should be topmost win.c:11773: Test failed: grandchild should be topmost win.c:11781: Test failed: child should NOT be topmost win.c:11784: Test succeeded inside todo block: grandchild should NOT be topmost win.c:11787: Test failed: 00000000007200BA: expected NOT topmost win.c:11606: Test succeeded inside todo block: 5: hwnd 0000000001320054 is still topmost
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/user32/defwnd.c | 33 --------------------------------- dlls/win32u/defwnd.c | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 33 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index 3eebc952ee1..c40d2ebedab 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -38,35 +38,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
#define DRAG_FILE 0x454C4946
-/*********************************************************************** - * DEFWND_HandleWindowPosChanged - * - * Handle the WM_WINDOWPOSCHANGED message. - */ -static void DEFWND_HandleWindowPosChanged( HWND hwnd, const WINDOWPOS *winpos ) -{ - RECT rect; - - WIN_GetRectangles( hwnd, COORDS_PARENT, NULL, &rect ); - if (!(winpos->flags & SWP_NOCLIENTMOVE)) - SendMessageW( hwnd, WM_MOVE, 0, MAKELONG(rect.left, rect.top)); - - if (!(winpos->flags & SWP_NOCLIENTSIZE) || (winpos->flags & SWP_STATECHANGED)) - { - if (IsIconic( hwnd )) - { - SendMessageW( hwnd, WM_SIZE, SIZE_MINIMIZED, 0 ); - } - else - { - WPARAM wp = IsZoomed( hwnd ) ? SIZE_MAXIMIZED : SIZE_RESTORED; - - SendMessageW( hwnd, WM_SIZE, wp, MAKELONG(rect.right-rect.left, rect.bottom-rect.top) ); - } - } -} - - /*********************************************************************** * DEFWND_ControlColor * @@ -158,10 +129,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_NCMOUSELEAVE: return NC_HandleNCMouseLeave( hwnd );
- case WM_WINDOWPOSCHANGED: - DEFWND_HandleWindowPosChanged( hwnd, (const WINDOWPOS *)lParam ); - break; - case WM_RBUTTONUP: { POINT pt; diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index b3726bf8e88..e367a769401 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -489,6 +489,29 @@ static LONG handle_window_pos_changing( HWND hwnd, WINDOWPOS *winpos ) return 0; }
+static void handle_window_pos_changed( HWND hwnd, const WINDOWPOS *winpos ) +{ + RECT rect; + + get_window_rects( hwnd, COORDS_PARENT, NULL, &rect, get_thread_dpi() ); + if (!(winpos->flags & SWP_NOCLIENTMOVE)) + send_message( hwnd, WM_MOVE, 0, MAKELONG( rect.left, rect.top )); + + if (!(winpos->flags & SWP_NOCLIENTSIZE) || (winpos->flags & SWP_STATECHANGED)) + { + if (is_iconic( hwnd )) + { + send_message( hwnd, WM_SIZE, SIZE_MINIMIZED, 0 ); + } + else + { + WPARAM wp = is_zoomed( hwnd ) ? SIZE_MAXIMIZED : SIZE_RESTORED; + send_message( hwnd, WM_SIZE, wp, + MAKELONG( rect.right-rect.left, rect.bottom-rect.top )); + } + } +} + /*********************************************************************** * draw_moving_frame * @@ -2324,6 +2347,10 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, case WM_WINDOWPOSCHANGING: return handle_window_pos_changing( hwnd, (WINDOWPOS *)lparam );
+ case WM_WINDOWPOSCHANGED: + handle_window_pos_changed( hwnd, (const WINDOWPOS *)lparam ); + break; + case WM_PAINTICON: case WM_PAINT: {
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=117308
Your paranoid android.
=== debian11 (32 bit Chinese:China report) ===
user32: win.c:11787: Test failed: 011D00CE: expected NOT topmost win.c:11606: Test succeeded inside todo block: 5: hwnd 00C00042 is still topmost
On Mon, 20 Jun 2022, Marvin wrote: [...]
=== debian11 (32 bit Chinese:China report) ===
user32: win.c:11787: Test failed: 011D00CE: expected NOT topmost win.c:11606: Test succeeded inside todo block: 5: hwnd 00C00042 is still topmost
This is a preexisting pair of failures but the window handles prevent them from being recognized as such. It's actually part of a group of 7 failures: https://bugs.winehq.org/show_bug.cgi?id=53206
I also added it to the TestBot's list of known failures: https://testbot.winehq.org/FailureDetails.pl?Key=139
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/user32/defwnd.c | 12 ------------ dlls/win32u/defwnd.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index c40d2ebedab..be41f6c47a0 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -161,18 +161,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa DEFWND_Print(hwnd, (HDC)wParam, lParam); return 0;
- case WM_CTLCOLORMSGBOX: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLORSTATIC: - case WM_CTLCOLORSCROLLBAR: - return (LRESULT)DEFWND_ControlColor( (HDC)wParam, msg - WM_CTLCOLORMSGBOX ); - - case WM_CTLCOLOR: - return (LRESULT)DEFWND_ControlColor( (HDC)wParam, HIWORD(lParam) ); - case WM_SYSCOMMAND: return NC_HandleSysCommand( hwnd, wParam, lParam );
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index e367a769401..506ff0f9fd9 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2261,6 +2261,38 @@ static LRESULT handle_nc_button_dbl_click( HWND hwnd, WPARAM wparam, LPARAM lpar return 0; }
+static HBRUSH handle_control_color( HDC hdc, UINT type ) +{ + if (type == CTLCOLOR_SCROLLBAR) + { + HBRUSH hb = get_sys_color_brush( COLOR_SCROLLBAR ); + COLORREF bk = get_sys_color( COLOR_3DHILIGHT ); + NtGdiGetAndSetDCDword( hdc, NtGdiSetTextColor, get_sys_color( COLOR_3DFACE ), NULL ); + NtGdiGetAndSetDCDword( hdc, NtGdiSetBkColor, bk, NULL ); + + /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT + * we better use 0x55aa bitmap brush to make scrollbar's background + * look different from the window background. + */ + if (bk == get_sys_color( COLOR_WINDOW )) return get_55aa_brush(); + + NtGdiUnrealizeObject( hb ); + return hb; + } + + NtGdiGetAndSetDCDword( hdc, NtGdiSetTextColor, get_sys_color( COLOR_WINDOWTEXT ), NULL ); + + if (type == CTLCOLOR_EDIT || type == CTLCOLOR_LISTBOX) + NtGdiGetAndSetDCDword( hdc, NtGdiSetBkColor, get_sys_color( COLOR_WINDOW ), NULL ); + else + { + NtGdiGetAndSetDCDword( hdc, NtGdiSetBkColor, get_sys_color( COLOR_3DFACE ), NULL); + return get_sys_color_brush( COLOR_3DFACE ); + } + + return get_sys_color_brush( COLOR_WINDOW ); +} + LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ) { LRESULT result = 0; @@ -2474,6 +2506,18 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, handle_set_cursor( hwnd, wparam, lparam ); break;
+ case WM_CTLCOLORMSGBOX: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSTATIC: + case WM_CTLCOLORSCROLLBAR: + return (LRESULT)handle_control_color( (HDC)wparam, msg - WM_CTLCOLORMSGBOX ); + + case WM_CTLCOLOR: + return (LRESULT)handle_control_color( (HDC)wparam, HIWORD( lparam )); + case WM_SYSCOMMAND: result = handle_sys_command( hwnd, wparam, lparam ); break;
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/user32/defwnd.c | 43 ------------------------------------------- dlls/win32u/defwnd.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 43 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index be41f6c47a0..dcc0f4d2138 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -75,45 +75,6 @@ HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType ) }
-/*********************************************************************** - * DEFWND_Print - * - * This method handles the default behavior for the WM_PRINT message. - */ -static void DEFWND_Print( 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) ) - { - WARN("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, uFlags); -} - - - /*********************************************************************** * DEFWND_DefWinProc * @@ -157,10 +118,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa } break;
- case WM_PRINT: - DEFWND_Print(hwnd, (HDC)wParam, lParam); - return 0; - case WM_SYSCOMMAND: return NC_HandleSysCommand( hwnd, wParam, lParam );
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 506ff0f9fd9..0470ed77eac 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2621,6 +2621,16 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, break; }
+ case WM_PRINT: + if ((lparam & PRF_CHECKVISIBLE) && !is_window_visible ( hwnd )) break; + + if (lparam & (PRF_CHILDREN | PRF_OWNED | PRF_NONCLIENT)) + WARN( "WM_PRINT message with unsupported lparam %lx\n", lparam ); + + if (lparam & PRF_ERASEBKGND) send_message( hwnd, WM_ERASEBKGND, wparam, 0 ); + if (lparam & PRF_CLIENT) send_message(hwnd, WM_PRINTCLIENT, wparam, lparam ); + break; + case WM_APPCOMMAND: { HWND parent = get_parent( hwnd );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=117310
Your paranoid android.
=== debian11 (64 bit WoW report) ===
user32: input.c:2870: Test failed: 15: expected WM_INPUT message input.c:2873: Test failed: 15: expected RIM_INPUT message
On Mon, 20 Jun 2022, Marvin wrote: [...]
=== debian11 (64 bit WoW report) ===
user32: input.c:2870: Test failed: 15: expected WM_INPUT message input.c:2873: Test failed: 15: expected RIM_INPUT message
This is a preexisting pair of failures: https://bugs.winehq.org/show_bug.cgi?id=53205
I also added it to the TestBot's list of known failures: http://winetestbot.dolphin/FailureDetails.pl?Key=138
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/user32/defwnd.c | 98 ------------------------------- dlls/win32u/defwnd.c | 109 +++++++++++++++++++++++++++++++++++ dlls/win32u/win32u_private.h | 1 + dlls/win32u/window.c | 2 +- 4 files changed, 111 insertions(+), 99 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index dcc0f4d2138..96dd2e873fa 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -36,8 +36,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(win);
-#define DRAG_FILE 0x454C4946 - /*********************************************************************** * DEFWND_ControlColor * @@ -90,34 +88,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_NCMOUSELEAVE: return NC_HandleNCMouseLeave( hwnd );
- case WM_RBUTTONUP: - { - POINT pt; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); - ClientToScreen(hwnd, &pt); - SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, MAKELPARAM(pt.x, pt.y) ); - } - 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_XBUTTONUP: - case WM_NCXBUTTONUP: - if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2) - { - SendMessageW(hwnd, WM_APPCOMMAND, (WPARAM)hwnd, - MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam))); - } - break; - case WM_SYSCOMMAND: return NC_HandleSysCommand( hwnd, wParam, lParam );
@@ -146,74 +116,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa break; }
- case WM_VKEYTOITEM: - case WM_CHARTOITEM: - return -1; - - case WM_DROPOBJECT: - return DRAG_FILE; - - case WM_QUERYDROPOBJECT: - return (GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES) != 0; - - case WM_QUERYDRAGICON: - { - UINT len; - - HICON hIcon = (HICON)GetClassLongPtrW( hwnd, GCLP_HICON ); - HINSTANCE instance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); - if (hIcon) return (LRESULT)hIcon; - for(len=1; len<64; len++) - if((hIcon = LoadIconW(instance, MAKEINTRESOURCEW(len)))) - return (LRESULT)hIcon; - return (LRESULT)LoadIconW(0, (LPWSTR)IDI_APPLICATION); - } - break; - - case WM_ISACTIVEICON: - return (win_get_flags( hwnd ) & WIN_NCACTIVATED) != 0; - - case WM_NOTIFYFORMAT: - if (IsWindowUnicode(hwnd)) return NFR_UNICODE; - else return NFR_ANSI; - - case WM_QUERYOPEN: - case WM_QUERYENDSESSION: - return 1; - - case WM_HELP: - SendMessageW( GetParent(hwnd), msg, wParam, lParam ); - break; - - case WM_STYLECHANGED: - if (wParam == GWL_STYLE && (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED)) - { - STYLESTRUCT *style = (STYLESTRUCT *)lParam; - if ((style->styleOld ^ style->styleNew) & (WS_CAPTION|WS_THICKFRAME|WS_VSCROLL|WS_HSCROLL)) - NtUserSetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER | - SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE ); - } - break; - - case WM_INPUTLANGCHANGEREQUEST: - NtUserActivateKeyboardLayout( (HKL)lParam, 0 ); - break; - - case WM_INPUTLANGCHANGE: - { - struct user_thread_info *info = get_user_thread_info(); - int count = 0; - HWND *win_array = WIN_ListChildren( hwnd ); - info->kbd_layout = (HKL)lParam; - - if (!win_array) - break; - while (win_array[count]) - SendMessageW( win_array[count++], WM_INPUTLANGCHANGE, wParam, lParam); - HeapFree(GetProcessHeap(),0,win_array); - break; - } - default: return NtUserMessageCall( hwnd, msg, wParam, lParam, 0, NtUserDefWindowProc, FALSE );
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 0470ed77eac..5625f15d42a 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -31,6 +31,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
+#define DRAG_FILE 0x454c4946 + /* bits in the dwKeyData */ #define KEYDATA_ALT 0x2000 #define KEYDATA_PREVSTATE 0x4000 @@ -2350,6 +2352,28 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, case WM_NCLBUTTONDBLCLK: return handle_nc_button_dbl_click( hwnd, wparam, lparam );
+ case WM_RBUTTONUP: + { + POINT pt; + pt.x = (short)LOWORD( lparam ); + pt.y = (short)HIWORD( lparam ); + client_to_screen( hwnd, &pt ); + send_message( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, MAKELPARAM( pt.x, pt.y )); + } + break; + + case WM_NCRBUTTONUP: + break; + + case WM_XBUTTONUP: + case WM_NCXBUTTONUP: + if (HIWORD(wparam) == XBUTTON1 || HIWORD(wparam) == XBUTTON2) + { + send_message( hwnd, WM_APPCOMMAND, (WPARAM)hwnd, + MAKELPARAM( LOWORD( wparam ), FAPPCOMMAND_MOUSE | HIWORD( wparam ))); + } + break; + case WM_CONTEXTMENU: if (get_window_long( hwnd, GWL_STYLE ) & WS_CHILD) send_message( get_parent( hwnd ), msg, (WPARAM)hwnd, lparam ); @@ -2640,6 +2664,91 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, send_message( parent, msg, wparam, lparam ); break; } + + case WM_VKEYTOITEM: + case WM_CHARTOITEM: + result = -1; + break; + + case WM_DROPOBJECT: + result = DRAG_FILE; + break; + + case WM_QUERYDROPOBJECT: + result = (get_window_long( hwnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES) != 0; + break; + + case WM_QUERYDRAGICON: + { + UINT len; + HICON icon = (HICON)get_class_long_ptr( hwnd, GCLP_HICON, FALSE ); + HINSTANCE instance = (HINSTANCE)get_window_long_ptr( hwnd, GWLP_HINSTANCE, FALSE ); + + if (icon) + { + result = (LRESULT)icon; + break; + } + + for (len = 1; len < 64; len++) + { + if((icon = LoadImageW( instance, MAKEINTRESOURCEW( len ), IMAGE_ICON, 0, 0, + LR_SHARED | LR_DEFAULTSIZE ))) + { + result = (LRESULT)icon; + break; + } + } + if (!result) result = (LRESULT)LoadImageW( 0, (WCHAR *)IDI_APPLICATION, IMAGE_ICON, + 0, 0, LR_SHARED | LR_DEFAULTSIZE ); + break; + } + + case WM_ISACTIVEICON: + result = (win_get_flags( hwnd ) & WIN_NCACTIVATED) != 0; + break; + + case WM_NOTIFYFORMAT: + result = is_window_unicode(hwnd) ? NFR_UNICODE : NFR_ANSI; + break; + + case WM_QUERYOPEN: + case WM_QUERYENDSESSION: + result = 1; + break; + + case WM_HELP: + send_message( get_parent( hwnd ), msg, wparam, lparam ); + break; + + case WM_STYLECHANGED: + if (wparam == GWL_STYLE && (get_window_long( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED)) + { + STYLESTRUCT *style = (STYLESTRUCT *)lparam; + if ((style->styleOld ^ style->styleNew) & (WS_CAPTION|WS_THICKFRAME|WS_VSCROLL|WS_HSCROLL)) + NtUserSetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER | + SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE ); + } + break; + + case WM_INPUTLANGCHANGEREQUEST: + NtUserActivateKeyboardLayout( (HKL)lparam, 0 ); + break; + + case WM_INPUTLANGCHANGE: + { + struct user_thread_info *info = get_user_thread_info(); + HWND *win_array = list_window_children( 0, hwnd, NULL, 0 ); + int count = 0; + info->kbd_layout = (HKL)lparam; + + if (!win_array) + break; + while (win_array[count]) + send_message( win_array[count++], WM_INPUTLANGCHANGE, wparam, lparam ); + free( win_array ); + break; + } }
return result; diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index b2d16b07d8e..808d3f83e37 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -473,6 +473,7 @@ extern void user_check_not_lock(void) DECLSPEC_HIDDEN; /* window.c */ struct tagWND; extern HDWP begin_defer_window_pos( INT count ) DECLSPEC_HIDDEN; +extern BOOL client_to_screen( HWND hwnd, POINT *pt ) DECLSPEC_HIDDEN; extern void destroy_thread_windows(void) DECLSPEC_HIDDEN; extern LRESULT destroy_window( HWND hwnd ) DECLSPEC_HIDDEN; extern BOOL get_client_rect( HWND hwnd, RECT *rect ) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index e8562f6a685..4a6b321d391 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2840,7 +2840,7 @@ other_process: /* one of the parents may belong to another process, do it the h }
/* see ClientToScreen */ -static BOOL client_to_screen( HWND hwnd, POINT *pt ) +BOOL client_to_screen( HWND hwnd, POINT *pt ) { POINT offset; BOOL mirrored;
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/user32/defwnd.c | 84 ++++++++++++++------------------------------ dlls/win32u/defwnd.c | 25 +++++++++++++ 2 files changed, 51 insertions(+), 58 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index 96dd2e873fa..16442b6899e 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -73,57 +73,6 @@ HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType ) }
-/*********************************************************************** - * DEFWND_DefWinProc - * - * Default window procedure for messages that are the same in Ansi and Unicode. - */ -static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) -{ - switch(msg) - { - case WM_NCMOUSEMOVE: - return NC_HandleNCMouseMove( hwnd, wParam, lParam ); - - case WM_NCMOUSELEAVE: - return NC_HandleNCMouseLeave( hwnd ); - - case WM_SYSCOMMAND: - return NC_HandleSysCommand( hwnd, wParam, lParam ); - - case WM_SHOWWINDOW: - { - LONG style = GetWindowLongW( hwnd, GWL_STYLE ); - WND *pWnd; - if (!lParam) return 0; /* sent from ShowWindow */ - if ((style & WS_VISIBLE) && wParam) return 0; - if (!(style & WS_VISIBLE) && !wParam) return 0; - if (!GetWindow( hwnd, GW_OWNER )) return 0; - if (!(pWnd = WIN_GetPtr( hwnd ))) return 0; - if (pWnd == WND_OTHER_PROCESS) return 0; - if (wParam) - { - if (!(pWnd->flags & WIN_NEEDS_SHOW_OWNEDPOPUP)) - { - WIN_ReleasePtr( pWnd ); - return 0; - } - pWnd->flags &= ~WIN_NEEDS_SHOW_OWNEDPOPUP; - } - else pWnd->flags |= WIN_NEEDS_SHOW_OWNEDPOPUP; - WIN_ReleasePtr( pWnd ); - NtUserShowWindow( hwnd, wParam ? SW_SHOWNOACTIVATE : SW_HIDE ); - break; - } - - default: - return NtUserMessageCall( hwnd, msg, wParam, lParam, 0, NtUserDefWindowProc, FALSE ); - - } - - return 0; -} - static LPARAM DEFWND_GetTextA( WND *wndPtr, LPSTR dest, WPARAM wParam ) { LPARAM result = 0; @@ -184,6 +133,18 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam } break;
+ case WM_NCMOUSEMOVE: + result = NC_HandleNCMouseMove( hwnd, wParam, lParam ); + break; + + case WM_NCMOUSELEAVE: + result = NC_HandleNCMouseLeave( hwnd ); + break; + + case WM_SYSCOMMAND: + result = NC_HandleSysCommand( hwnd, wParam, lParam ); + break; + case WM_GETTEXTLENGTH: { WND *wndPtr = WIN_GetPtr( hwnd ); @@ -207,11 +168,6 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam } break;
- case WM_SETTEXT: - case WM_SYSCHAR: - result = NtUserMessageCall( hwnd, msg, wParam, lParam, 0, NtUserDefWindowProc, TRUE ); - break; - case WM_IME_CHAR: if (HIBYTE(wParam)) PostMessageA( hwnd, WM_CHAR, HIBYTE(wParam), lParam ); PostMessageA( hwnd, WM_CHAR, LOBYTE(wParam), lParam ); @@ -281,7 +237,7 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam break;
default: - result = DEFWND_DefWinProc( hwnd, msg, wParam, lParam ); + result = NtUserMessageCall( hwnd, msg, wParam, lParam, 0, NtUserDefWindowProc, TRUE ); break; }
@@ -357,6 +313,18 @@ LRESULT WINAPI DefWindowProcW( } break;
+ case WM_NCMOUSEMOVE: + result = NC_HandleNCMouseMove( hwnd, wParam, lParam ); + break; + + case WM_NCMOUSELEAVE: + result = NC_HandleNCMouseLeave( hwnd ); + break; + + case WM_SYSCOMMAND: + result = NC_HandleSysCommand( hwnd, wParam, lParam ); + break; + case WM_GETTEXTLENGTH: { WND *wndPtr = WIN_GetPtr( hwnd ); @@ -431,7 +399,7 @@ LRESULT WINAPI DefWindowProcW( break;
default: - result = DEFWND_DefWinProc( hwnd, msg, wParam, lParam ); + result = NtUserMessageCall( hwnd, msg, wParam, lParam, 0, NtUserDefWindowProc, FALSE ); break; } SPY_ExitMessage( SPY_RESULT_DEFWND, hwnd, msg, result, wParam, lParam ); diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 5625f15d42a..90323e304fc 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2530,6 +2530,31 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, handle_set_cursor( hwnd, wparam, lparam ); break;
+ case WM_SHOWWINDOW: + { + LONG style = get_window_long( hwnd, GWL_STYLE ); + WND *win; + if (!lparam) break; /* sent from ShowWindow */ + if ((style & WS_VISIBLE) && wparam) break; + if (!(style & WS_VISIBLE) && !wparam) break; + if (!get_window_relative( hwnd, GW_OWNER )) break; + if (!(win = get_win_ptr( hwnd ))) break; + if (win == WND_OTHER_PROCESS) break; + if (wparam) + { + if (!(win->flags & WIN_NEEDS_SHOW_OWNEDPOPUP)) + { + release_win_ptr( win ); + break; + } + win->flags &= ~WIN_NEEDS_SHOW_OWNEDPOPUP; + } + else win->flags |= WIN_NEEDS_SHOW_OWNEDPOPUP; + release_win_ptr( win ); + NtUserShowWindow( hwnd, wparam ? SW_SHOWNOACTIVATE : SW_HIDE ); + break; + } + case WM_CTLCOLORMSGBOX: case WM_CTLCOLOREDIT: case WM_CTLCOLORLISTBOX:
This merge request was approved by Huw Davies.