winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
791 discussions
Start a n
N
ew thread
Jacek Caban : win32u: Use NtUserCallHwnd for NtUserSetForegroundWindow.
by Alexandre Julliard
15 Jun '22
15 Jun '22
Module: wine Branch: master Commit: 76a0108c594ec9ac6d52a196c15d8181e89fb350 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=76a0108c594ec9ac6d52a196…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Jun 15 13:30:32 2022 +0200 win32u: Use NtUserCallHwnd for NtUserSetForegroundWindow. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/user32/focus.c | 2 +- dlls/win32u/window.c | 6 +++--- dlls/winemac.drv/window.c | 8 ++++---- dlls/winex11.drv/event.c | 6 +++--- include/ntuser.h | 12 ++++++------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/dlls/user32/focus.c b/dlls/user32/focus.c index 7e1536ab802..bf80777ca97 100644 --- a/dlls/user32/focus.c +++ b/dlls/user32/focus.c @@ -37,7 +37,7 @@ */ BOOL WINAPI SetForegroundWindow( HWND hwnd ) { - return NtUserSetForegroundWindow( hwnd, FALSE ); + return NtUserSetForegroundWindow( hwnd ); } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 431686bdcaa..42274905d5b 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5403,6 +5403,9 @@ ULONG_PTR WINAPI NtUserCallHwnd( HWND hwnd, DWORD code ) case NtUserCallHwnd_IsWindowVisible: return is_window_visible( hwnd ); + case NtUserCallHwnd_SetForegroundWindow: + return set_foreground_window( hwnd, FALSE ); + default: FIXME( "invalid code %u\n", code ); return 0; @@ -5489,9 +5492,6 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) case NtUserCallHwndParam_ScreenToClient: return screen_to_client( hwnd, (POINT *)param ); - case NtUserCallHwndParam_SetForegroundWindow: - return set_foreground_window( hwnd, param ); - case NtUserCallHwndParam_SetWindowContextHelpId: return set_window_context_help_id( hwnd, param ); diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 9d778f427b0..22c250c1d18 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -2350,7 +2350,7 @@ void macdrv_window_got_focus(HWND hwnd, const macdrv_event *event) if (ma != MA_NOACTIVATEANDEAT && ma != MA_NOACTIVATE) { TRACE("setting foreground window to %p\n", hwnd); - NtUserSetForegroundWindow(hwnd, FALSE); + NtUserSetForegroundWindow(hwnd); return; } } @@ -2375,7 +2375,7 @@ void macdrv_window_lost_focus(HWND hwnd, const macdrv_event *event) { send_message(hwnd, WM_CANCELMODE, 0, 0); if (hwnd == NtUserGetForegroundWindow()) - NtUserSetForegroundWindow(NtUserGetDesktopWindow(), FALSE); + NtUserSetForegroundWindow(NtUserGetDesktopWindow()); } } @@ -2404,7 +2404,7 @@ void macdrv_app_deactivated(void) if (get_active_window() == NtUserGetForegroundWindow()) { TRACE("setting fg to desktop\n"); - NtUserSetForegroundWindow(NtUserGetDesktopWindow(), FALSE); + NtUserSetForegroundWindow(NtUserGetDesktopWindow()); } } @@ -2573,7 +2573,7 @@ void macdrv_window_drag_begin(HWND hwnd, const macdrv_event *event) if (ma != MA_NOACTIVATEANDEAT && ma != MA_NOACTIVATE) { TRACE("setting foreground window to %p\n", hwnd); - NtUserSetForegroundWindow(hwnd, FALSE); + NtUserSetForegroundWindow(hwnd); } } diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index f81d2338faf..cbfb228ea09 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -596,7 +596,7 @@ static void set_focus( Display *display, HWND hwnd, Time time ) GUITHREADINFO threadinfo; TRACE( "setting foreground window to %p\n", hwnd ); - NtUserSetForegroundWindow( hwnd, FALSE ); + NtUserSetForegroundWindow( hwnd ); threadinfo.cbSize = sizeof(threadinfo); NtUserGetGUIThreadInfo( 0, &threadinfo ); @@ -812,7 +812,7 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev ) if (!hwnd) hwnd = x11drv_thread_data()->last_focus; if (hwnd && can_activate_window(hwnd)) set_focus( event->display, hwnd, CurrentTime ); } - else NtUserSetForegroundWindow( hwnd, FALSE ); + else NtUserSetForegroundWindow( hwnd ); return TRUE; } @@ -858,7 +858,7 @@ static void focus_out( Display *display , HWND hwnd ) if (hwnd == NtUserGetForegroundWindow()) { TRACE( "lost focus, setting fg to desktop\n" ); - NtUserSetForegroundWindow( NtUserGetDesktopWindow(), FALSE ); + NtUserSetForegroundWindow( NtUserGetDesktopWindow() ); } } } diff --git a/include/ntuser.h b/include/ntuser.h index 1f3cc2f2e7e..0904aadff0f 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -983,6 +983,7 @@ enum NtUserCallHwnd_IsWindowEnabled, NtUserCallHwnd_IsWindowUnicode, NtUserCallHwnd_IsWindowVisible, + NtUserCallHwnd_SetForegroundWindow, }; static inline UINT NtUserArrangeIconicWindows( HWND parent ) @@ -1041,6 +1042,11 @@ static inline BOOL NtUserIsWindowVisible( HWND hwnd ) return NtUserCallHwnd( hwnd, NtUserCallHwnd_IsWindowVisible ); } +static inline BOOL NtUserSetForegroundWindow( HWND hwnd ) +{ + return NtUserCallHwnd( hwnd, NtUserCallHwnd_SetForegroundWindow ); +} + /* NtUserCallHwndParam codes, not compatible with Windows */ enum { @@ -1067,7 +1073,6 @@ enum NtUserCallHwndParam_MirrorRgn, NtUserCallHwndParam_MonitorFromWindow, NtUserCallHwndParam_ScreenToClient, - NtUserCallHwndParam_SetForegroundWindow, NtUserCallHwndParam_SetWindowContextHelpId, NtUserCallHwndParam_SetWindowPixelFormat, NtUserCallHwndParam_ShowOwnedPopups, @@ -1207,11 +1212,6 @@ static inline BOOL NtUserScreenToClient( HWND hwnd, POINT *pt ) return NtUserCallHwndParam( hwnd, (UINT_PTR)pt, NtUserCallHwndParam_ScreenToClient ); } -static inline BOOL NtUserSetForegroundWindow( HWND hwnd, BOOL mouse ) -{ - return NtUserCallHwndParam( hwnd, mouse, NtUserCallHwndParam_SetForegroundWindow ); -} - static inline BOOL NtUserSetWindowContextHelpId( HWND hwnd, DWORD id ) { return NtUserCallHwndParam( hwnd, id, NtUserCallHwndParam_SetWindowContextHelpId );
1
0
0
0
Jacek Caban : win32u: Move WM_NCRBUTTONDOWN implementation from user32.
by Alexandre Julliard
15 Jun '22
15 Jun '22
Module: wine Branch: master Commit: 389832e0d965b086d268cee88539eba12ecce8b8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=389832e0d965b086d268cee8…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Jun 15 13:26:18 2022 +0200 win32u: Move WM_NCRBUTTONDOWN implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/user32/controls.h | 1 - dlls/user32/defwnd.c | 3 --- dlls/user32/nonclient.c | 34 ---------------------------------- dlls/win32u/defwnd.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 38 deletions(-) diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h index eec6a4babe2..d4e8ccd7b08 100644 --- a/dlls/user32/controls.h +++ b/dlls/user32/controls.h @@ -123,7 +123,6 @@ extern HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu ) DECLSPEC_HIDDEN; extern LRESULT NC_HandleNCHitTest( HWND hwnd, POINT pt ) DECLSPEC_HIDDEN; extern LRESULT NC_HandleNCMouseMove( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN; extern LRESULT NC_HandleNCMouseLeave( HWND hwnd ) DECLSPEC_HIDDEN; -extern LRESULT NC_HandleNCRButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) 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; extern LRESULT NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN; diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index 0c783666b7e..a0d6ca44ecb 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -181,9 +181,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_NCLBUTTONDBLCLK: return NC_HandleNCLButtonDblClk( hwnd, wParam, lParam ); - case WM_NCRBUTTONDOWN: - return NC_HandleNCRButtonDown( hwnd, wParam, lParam ); - case WM_RBUTTONUP: { POINT pt; diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index 128f633fa33..174f6e46977 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -717,40 +717,6 @@ static void NC_TrackScrollBar( HWND hwnd, WPARAM wParam, POINT pt ) } -/*********************************************************************** - * NC_HandleNCRButtonDown - * - * Handle a WM_NCRBUTTONDOWN message. Called from DefWindowProc(). - */ -LRESULT NC_HandleNCRButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) -{ - MSG msg; - INT hittest = wParam; - - switch (hittest) - { - case HTCAPTION: - case HTSYSMENU: - NtUserSetCapture( hwnd ); - for (;;) - { - if (!GetMessageW( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST )) break; - if (NtUserCallMsgFilter( &msg, MSGF_MAX )) continue; - if (msg.message == WM_RBUTTONUP) - { - hittest = NC_HandleNCHitTest( hwnd, msg.pt ); - break; - } - } - ReleaseCapture(); - if (hittest == HTCAPTION || hittest == HTSYSMENU) - SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, MAKELPARAM(msg.pt.x, msg.pt.y)); - break; - } - return 0; -} - - /*********************************************************************** * NC_HandleNCLButtonDblClk * diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 780570b5ad4..7126d492c78 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -1961,6 +1961,34 @@ static LRESULT handle_nc_lbutton_down( HWND hwnd, WPARAM wparam, LPARAM lparam ) return 0; } +static LRESULT handle_nc_rbutton_down( HWND hwnd, WPARAM wparam, LPARAM lparam ) +{ + int hittest = wparam; + MSG msg; + + switch (hittest) + { + case HTCAPTION: + case HTSYSMENU: + NtUserSetCapture( hwnd ); + for (;;) + { + if (!NtUserGetMessage( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST )) break; + if (NtUserCallMsgFilter( &msg, MSGF_MAX )) continue; + if (msg.message == WM_RBUTTONUP) + { + hittest = handle_nc_hit_test( hwnd, msg.pt ); + break; + } + } + release_capture(); + if (hittest == HTCAPTION || hittest == HTSYSMENU) + send_message( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, MAKELPARAM( msg.pt.x, msg.pt.y )); + break; + } + return 0; +} + LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ) { LRESULT result = 0; @@ -2009,6 +2037,9 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, case WM_NCLBUTTONDOWN: return handle_nc_lbutton_down( hwnd, wparam, lparam ); + case WM_NCRBUTTONDOWN: + return handle_nc_rbutton_down( hwnd, wparam, lparam ); + case WM_WINDOWPOSCHANGING: return handle_window_pos_changing( hwnd, (WINDOWPOS *)lparam );
1
0
0
0
Jacek Caban : win32u: Move WM_NCLBUTTONDOWN implementation from user32.
by Alexandre Julliard
15 Jun '22
15 Jun '22
Module: wine Branch: master Commit: 8ddf64b69a821d1df029f188755b0928ea81cd9a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8ddf64b69a821d1df029f188…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Jun 15 02:58:19 2022 +0200 win32u: Move WM_NCLBUTTONDOWN implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/user32/controls.h | 1 - dlls/user32/defwnd.c | 3 - dlls/user32/focus.c | 11 -- dlls/user32/nonclient.c | 331 --------------------------------------------- dlls/user32/user_private.h | 1 - dlls/win32u/defwnd.c | 176 +++++++++++++++++++++++- 6 files changed, 175 insertions(+), 348 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=8ddf64b69a821d1df029…
1
0
0
0
Jacek Caban : win32u: Move WM_NCHITTEST implementation from user32.
by Alexandre Julliard
15 Jun '22
15 Jun '22
Module: wine Branch: master Commit: 80ef8832aa697c4e7e16f640f5e722ade6a43fad URL:
https://source.winehq.org/git/wine.git/?a=commit;h=80ef8832aa697c4e7e16f640…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Jun 15 02:01:54 2022 +0200 win32u: Move WM_NCHITTEST implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/user32/defwnd.c | 8 --- dlls/win32u/defwnd.c | 177 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+), 8 deletions(-) diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index 6f2c3013aaa..8f32594fd34 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -165,14 +165,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_NCMOUSELEAVE: return NC_HandleNCMouseLeave( hwnd ); - case WM_NCHITTEST: - { - POINT pt; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); - return NC_HandleNCHitTest( hwnd, pt ); - } - case WM_WINDOWPOSCHANGED: DEFWND_HandleWindowPosChanged( hwnd, (const WINDOWPOS *)lParam ); break; diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 3705cbf8022..6ec27fc6725 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -1621,6 +1621,175 @@ static void handle_nc_calc_size( HWND hwnd, WPARAM wparam, RECT *win_rect ) } } +static LRESULT handle_nc_hit_test( HWND hwnd, POINT pt ) +{ + RECT rect, client_rect; + DWORD style, ex_style; + + TRACE( "hwnd %p pt %d,%d\n", hwnd, pt.x, pt.y ); + + get_window_rects( hwnd, COORDS_SCREEN, &rect, &client_rect, get_thread_dpi() ); + if (!PtInRect( &rect, pt )) return HTNOWHERE; + + style = get_window_long( hwnd, GWL_STYLE ); + ex_style = get_window_long( hwnd, GWL_EXSTYLE ); + + if (PtInRect( &client_rect, pt )) return HTCLIENT; + + /* Check borders */ + if (has_thick_frame( style, ex_style )) + { + InflateRect( &rect, -get_system_metrics( SM_CXFRAME ), -get_system_metrics( SM_CYFRAME )); + if (!PtInRect( &rect, pt )) + { + /* Check top sizing border */ + if (pt.y < rect.top) + { + if (pt.x < rect.left + get_system_metrics( SM_CXSIZE )) return HTTOPLEFT; + if (pt.x >= rect.right - get_system_metrics( SM_CXSIZE )) return HTTOPRIGHT; + return HTTOP; + } + /* Check bottom sizing border */ + if (pt.y >= rect.bottom) + { + if (pt.x < rect.left + get_system_metrics( SM_CXSIZE )) return HTBOTTOMLEFT; + if (pt.x >= rect.right - get_system_metrics( SM_CXSIZE )) return HTBOTTOMRIGHT; + return HTBOTTOM; + } + /* Check left sizing border */ + if (pt.x < rect.left) + { + if (pt.y < rect.top + get_system_metrics( SM_CYSIZE )) return HTTOPLEFT; + if (pt.y >= rect.bottom - get_system_metrics( SM_CYSIZE )) return HTBOTTOMLEFT; + return HTLEFT; + } + /* Check right sizing border */ + if (pt.x >= rect.right) + { + if (pt.y < rect.top + get_system_metrics( SM_CYSIZE )) return HTTOPRIGHT; + if (pt.y >= rect.bottom-get_system_metrics( SM_CYSIZE )) return HTBOTTOMRIGHT; + return HTRIGHT; + } + } + } + else /* No thick frame */ + { + if (has_dialog_frame( style, ex_style )) + InflateRect( &rect, -get_system_metrics( SM_CXDLGFRAME ), + -get_system_metrics( SM_CYDLGFRAME )); + else if (has_thin_frame( style )) + InflateRect(&rect, -get_system_metrics( SM_CXBORDER ), + -get_system_metrics( SM_CYBORDER )); + if (!PtInRect( &rect, pt )) return HTBORDER; + } + + /* Check caption */ + if ((style & WS_CAPTION) == WS_CAPTION) + { + if (ex_style & WS_EX_TOOLWINDOW) + rect.top += get_system_metrics( SM_CYSMCAPTION ) - 1; + else + rect.top += get_system_metrics( SM_CYCAPTION ) - 1; + if (!PtInRect( &rect, pt )) + { + BOOL min_or_max_box = (style & WS_SYSMENU) && (style & (WS_MINIMIZEBOX | WS_MAXIMIZEBOX)); + if (ex_style & WS_EX_LAYOUTRTL) + { + /* Check system menu */ + if ((style & WS_SYSMENU) && !(ex_style & WS_EX_TOOLWINDOW) && + get_nc_icon_for_window( hwnd )) + { + rect.right -= get_system_metrics( SM_CYCAPTION ) - 1; + if (pt.x > rect.right) return HTSYSMENU; + } + + /* Check close button */ + if (style & WS_SYSMENU) + { + rect.left += get_system_metrics( SM_CYCAPTION ); + if (pt.x < rect.left) return HTCLOSE; + } + + if (min_or_max_box && !(ex_style & WS_EX_TOOLWINDOW)) + { + /* Check maximize box */ + rect.left += get_system_metrics( SM_CXSIZE ); + if (pt.x < rect.left) return HTMAXBUTTON; + + /* Check minimize box */ + rect.left += get_system_metrics( SM_CXSIZE ); + if (pt.x < rect.left) return HTMINBUTTON; + } + } + else + { + /* Check system menu */ + if ((style & WS_SYSMENU) && !(ex_style & WS_EX_TOOLWINDOW) && + get_nc_icon_for_window( hwnd )) + { + rect.left += get_system_metrics( SM_CYCAPTION ) - 1; + if (pt.x < rect.left) return HTSYSMENU; + } + + /* Check close button */ + if (style & WS_SYSMENU) + { + rect.right -= get_system_metrics( SM_CYCAPTION ); + if (pt.x > rect.right) return HTCLOSE; + } + + if (min_or_max_box && !(ex_style & WS_EX_TOOLWINDOW)) + { + /* Check maximize box */ + rect.right -= get_system_metrics( SM_CXSIZE ); + if (pt.x > rect.right) return HTMAXBUTTON; + + /* Check minimize box */ + rect.right -= get_system_metrics( SM_CXSIZE ); + if (pt.x > rect.right) return HTMINBUTTON; + } + } + return HTCAPTION; + } + } + + /* Check menu bar */ + if (has_menu( hwnd, style ) && (pt.y < client_rect.top) && + (pt.x >= client_rect.left) && (pt.x < client_rect.right)) + return HTMENU; + + /* Check vertical scroll bar */ + if (ex_style & WS_EX_LAYOUTRTL) ex_style ^= WS_EX_LEFTSCROLLBAR; + if (style & WS_VSCROLL) + { + if (ex_style & WS_EX_LEFTSCROLLBAR) + client_rect.left -= get_system_metrics( SM_CXVSCROLL ); + else + client_rect.right += get_system_metrics( SM_CXVSCROLL ); + if (PtInRect( &client_rect, pt )) return HTVSCROLL; + } + + /* Check horizontal scroll bar */ + if (style & WS_HSCROLL) + { + client_rect.bottom += get_system_metrics( SM_CYHSCROLL ); + if (PtInRect( &client_rect, pt )) + { + /* Check size box */ + if ((style & WS_VSCROLL) && + ((ex_style & WS_EX_LEFTSCROLLBAR) + ? (pt.x <= client_rect.left + get_system_metrics( SM_CXVSCROLL )) + : (pt.x >= client_rect.right - get_system_metrics( SM_CXVSCROLL )))) + return HTSIZE; + return HTHSCROLL; + } + } + + /* Has to return HTNOWHERE if nothing was found + Could happen when a window has a customized non client area */ + return HTNOWHERE; +} + LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ) { LRESULT result = 0; @@ -1652,6 +1821,14 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, handle_nc_calc_size( hwnd, wparam, (RECT *)lparam ); break; + case WM_NCHITTEST: + { + POINT pt; + pt.x = (short)LOWORD( lparam ); + pt.y = (short)HIWORD( lparam ); + return handle_nc_hit_test( hwnd, pt ); + } + case WM_NCPAINT: return handle_nc_paint( hwnd, (HRGN)wparam );
1
0
0
0
Jacek Caban : win32u: Move process default layout handling from user32.
by Alexandre Julliard
15 Jun '22
15 Jun '22
Module: wine Branch: master Commit: 07f2cc9dda1c71a845e901f3270cc19fca9dbed1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=07f2cc9dda1c71a845e901f3…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Jun 15 01:49:12 2022 +0200 win32u: Move process default layout handling from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/user32/class.c | 4 ++++ dlls/user32/win.c | 20 ++++---------------- dlls/win32u/sysparams.c | 8 ++++++++ dlls/win32u/win32u_private.h | 1 + dlls/win32u/window.c | 1 + include/ntuser.h | 12 ++++++++++++ 6 files changed, 30 insertions(+), 16 deletions(-) diff --git a/dlls/user32/class.c b/dlls/user32/class.c index 620477f1b14..76e2688bb82 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -309,6 +309,8 @@ static void load_uxtheme(void) */ BOOL WINAPI User32RegisterBuiltinClasses( const struct win_hook_params *params, ULONG size ) { + DWORD layout; + register_builtin( &BUTTON_builtin_class ); register_builtin( &COMBO_builtin_class ); register_builtin( &COMBOLBOX_builtin_class ); @@ -322,6 +324,8 @@ BOOL WINAPI User32RegisterBuiltinClasses( const struct win_hook_params *params, register_builtin( &STATIC_builtin_class ); register_builtin( &IME_builtin_class ); + GetProcessDefaultLayout( &layout ); /* make sure that process layout is initialized */ + /* Load uxtheme.dll so that standard scrollbars and dialogs are hooked for theming support */ load_uxtheme(); return TRUE; diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 99753791f09..9d19376fe44 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -36,8 +36,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(win); -static DWORD process_layout = ~0u; - /*********************************************************************** * get_user_handle_ptr @@ -626,15 +624,6 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, } } - /* FIXME: move to win32u */ - if (!cs->hwndParent && className != (const WCHAR *)DESKTOP_CLASS_ATOM && - (IS_INTRESOURCE(className) || wcsicmp( className, L"Message" ))) - { - DWORD layout; - GetProcessDefaultLayout( &layout ); - if (layout & LAYOUT_RTL) cs->dwExStyle |= WS_EX_LAYOUTRTL; - } - menu = cs->hMenu; if (!menu && info.lpszMenuName && (cs->style & (WS_CHILD | WS_POPUP)) != WS_CHILD) menu = LoadMenuW( cs->hInstance, info.lpszMenuName ); @@ -1610,7 +1599,8 @@ BOOL WINAPI GetProcessDefaultLayout( DWORD *layout ) SetLastError( ERROR_NOACCESS ); return FALSE; } - if (process_layout == ~0u) + *layout = NtUserGetProcessDefaultLayout(); + if (*layout == ~0u) { WCHAR *str, buffer[MAX_PATH]; DWORD i, version_layout = 0; @@ -1640,9 +1630,8 @@ BOOL WINAPI GetProcessDefaultLayout( DWORD *layout ) done: HeapFree( GetProcessHeap(), 0, data ); - process_layout = version_layout; + NtUserSetProcessDefaultLayout( *layout = version_layout ); } - *layout = process_layout; return TRUE; } @@ -1654,8 +1643,7 @@ BOOL WINAPI GetProcessDefaultLayout( DWORD *layout ) */ BOOL WINAPI SetProcessDefaultLayout( DWORD layout ) { - process_layout = layout; - return TRUE; + return NtUserSetProcessDefaultLayout( layout ); } #ifdef _WIN64 diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 1c1d9ddc621..d4ab352ccbd 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -360,6 +360,7 @@ union sysparam_all_entry static UINT system_dpi; static RECT work_area; +DWORD process_layout = ~0u; static HDC display_dc; static pthread_mutex_t display_dc_lock = PTHREAD_MUTEX_INITIALIZER; @@ -4714,6 +4715,9 @@ ULONG_PTR WINAPI NtUserCallNoParam( ULONG code ) case NtUserCallNoParam_GetInputState: return get_input_state(); + case NtUserCallNoParam_GetProcessDefaultLayout: + return process_layout; + case NtUserCallNoParam_ReleaseCapture: return release_capture(); @@ -4805,6 +4809,10 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) case NtUserCallOneParam_SetCaretBlinkTime: return set_caret_blink_time( arg ); + case NtUserCallOneParam_SetProcessDefaultLayout: + process_layout = arg; + return TRUE; + /* temporary exports */ case NtUserCallHooks: { diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index d1bc382f031..23343c413dc 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -424,6 +424,7 @@ extern LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM /* sysparams.c */ extern BOOL enable_thunk_lock DECLSPEC_HIDDEN; +extern DWORD process_layout DECLSPEC_HIDDEN; extern HBRUSH get_55aa_brush(void) DECLSPEC_HIDDEN; extern DWORD get_dialog_base_units(void) DECLSPEC_HIDDEN; extern LONG get_char_dimensions( HDC hdc, TEXTMETRICW *metric, LONG *height ) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 5575b9a0381..431686bdcaa 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5126,6 +5126,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, (class_name->Length != sizeof(messageW) || wcsnicmp( class_name->Buffer, messageW, ARRAYSIZE(messageW) ))) { + if (process_layout & LAYOUT_RTL) cs.dwExStyle |= WS_EX_LAYOUTRTL; parent = get_desktop_window(); } } diff --git a/include/ntuser.h b/include/ntuser.h index cf8a909493b..1f3cc2f2e7e 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -725,6 +725,7 @@ enum NtUserCallNoParam_GetDesktopWindow, NtUserCallNoParam_GetDialogBaseUnits, NtUserCallNoParam_GetInputState, + NtUserCallNoParam_GetProcessDefaultLayout, NtUserCallNoParam_ReleaseCapture, /* temporary exports */ NtUserExitingThread, @@ -751,6 +752,11 @@ static inline BOOL NtUserGetInputState(void) return NtUserCallNoParam( NtUserCallNoParam_GetInputState ); } +static inline DWORD NtUserGetProcessDefaultLayout(void) +{ + return NtUserCallNoParam( NtUserCallNoParam_GetProcessDefaultLayout ); +} + static inline BOOL NtUserReleaseCapture(void) { return NtUserCallNoParam( NtUserCallNoParam_ReleaseCapture ); @@ -780,6 +786,7 @@ enum NtUserCallOneParam_MessageBeep, NtUserCallOneParam_RealizePalette, NtUserCallOneParam_SetCaretBlinkTime, + NtUserCallOneParam_SetProcessDefaultLayout, /* temporary exports */ NtUserCallHooks, NtUserGetDeskPattern, @@ -898,6 +905,11 @@ static inline UINT NtUserRealizePalette( HDC hdc ) return NtUserCallOneParam( HandleToUlong(hdc), NtUserCallOneParam_RealizePalette ); } +static inline UINT NtUserSetProcessDefaultLayout( DWORD layout ) +{ + return NtUserCallOneParam( layout, NtUserCallOneParam_SetProcessDefaultLayout ); +} + /* NtUserCallTwoParam codes, not compatible with Windows */ enum {
1
0
0
0
Jacek Caban : win32u: Move NtUserInvalidateRect and NtUserInvalidateRgn implementation from user32.
by Alexandre Julliard
15 Jun '22
15 Jun '22
Module: wine Branch: master Commit: 6f3ed5fd64c6708b9811f8c0d58f26b786433655 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6f3ed5fd64c6708b9811f8c0…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sun Jun 12 17:28:56 2022 +0200 win32u: Move NtUserInvalidateRect and NtUserInvalidateRgn implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/user32/button.c | 12 ++++++------ dlls/user32/combo.c | 16 ++++++++-------- dlls/user32/edit.c | 6 +++--- dlls/user32/listbox.c | 28 ++++++++++++++-------------- dlls/user32/menu.c | 4 ++-- dlls/user32/painting.c | 35 ----------------------------------- dlls/user32/scroll.c | 2 +- dlls/user32/user32.spec | 4 ++-- dlls/win32u/dce.c | 30 ++++++++++++++++++++++++++++++ dlls/win32u/gdiobj.c | 2 ++ dlls/win32u/win32u.spec | 4 ++-- dlls/win32u/win32u_private.h | 2 ++ dlls/win32u/wrappers.c | 12 ++++++++++++ include/ntuser.h | 2 ++ 14 files changed, 86 insertions(+), 73 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=6f3ed5fd64c6708b9811…
1
0
0
0
Jacek Caban : win32u: Move WM_KEYF1 implementation from user32.
by Alexandre Julliard
15 Jun '22
15 Jun '22
Module: wine Branch: master Commit: dad8044f1a5a171771f9d172e12f6b39cd60eae7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dad8044f1a5a171771f9d172…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sat Jun 11 02:39:41 2022 +0200 win32u: Move WM_KEYF1 implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/user32/defwnd.c | 23 ----------------------- dlls/win32u/defwnd.c | 27 +++++++++++++++++++++++++++ dlls/win32u/menu.c | 6 ++++++ dlls/win32u/message.c | 2 +- dlls/win32u/win32u_private.h | 2 ++ dlls/win32u/window.c | 4 ++-- 6 files changed, 38 insertions(+), 26 deletions(-) diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index df5aa9353f4..6f2c3013aaa 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -435,29 +435,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa SendMessageW( parent, msg, wParam, lParam ); break; } - case WM_KEYF1: - { - HELPINFO hi; - - hi.cbSize = sizeof(HELPINFO); - GetCursorPos( &hi.MousePos ); - if (MENU_IsMenuActive()) - { - hi.iContextType = HELPINFO_MENUITEM; - hi.hItemHandle = MENU_IsMenuActive(); - hi.iCtrlId = MenuItemFromPoint( hwnd, hi.hItemHandle, hi.MousePos ); - hi.dwContextId = GetMenuContextHelpId( hi.hItemHandle ); - } - else - { - hi.iContextType = HELPINFO_WINDOW; - hi.hItemHandle = hwnd; - hi.iCtrlId = GetWindowLongPtrA( hwnd, GWLP_ID ); - hi.dwContextId = GetWindowContextHelpId( hwnd ); - } - SendMessageW( hwnd, WM_HELP, 0, (LPARAM)&hi ); - break; - } case WM_INPUTLANGCHANGEREQUEST: NtUserActivateKeyboardLayout( (HKL)lParam, 0 ); diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index f9a23bcee3f..3705cbf8022 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -1766,6 +1766,33 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, case WM_SYSCOMMAND: result = handle_sys_command( hwnd, wparam, lparam ); break; + + case WM_KEYF1: + { + HELPINFO hi; + + hi.cbSize = sizeof(HELPINFO); + get_cursor_pos( &hi.MousePos ); + if (is_menu_active()) + { + MENUINFO info = { .cbSize = sizeof(info), .fMask = MIM_HELPID }; + hi.iContextType = HELPINFO_MENUITEM; + hi.hItemHandle = is_menu_active(); + hi.iCtrlId = NtUserMenuItemFromPoint( hwnd, hi.hItemHandle, + hi.MousePos.x, hi.MousePos.y ); + get_menu_info( hi.hItemHandle, &info ); + hi.dwContextId = info.dwContextHelpID; + } + else + { + hi.iContextType = HELPINFO_WINDOW; + hi.hItemHandle = hwnd; + hi.iCtrlId = get_window_long_ptr( hwnd, GWLP_ID, FALSE ); + hi.dwContextId = get_window_context_help_id( hwnd ); + } + send_message( hwnd, WM_HELP, 0, (LPARAM)&hi ); + break; + } } return result; diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c index d84af186da9..8ccece38e74 100644 --- a/dlls/win32u/menu.c +++ b/dlls/win32u/menu.c @@ -2492,3 +2492,9 @@ LRESULT popup_menu_window_proc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l } return 0; } + +HWND is_menu_active(void) +{ + if (!user_callbacks) return 0; + return user_callbacks->is_menu_active(); +} diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index cea1a33812a..f5315ec5dd4 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1346,7 +1346,7 @@ static BOOL process_keyboard_message( MSG *msg, UINT hw_id, HWND hwnd_filter, else if (msg->message == WM_KEYUP) { /* Handle VK_APPS key by posting a WM_CONTEXTMENU message */ - if (msg->wParam == VK_APPS && user_callbacks && !user_callbacks->is_menu_active()) + if (msg->wParam == VK_APPS && !is_menu_active()) NtUserPostMessage( msg->hwnd, WM_CONTEXTMENU, (WPARAM)msg->hwnd, -1 ); } } diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index d3f060669a4..80fe2e027e0 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -402,6 +402,7 @@ extern BOOL get_menu_info( HMENU handle, MENUINFO *info ) DECLSPEC_HIDDEN; extern INT get_menu_item_count( HMENU handle ) DECLSPEC_HIDDEN; extern UINT get_menu_state( HMENU handle, UINT item_id, UINT flags ) DECLSPEC_HIDDEN; extern BOOL is_menu( HMENU handle ) DECLSPEC_HIDDEN; +extern HWND is_menu_active(void) DECLSPEC_HIDDEN; extern LRESULT popup_menu_window_proc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN; extern BOOL set_window_menu( HWND hwnd, HMENU handle ) DECLSPEC_HIDDEN; @@ -463,6 +464,7 @@ extern HWND get_parent( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN; extern DPI_AWARENESS_CONTEXT get_window_dpi_awareness_context( HWND hwnd ) DECLSPEC_HIDDEN; extern MINMAXINFO get_min_max_info( HWND hwnd ) DECLSPEC_HIDDEN; +extern DWORD get_window_context_help_id( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND get_window_relative( HWND hwnd, UINT rel ) DECLSPEC_HIDDEN; extern DWORD get_window_thread( HWND hwnd, DWORD *process ) DECLSPEC_HIDDEN; extern HWND is_current_process_window( HWND hwnd ) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 94f285de2bb..5575b9a0381 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -4524,7 +4524,7 @@ BOOL WINAPI NtUserFlashWindowEx( FLASHWINFO *info ) } /* see GetWindowContextHelpId */ -static DWORD get_window_context_help_id( HWND hwnd ) +DWORD get_window_context_help_id( HWND hwnd ) { DWORD retval; WND *win = get_win_ptr( hwnd ); @@ -4759,7 +4759,7 @@ BOOL WINAPI NtUserDestroyWindow( HWND hwnd ) if (call_hooks( WH_CBT, HCBT_DESTROYWND, (WPARAM)hwnd, 0, TRUE )) return FALSE; - if (user_callbacks && user_callbacks->is_menu_active() == hwnd) + if (user_callbacks && is_menu_active() == hwnd) user_callbacks->pEndMenu(); is_child = (get_window_long( hwnd, GWL_STYLE ) & WS_CHILD) != 0;
1
0
0
0
Jacek Caban : win32u: Move NtUserMenuItemFromPoint implementation from user32.
by Alexandre Julliard
15 Jun '22
15 Jun '22
Module: wine Branch: master Commit: 95b76f510164ec8fbfe0f5ea9b1ed7df64f41e5d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=95b76f510164ec8fbfe0f5ea…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sat Jun 11 02:14:02 2022 +0200 win32u: Move NtUserMenuItemFromPoint implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/user32/menu.c | 14 +------ dlls/win32u/menu.c | 101 ++++++++++++++++++++++++++++++++++++++++++++---- dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 10 +++++ include/ntuser.h | 1 + 7 files changed, 110 insertions(+), 20 deletions(-) diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 73aee6b849d..a06ef21c634 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -4321,19 +4321,9 @@ DWORD WINAPI GetMenuContextHelpId( HMENU menu ) /********************************************************************** * MenuItemFromPoint (USER32.@) */ -INT WINAPI MenuItemFromPoint(HWND hWnd, HMENU hMenu, POINT ptScreen) +INT WINAPI MenuItemFromPoint( HWND hwnd, HMENU menu, POINT pt ) { - POPUPMENU *menu = grab_menu_ptr(hMenu); - UINT pos; - - /*FIXME: Do we have to handle hWnd here? */ - if (!menu) return -1; - - if (MENU_FindItemByCoords( menu, ptScreen, &pos ) != ht_item) - pos = -1; - - release_menu_ptr(menu); - return pos; + return NtUserMenuItemFromPoint( hwnd, menu, pt.x, pt.y ); } diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c index 8367af32395..d84af186da9 100644 --- a/dlls/win32u/menu.c +++ b/dlls/win32u/menu.c @@ -40,6 +40,15 @@ struct accelerator ACCEL table[1]; }; +enum hittest +{ + ht_nowhere, /* outside the menu */ + ht_border, /* anywhere that's not an item or a scroll arrow */ + ht_item, /* a menu item */ + ht_scroll_up, /* scroll up arrow */ + ht_scroll_down /* scroll down arrow */ +}; + /* maximum allowed depth of any branch in the menu tree. * This value is slightly larger than in windows (25) to * stay on the safe side. */ @@ -424,6 +433,76 @@ static UINT find_submenu( HMENU *handle_ptr, HMENU target ) return NO_SELECTED_ITEM; } +/* Adjust menu item rectangle according to scrolling state */ +static void adjust_menu_item_rect( const POPUPMENU *menu, RECT *rect ) +{ + INT scroll_offset = menu->bScrolling ? menu->nScrollPos : 0; + OffsetRect( rect, menu->items_rect.left, menu->items_rect.top - scroll_offset ); +} + +/*********************************************************************** + * find_item_by_coords + * + * Find the item at the specified coordinates (screen coords). Does + * not work for child windows and therefore should not be called for + * an arbitrary system menu. + * + * Returns a hittest code. *pos will contain the position of the + * item or NO_SELECTED_ITEM. If the hittest code is ht_scroll_up + * or ht_scroll_down then *pos will contain the position of the + * item that's just outside the items_rect - ie, the one that would + * be scrolled completely into view. + */ +static enum hittest find_item_by_coords( const POPUPMENU *menu, POINT pt, UINT *pos ) +{ + enum hittest ht = ht_border; + MENUITEM *item; + RECT rect; + UINT i; + + *pos = NO_SELECTED_ITEM; + + if (!get_window_rect( menu->hWnd, &rect, get_thread_dpi() ) || !PtInRect( &rect, pt )) + return ht_nowhere; + + if (get_window_long( menu->hWnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) pt.x = rect.right - 1 - pt.x; + else pt.x -= rect.left; + pt.y -= rect.top; + + if (!PtInRect( &menu->items_rect, pt )) + { + if (!menu->bScrolling || pt.x < menu->items_rect.left || pt.x >= menu->items_rect.right) + return ht_border; + + /* On a scroll arrow. Update pt so that it points to the item just outside items_rect */ + if (pt.y < menu->items_rect.top) + { + ht = ht_scroll_up; + pt.y = menu->items_rect.top - 1; + } + else + { + ht = ht_scroll_down; + pt.y = menu->items_rect.bottom; + } + } + + item = menu->items; + for (i = 0; i < menu->nItems; i++, item++) + { + rect = item->rect; + adjust_menu_item_rect( menu, &rect ); + if (PtInRect( &rect, pt )) + { + *pos = i; + if (ht != ht_scroll_up && ht != ht_scroll_down) ht = ht_item; + break; + } + } + + return ht; +} + /* see GetMenu */ HMENU get_menu( HWND hwnd ) { @@ -1040,6 +1119,21 @@ static HMENU get_sub_menu( HMENU handle, INT pos ) return submenu; } +/********************************************************************** + * NtUserMenuItemFromPoint (win32u.@) + */ +INT WINAPI NtUserMenuItemFromPoint( HWND hwnd, HMENU handle, int x, int y ) +{ + POINT pt = { .x = x, .y = y }; + POPUPMENU *menu; + UINT pos; + + if (!(menu = grab_menu_ptr(handle))) return -1; + if (find_item_by_coords( menu, pt, &pos ) != ht_item) pos = -1; + release_menu_ptr(menu); + return pos; +} + /********************************************************************** * NtUserGetSystemMenu (win32u.@) */ @@ -1823,13 +1917,6 @@ got_bitmap: NtGdiDeleteObjectApp( mem_hdc ); } -/* Adjust menu item rectangle according to scrolling state */ -static void adjust_menu_item_rect( const POPUPMENU *menu, RECT *rect ) -{ - INT scroll_offset = menu->bScrolling ? menu->nScrollPos : 0; - OffsetRect( rect, menu->items_rect.left, menu->items_rect.top - scroll_offset ); -} - /* Draw a single menu item */ static void draw_menu_item( HWND hwnd, POPUPMENU *menu, HWND owner, HDC hdc, MENUITEM *item, BOOL menu_bar, UINT odaction ) diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index ac13580308d..a926049f0ed 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -151,6 +151,7 @@ static void * const syscalls[] = NtUserInternalGetWindowText, NtUserKillTimer, NtUserLockWindowUpdate, + NtUserMenuItemFromPoint, NtUserNotifyWinEvent, NtUserOpenDesktop, NtUserOpenInputDesktop, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 4dfebaa9d2d..f296f162fff 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1078,7 +1078,7 @@ @ stub NtUserMapPointsByVisualIdentifier @ stdcall NtUserMapVirtualKeyEx(long long long) @ stub NtUserMarkWindowForRawMouse -@ stub NtUserMenuItemFromPoint +@ stdcall -syscall NtUserMenuItemFromPoint(long long long long) @ stdcall NtUserMessageCall(long long long long long long long) @ stub NtUserMinInitialize @ stub NtUserMinMaximize diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index e30d367cda7..7c9627a6121 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -138,6 +138,7 @@ SYSCALL_ENTRY( NtUserInternalGetWindowText ) \ SYSCALL_ENTRY( NtUserKillTimer ) \ SYSCALL_ENTRY( NtUserLockWindowUpdate ) \ + SYSCALL_ENTRY( NtUserMenuItemFromPoint ) \ SYSCALL_ENTRY( NtUserNotifyWinEvent ) \ SYSCALL_ENTRY( NtUserOpenDesktop ) \ SYSCALL_ENTRY( NtUserOpenInputDesktop ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index c2d134626f1..51c0a5d0ed8 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -736,6 +736,16 @@ NTSTATUS WINAPI wow64_NtUserGetMenuItemRect( UINT *args ) return NtUserGetMenuItemRect( hwnd, handle, item, rect ); } +NTSTATUS WINAPI wow64_NtUserMenuItemFromPoint( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + HMENU handle = get_handle( &args ); + int x = get_ulong( &args ); + int y = get_ulong( &args ); + + return NtUserMenuItemFromPoint( hwnd, handle, x, y ); +} + NTSTATUS WINAPI wow64_NtUserSetMenuContextHelpId( UINT *args ) { HMENU menu = get_handle( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index 5f744c24906..0415ba076a5 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -620,6 +620,7 @@ BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format ); BOOL WINAPI NtUserKillTimer( HWND hwnd, UINT_PTR id ); BOOL WINAPI NtUserLockWindowUpdate( HWND hwnd ); UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout ); +INT WINAPI NtUserMenuItemFromPoint( HWND hwnd, HMENU handle, int x, int y ); LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, void *result_info, DWORD type, BOOL ansi ); BOOL WINAPI NtUserMoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy, BOOL repaint );
1
0
0
0
Hans Leidekker : cryptnet: Fall back to online CRL verification if OCSP verification fails.
by Alexandre Julliard
15 Jun '22
15 Jun '22
Module: wine Branch: master Commit: 987d637e31ca087487ef26337ad081b9de9ca36a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=987d637e31ca087487ef2633…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Jun 15 14:09:00 2022 +0200 cryptnet: Fall back to online CRL verification if OCSP verification fails. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53136
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53138
--- dlls/cryptnet/cryptnet_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/cryptnet/cryptnet_main.c b/dlls/cryptnet/cryptnet_main.c index cd06c4a3008..19de1ed2d8e 100644 --- a/dlls/cryptnet/cryptnet_main.c +++ b/dlls/cryptnet/cryptnet_main.c @@ -2149,12 +2149,16 @@ static DWORD verify_cert_revocation(const CERT_CONTEXT *cert, FILETIME *pTime, if ((ext = CertFindExtension(szOID_AUTHORITY_INFO_ACCESS, cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension))) { error = verify_cert_revocation_from_aia_ext(&ext->Value, cert, pTime, dwFlags, pRevPara, pRevStatus); + TRACE("verify_cert_revocation_from_aia_ext() returned %08lx\n", error); + if (error == ERROR_SUCCESS || error == CRYPT_E_REVOKED) return error; } - else if ((ext = CertFindExtension(szOID_CRL_DIST_POINTS, cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension))) + if ((ext = CertFindExtension(szOID_CRL_DIST_POINTS, cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension))) { error = verify_cert_revocation_from_dist_points_ext(&ext->Value, cert, pTime, dwFlags, pRevPara, pRevStatus); + TRACE("verify_cert_revocation_from_dist_points_ext() returned %08lx\n", error); + if (error == ERROR_SUCCESS || error == CRYPT_E_REVOKED) return error; } - else + if (!ext) { if (pRevPara && pRevPara->hCrlStore && pRevPara->pIssuerCert) {
1
0
0
0
Hans Leidekker : cryptnet: Move revocation cache check to verify_cert_revocation_from_dist_points_ext().
by Alexandre Julliard
15 Jun '22
15 Jun '22
Module: wine Branch: master Commit: f08dcbf894943f85485f5d34a7120d52320559fc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f08dcbf894943f85485f5d34…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Jun 15 13:57:54 2022 +0200 cryptnet: Move revocation cache check to verify_cert_revocation_from_dist_points_ext(). Paves the way for falling back from OCSP to online CRL verification. It's not clear if a cache is needed for OCSP responses, or if the wininet cache wouldn't be sufficient. --- dlls/cryptnet/cryptnet_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/cryptnet/cryptnet_main.c b/dlls/cryptnet/cryptnet_main.c index b066821a431..cd06c4a3008 100644 --- a/dlls/cryptnet/cryptnet_main.c +++ b/dlls/cryptnet/cryptnet_main.c @@ -1696,6 +1696,9 @@ static DWORD verify_cert_revocation_from_dist_points_ext(const CRYPT_DATA_BLOB * return CRYPT_E_REVOCATION_OFFLINE; } + if (find_cached_revocation_status(&cert->pCertInfo->SerialNumber, time, status)) + return status->dwError; + if (!CRYPT_GetUrlFromCRLDistPointsExt(value, NULL, &url_array_size, NULL, NULL)) return GetLastError(); @@ -2143,9 +2146,6 @@ static DWORD verify_cert_revocation(const CERT_CONTEXT *cert, FILETIME *pTime, DWORD error = ERROR_SUCCESS; PCERT_EXTENSION ext; - if (find_cached_revocation_status(&cert->pCertInfo->SerialNumber, pTime, pRevStatus)) - return pRevStatus->dwError; - if ((ext = CertFindExtension(szOID_AUTHORITY_INFO_ACCESS, cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension))) { error = verify_cert_revocation_from_aia_ext(&ext->Value, cert, pTime, dwFlags, pRevPara, pRevStatus);
1
0
0
0
← Newer
1
...
35
36
37
38
39
40
41
...
80
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Results per page:
10
25
50
100
200