From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/user32/controls.h | 1 - dlls/user32/defwnd.c | 6 ----- dlls/user32/nonclient.c | 51 ----------------------------------------- dlls/win32u/defwnd.c | 48 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 58 deletions(-)
diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h index a0047d6183d..639b9f2214e 100644 --- a/dlls/user32/controls.h +++ b/dlls/user32/controls.h @@ -121,7 +121,6 @@ extern HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu ) DECLSPEC_HIDDEN; /* nonclient area */ extern LRESULT NC_HandleNCMouseMove( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN; extern LRESULT NC_HandleNCMouseLeave( HWND hwnd ) DECLSPEC_HIDDEN; -extern LRESULT NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN; extern LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
/* scrollbar */ diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index fd6c44dd29b..45f1842714f 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -175,12 +175,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa iF10Key = iMenuSysKey = 0; break;
- case WM_LBUTTONDBLCLK: - return NC_HandleNCLButtonDblClk( hwnd, HTCLIENT, lParam ); - - case WM_NCLBUTTONDBLCLK: - return NC_HandleNCLButtonDblClk( hwnd, wParam, lParam ); - case WM_RBUTTONUP: { POINT pt; diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index cc31e1b2f2f..3844d42adba 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -260,57 +260,6 @@ static void NC_TrackScrollBar( HWND hwnd, WPARAM wParam, POINT pt ) }
-/*********************************************************************** - * NC_HandleNCLButtonDblClk - * - * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc(). - */ -LRESULT NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam ) -{ - /* - * if this is an icon, send a restore since we are handling - * a double click - */ - if (IsIconic(hwnd)) - { - SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, lParam ); - return 0; - } - - switch(wParam) /* Hit test */ - { - case HTCAPTION: - /* stop processing if WS_MAXIMIZEBOX is missing */ - if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_MAXIMIZEBOX) - SendMessageW( hwnd, WM_SYSCOMMAND, - IsZoomed(hwnd) ? SC_RESTORE : SC_MAXIMIZE, lParam ); - break; - - case HTSYSMENU: - { - HMENU hSysMenu = NtUserGetSystemMenu(hwnd, FALSE); - UINT state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND); - - /* If the close item of the sysmenu is disabled or not present do nothing */ - if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF)) - break; - - SendMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, lParam ); - break; - } - - case HTHSCROLL: - SendMessageW( hwnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam ); - break; - - case HTVSCROLL: - SendMessageW( hwnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam ); - break; - } - return 0; -} - - /*********************************************************************** * NC_HandleSysCommand * diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index a385d581d3a..105bb9744ec 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2168,6 +2168,48 @@ static LRESULT handle_nc_rbutton_down( HWND hwnd, WPARAM wparam, LPARAM lparam ) return 0; }
+static LRESULT handle_nc_button_dbl_click( HWND hwnd, WPARAM wparam, LPARAM lparam ) +{ + /*if this is an icon, send a restore since we are handling a double click */ + if (is_iconic(hwnd)) + { + send_message( hwnd, WM_SYSCOMMAND, SC_RESTORE, lparam ); + return 0; + } + + switch (wparam) /* Hit test */ + { + case HTCAPTION: + /* stop processing if WS_MAXIMIZEBOX is missing */ + if (get_window_long( hwnd, GWL_STYLE ) & WS_MAXIMIZEBOX) + send_message( hwnd, WM_SYSCOMMAND, + is_zoomed( hwnd ) ? SC_RESTORE : SC_MAXIMIZE, lparam ); + break; + + case HTSYSMENU: + { + HMENU hSysMenu = NtUserGetSystemMenu( hwnd, FALSE ); + UINT state = get_menu_state( hSysMenu, SC_CLOSE, MF_BYCOMMAND ); + + /* If the close item of the sysmenu is disabled or not present do nothing */ + if ((state & (MF_DISABLED | MF_GRAYED)) || state == 0xffffffff) + break; + + send_message( hwnd, WM_SYSCOMMAND, SC_CLOSE, lparam ); + break; + } + + case HTHSCROLL: + send_message( hwnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lparam ); + break; + + case HTVSCROLL: + send_message( hwnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lparam ); + break; + } + return 0; +} + LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ) { LRESULT result = 0; @@ -2219,6 +2261,12 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, case WM_NCRBUTTONDOWN: return handle_nc_rbutton_down( hwnd, wparam, lparam );
+ case WM_LBUTTONDBLCLK: + return handle_nc_button_dbl_click( hwnd, HTCLIENT, lparam ); + + case WM_NCLBUTTONDBLCLK: + return handle_nc_button_dbl_click( hwnd, wparam, lparam ); + case WM_CONTEXTMENU: if (get_window_long( hwnd, GWL_STYLE ) & WS_CHILD) send_message( get_parent( hwnd ), msg, (WPARAM)hwnd, lparam );