From: Rémi Bernon rbernon@codeweavers.com
Fixes NtUserGetWinMonitorDpi always returning the primary monitor DPI. --- dlls/win32u/sysparams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 2fbc90e27e6..3447b0958b9 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -2559,7 +2559,7 @@ UINT get_win_monitor_dpi( HWND hwnd, UINT *raw_dpi ) if (!get_window_rect( hwnd, &rect, dpi )) return 0; } /* avoid recursive calls from get_window_rects for the process windows */ - else if ((parent = win->parent)) + else if ((parent = win->parent) && parent != get_desktop_window()) { release_win_ptr( win ); return get_win_monitor_dpi( parent, raw_dpi );
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/defwnd.c | 13 ++++++++++++- dlls/win32u/driver.c | 2 +- dlls/winemac.drv/macdrv.h | 2 +- dlls/winemac.drv/window.c | 2 +- dlls/winewayland.drv/waylanddrv.h | 2 +- dlls/winewayland.drv/window.c | 2 +- dlls/winex11.drv/mouse.c | 9 +-------- dlls/winex11.drv/window.c | 4 ++-- dlls/winex11.drv/x11drv.h | 4 ++-- include/wine/gdi_driver.h | 2 +- 10 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index f5a88a53c27..4e8af26c4ed 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -947,6 +947,9 @@ static void track_nc_scroll_bar( HWND hwnd, WPARAM wparam, POINT pt )
static LRESULT handle_sys_command( HWND hwnd, WPARAM wparam, LPARAM lparam ) { + POINT pos; + RECT rect; + TRACE( "hwnd %p WM_SYSCOMMAND %lx %lx\n", hwnd, (long)wparam, lparam );
if (!is_window_enabled( hwnd )) return 0; @@ -954,7 +957,15 @@ static LRESULT handle_sys_command( HWND hwnd, WPARAM wparam, LPARAM lparam ) if (call_hooks( WH_CBT, HCBT_SYSCOMMAND, wparam, lparam, 0 )) return 0;
- if (!user_driver->pSysCommand( hwnd, wparam, lparam )) + pos.x = (short)LOWORD( NtUserGetThreadInfo()->message_pos ); + pos.y = (short)HIWORD( NtUserGetThreadInfo()->message_pos ); + NtUserLogicalToPerMonitorDPIPhysicalPoint( hwnd, &pos ); + SetRect( &rect, pos.x, pos.y, pos.x, pos.y ); + rect = map_rect_virt_to_raw( rect, 0 ); + pos.x = rect.left; + pos.y = rect.top; + + if (!user_driver->pSysCommand( hwnd, wparam, lparam, &pos )) return 0;
switch (wparam & 0xfff0) diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 92bad66fc2f..3f5e12df80c 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -857,7 +857,7 @@ static UINT nulldrv_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ) return ~0; /* use default implementation */ }
-static LRESULT nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam ) +static LRESULT nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam, const POINT *pos ) { return -1; } diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index c086a47efc3..4457a7e186c 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -144,7 +144,7 @@ extern void macdrv_SetLayeredWindowAttributes(HWND hwnd, COLORREF key, BYTE alph extern void macdrv_SetWindowStyle(HWND hwnd, INT offset, STYLESTRUCT *style); extern void macdrv_SetWindowText(HWND hwnd, LPCWSTR text); extern UINT macdrv_ShowWindow(HWND hwnd, INT cmd, RECT *rect, UINT swp); -extern LRESULT macdrv_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam); +extern LRESULT macdrv_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam, const POINT *pos); extern void macdrv_UpdateLayeredWindow(HWND hwnd, UINT flags); extern LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); extern BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects); diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index f2cca652045..115820ec376 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1591,7 +1591,7 @@ done: * * Perform WM_SYSCOMMAND handling. */ -LRESULT macdrv_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam) +LRESULT macdrv_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam, const POINT *pos) { struct macdrv_win_data *data; LRESULT ret = -1; diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 8eebee1a5f4..72a37cb3ffb 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -376,7 +376,7 @@ LRESULT WAYLAND_DesktopWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); void WAYLAND_DestroyWindow(HWND hwnd); void WAYLAND_SetCursor(HWND hwnd, HCURSOR hcursor); void WAYLAND_SetWindowText(HWND hwnd, LPCWSTR text); -LRESULT WAYLAND_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam); +LRESULT WAYLAND_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam, const POINT *pos); UINT WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manager, void *param); LRESULT WAYLAND_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, HWND owner_hint, UINT swp_flags, BOOL fullscreen, diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 6ed6cab7991..67718936b53 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -671,7 +671,7 @@ void WAYLAND_SetWindowText(HWND hwnd, LPCWSTR text) /*********************************************************************** * WAYLAND_SysCommand */ -LRESULT WAYLAND_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam) +LRESULT WAYLAND_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam, const POINT *pos) { LRESULT ret = -1; WPARAM command = wparam & 0xfff0; diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index f3c72b2d9f5..5f6b9f34d2a 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1446,22 +1446,15 @@ BOOL X11DRV_ClipCursor( const RECT *clip, BOOL reset ) /*********************************************************************** * move_resize_window */ -void move_resize_window( HWND hwnd, int dir ) +void move_resize_window( HWND hwnd, int dir, POINT pos ) { Display *display = thread_display(); - DWORD pt; - POINT pos; int button = 0; XEvent xev; Window win, root, child; unsigned int xstate;
if (!(win = X11DRV_get_whole_window( hwnd ))) return; - - pt = NtUserGetThreadInfo()->message_pos; - pos.x = (short)LOWORD( pt ); - pos.y = (short)HIWORD( pt ); - NtUserLogicalToPerMonitorDPIPhysicalPoint( hwnd, &pos ); pos = virtual_screen_to_root( pos.x, pos.y );
if (NtUserGetKeyState( VK_LBUTTON ) & 0x8000) button = 1; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 2beb0853c7d..1064f5fb097 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3294,7 +3294,7 @@ static LRESULT start_screensaver(void) * * Perform WM_SYSCOMMAND handling. */ -LRESULT X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam ) +LRESULT X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam, const POINT *pos ) { WPARAM hittest = wparam & 0x0f; int dir; @@ -3355,7 +3355,7 @@ LRESULT X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam ) }
release_win_data( data ); - move_resize_window( hwnd, dir ); + move_resize_window( hwnd, dir, *pos ); return 0;
failed: diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 38503667f23..05032a6a514 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -236,7 +236,7 @@ extern void X11DRV_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ); extern void X11DRV_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ); extern void X11DRV_SetWindowText( HWND hwnd, LPCWSTR text ); extern UINT X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ); -extern LRESULT X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam ); +extern LRESULT X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam, const POINT *pos ); extern LRESULT X11DRV_ClipboardWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern void X11DRV_UpdateClipboard(void); extern void X11DRV_UpdateLayeredWindow( HWND hwnd, UINT flags ); @@ -698,7 +698,7 @@ extern void X11DRV_SetFocus( HWND hwnd ); extern void set_window_cursor( Window window, HCURSOR handle ); extern void reapply_cursor_clipping(void); extern void ungrab_clipping_window(void); -extern void move_resize_window( HWND hwnd, int dir ); +extern void move_resize_window( HWND hwnd, int dir, POINT pos ); extern void X11DRV_InitKeyboard( Display *display ); extern BOOL X11DRV_ProcessEvents( DWORD mask ); extern HWND *build_hwnd_list(void); diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 09b5dd1e73f..b3aba3c2e17 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -380,7 +380,7 @@ struct user_driver_funcs void (*pSetWindowStyle)(HWND,INT,STYLESTRUCT*); void (*pSetWindowText)(HWND,LPCWSTR); UINT (*pShowWindow)(HWND,INT,RECT*,UINT); - LRESULT (*pSysCommand)(HWND,WPARAM,LPARAM); + LRESULT (*pSysCommand)(HWND,WPARAM,LPARAM,const POINT*); void (*pUpdateLayeredWindow)(HWND,UINT); LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); BOOL (*pWindowPosChanging)(HWND,UINT,BOOL,const struct window_rects *);