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: