From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/clipboard.c | 16 +++++--- dlls/win32u/clipping.c | 5 ++- dlls/win32u/input.c | 35 ++++++---------- dlls/win32u/message.c | 6 ++- dlls/win32u/sysparams.c | 56 +++++++++++++++++++++++++- dlls/win32u/win32u_private.h | 5 ++- dlls/win32u/window.c | 30 +++++++------- dlls/wineandroid.drv/init.c | 2 +- dlls/wineandroid.drv/window.c | 4 +- dlls/winemac.drv/window.c | 2 +- dlls/winewayland.drv/wayland_surface.c | 4 +- dlls/winewayland.drv/window.c | 2 +- dlls/winex11.drv/display.c | 4 +- dlls/winex11.drv/event.c | 2 +- dlls/winex11.drv/init.c | 2 +- dlls/winex11.drv/mouse.c | 4 +- dlls/winex11.drv/opengl.c | 4 +- dlls/winex11.drv/vulkan.c | 4 +- dlls/winex11.drv/window.c | 2 +- dlls/winex11.drv/x11drv.h | 2 +- 20 files changed, 123 insertions(+), 68 deletions(-)
diff --git a/dlls/win32u/clipboard.c b/dlls/win32u/clipboard.c index e8d16291cd1..ee75a239efc 100644 --- a/dlls/win32u/clipboard.c +++ b/dlls/win32u/clipboard.c @@ -770,16 +770,17 @@ LRESULT drag_drop_call( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, void return KeUserModeCallback( NtUserDragDropLeave, 0, 0, &ret_ptr, &ret_len ); case WINE_DRAG_DROP_DRAG: { + RECT rect = {LOWORD(wparam), HIWORD(wparam), LOWORD(wparam), HIWORD(wparam)}; struct drag_drop_drag_params params = { .hwnd = hwnd, - .point.x = LOWORD(wparam), - .point.y = HIWORD(wparam), .effect = lparam, }; - UINT raw_dpi;
- params.point = map_dpi_point( params.point, get_win_monitor_dpi( hwnd, &raw_dpi ), get_thread_dpi() ); + rect = map_rect_raw_to_virt( rect, get_thread_dpi() ); + params.point.x = rect.left; + params.point.y = rect.top; + if (KeUserModeCallback( NtUserDragDropDrag, ¶ms, sizeof(params), &ret_ptr, &ret_len ) || ret_len != sizeof(DWORD)) return DROPEFFECT_NONE; return *(DWORD *)ret_ptr; @@ -796,9 +797,9 @@ LRESULT drag_drop_call( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, void { struct drag_drop_post_params *params; const DROPFILES *drop = (DROPFILES *)lparam; + RECT rect = {drop->pt.x, drop->pt.y, drop->pt.x, drop->pt.y}; UINT drop_size = wparam, size; NTSTATUS status; - UINT raw_dpi;
size = offsetof(struct drag_drop_post_params, drop) + drop_size; if (!(params = malloc( size ))) return STATUS_NO_MEMORY; @@ -806,7 +807,10 @@ LRESULT drag_drop_call( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, void params->drop_size = drop_size; memcpy( ¶ms->drop, drop, drop_size );
- params->drop.pt = map_dpi_point( params->drop.pt, get_win_monitor_dpi( hwnd, &raw_dpi ), get_thread_dpi() ); + rect = map_rect_raw_to_virt( rect, get_thread_dpi() ); + params->drop.pt.x = rect.left; + params->drop.pt.y = rect.top; + status = KeUserModeCallback( NtUserDragDropPost, params, size, &ret_ptr, &ret_len ); free( params ); return status; diff --git a/dlls/win32u/clipping.c b/dlls/win32u/clipping.c index 3681b542fc3..610c2b430e3 100644 --- a/dlls/win32u/clipping.c +++ b/dlls/win32u/clipping.c @@ -463,11 +463,12 @@ INT WINAPI NtGdiGetRandomRgn( HDC hDC, HRGN hRgn, INT iCode ) if (ret > 0 && (iCode & NTGDI_RGN_MONITOR_DPI)) { HWND hwnd = NtUserWindowFromDC( hDC ); - UINT raw_dpi, monitor_dpi = get_win_monitor_dpi( hwnd, &raw_dpi ); + UINT raw_dpi; HRGN region;
+ get_win_monitor_dpi( hwnd, &raw_dpi ); NtGdiOffsetRgn( hRgn, -dc->attr->vis_rect.left, -dc->attr->vis_rect.top ); - region = map_dpi_region( hRgn, get_dpi_for_window( hwnd ), monitor_dpi ); + region = map_dpi_region( hRgn, get_dpi_for_window( hwnd ), raw_dpi ); NtGdiCombineRgn( hRgn, region, 0, RGN_COPY ); NtGdiDeleteObjectApp( region ); } diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 0640b34ac2e..c976b57b39f 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -709,11 +709,8 @@ BOOL WINAPI NtUserSetCursorPos( INT x, INT y ) RECT rect = {x, y, x, y}; BOOL ret; INT prev_x, prev_y, new_x, new_y; - UINT dpi, raw_dpi; - - dpi = monitor_dpi_from_rect( rect, get_thread_dpi(), &raw_dpi ); - rect = map_dpi_rect( rect, get_thread_dpi(), dpi );
+ rect = map_rect_virt_to_raw( rect, get_thread_dpi() ); SERVER_START_REQ( set_cursor ) { req->flags = SET_CURSOR_POS; @@ -743,7 +740,6 @@ BOOL get_cursor_pos( POINT *pt ) DWORD last_change = 0; NTSTATUS status; RECT rect; - UINT dpi, raw_dpi;
if (!pt) return FALSE;
@@ -760,8 +756,7 @@ BOOL get_cursor_pos( POINT *pt ) if (!ret) return FALSE;
SetRect( &rect, pt->x, pt->y, pt->x, pt->y ); - dpi = monitor_dpi_from_rect( rect, get_thread_dpi(), &raw_dpi ); - rect = map_dpi_rect( rect, dpi, get_thread_dpi() ); + rect = map_rect_raw_to_virt( rect, get_thread_dpi() ); *pt = *(POINT *)&rect.left; return ret; } @@ -2357,6 +2352,7 @@ BOOL set_ime_composition_rect( HWND hwnd, RECT rect ) { if (!NtUserIsWindow( hwnd )) return FALSE; NtUserMapWindowPoints( hwnd, 0, (POINT *)&rect, 2, 0 /* per-monitor DPI */ ); + rect = map_rect_virt_to_raw( rect, 0 /* per-monitor DPI */ ); return user_driver->pSetIMECompositionRect( NtUserGetAncestor( hwnd, GA_ROOT ), rect ); }
@@ -2561,7 +2557,8 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset )
ctx = set_thread_dpi_awareness_context( NTUSER_DPI_PER_MONITOR_AWARE ); monitor_info = monitor_info_from_window( hwnd, MONITOR_DEFAULTTONEAREST ); - virtual_rect = get_virtual_screen_rect( 0, MDT_DEFAULT ); + virtual_rect = get_virtual_screen_rect( get_thread_dpi(), MDT_DEFAULT ); + rect = map_rect_virt_to_raw( monitor_info.rcMonitor, get_thread_dpi() ); set_thread_dpi_awareness_context( ctx );
if (!grab_fullscreen) @@ -2575,7 +2572,7 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) SERVER_START_REQ( set_cursor ) { req->flags = SET_CURSOR_CLIP | SET_CURSOR_FSCLIP; - req->clip = wine_server_rectangle( monitor_info.rcMonitor ); + req->clip = wine_server_rectangle( rect ); ret = !wine_server_call( req ); } SERVER_END_REQ; @@ -2595,7 +2592,7 @@ BOOL WINAPI NtUserGetPointerInfoList( UINT32 id, POINTER_INPUT_TYPE type, UINT_P return FALSE; }
-BOOL get_clip_cursor( RECT *rect, UINT dpi ) +BOOL get_clip_cursor( RECT *rect, UINT dpi, MONITOR_DPI_TYPE type ) { struct object_lock lock = OBJECT_LOCK_INIT; const desktop_shm_t *desktop_shm; @@ -2606,20 +2603,14 @@ BOOL get_clip_cursor( RECT *rect, UINT dpi ) while ((status = get_shared_desktop( &lock, &desktop_shm )) == STATUS_PENDING) *rect = wine_server_get_rect( desktop_shm->cursor.clip );
- if (!status) - { - UINT ctx = set_thread_dpi_awareness_context( NTUSER_DPI_PER_MONITOR_AWARE ); - UINT raw_dpi, dpi_from = monitor_dpi_from_rect( *rect, get_thread_dpi(), &raw_dpi ); - *rect = map_dpi_rect( *rect, dpi_from, dpi ); - set_thread_dpi_awareness_context( ctx ); - } + if (!status && type == MDT_EFFECTIVE_DPI) *rect = map_rect_raw_to_virt( *rect, dpi ); return !status; }
BOOL process_wine_clipcursor( HWND hwnd, UINT flags, BOOL reset ) { struct user_thread_info *thread_info = get_user_thread_info(); - RECT rect, virtual_rect = get_virtual_screen_rect( 0, MDT_DEFAULT ); + RECT rect, virtual_rect = get_virtual_screen_rect( 0, MDT_RAW_DPI ); BOOL was_clipping, empty = !!(flags & SET_CURSOR_NOCLIP);
TRACE( "hwnd %p, flags %#x, reset %u\n", hwnd, flags, reset ); @@ -2636,7 +2627,7 @@ BOOL process_wine_clipcursor( HWND hwnd, UINT flags, BOOL reset ) if (!grab_pointer) return TRUE;
/* we are clipping if the clip rectangle is smaller than the screen */ - get_clip_cursor( &rect, 0 ); + get_clip_cursor( &rect, 0, MDT_RAW_DPI ); intersect_rect( &rect, &rect, &virtual_rect ); if (EqualRect( &rect, &virtual_rect )) empty = TRUE; if (empty && !(flags & SET_CURSOR_FSCLIP)) @@ -2657,17 +2648,15 @@ BOOL process_wine_clipcursor( HWND hwnd, UINT flags, BOOL reset ) */ BOOL WINAPI NtUserClipCursor( const RECT *rect ) { - UINT dpi_from = get_thread_dpi(), dpi_to, raw_dpi; - BOOL ret; RECT new_rect; + BOOL ret;
TRACE( "Clipping to %s\n", wine_dbgstr_rect(rect) );
if (rect) { if (rect->left > rect->right || rect->top > rect->bottom) return FALSE; - dpi_to = monitor_dpi_from_rect( *rect, dpi_from, &raw_dpi ); - new_rect = map_dpi_rect( *rect, dpi_from, dpi_to ); + new_rect = map_rect_virt_to_raw( *rect, get_thread_dpi() ); rect = &new_rect; }
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index fd41bd670ce..af1a7e5b8ec 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2637,14 +2637,18 @@ static BOOL process_hardware_message( MSG *msg, UINT hw_id, const struct hardwar HWND hwnd_filter, UINT first, UINT last, BOOL remove ) { struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); + RECT rect = {msg->pt.x, msg->pt.y, msg->pt.x, msg->pt.y}; UINT context; BOOL ret = FALSE;
thread_info->msg_source.deviceType = msg_data->source.device; thread_info->msg_source.originId = msg_data->source.origin;
- /* hardware messages are always in physical coords */ + /* hardware messages are always in raw physical coords */ context = set_thread_dpi_awareness_context( NTUSER_DPI_PER_MONITOR_AWARE ); + rect = map_rect_raw_to_virt( rect, get_thread_dpi() ); + msg->pt.x = rect.left; + msg->pt.y = rect.top;
if (msg->message == WM_INPUT || msg->message == WM_INPUT_DEVICE_CHANGE) ret = process_rawinput_message( msg, hw_id, msg_data ); diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 911ce6c0e40..327bb5cce9c 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -2360,6 +2360,60 @@ static RECT monitors_get_union_rect( UINT dpi, MONITOR_DPI_TYPE type ) return rect; }
+static RECT map_monitor_rect( struct monitor *monitor, RECT rect, UINT dpi_from, MONITOR_DPI_TYPE type_from, + UINT dpi_to, MONITOR_DPI_TYPE type_to ) +{ + UINT x, y; + if (!dpi_from) dpi_from = monitor_get_dpi( monitor, type_from, &x, &y ); + if (!dpi_to) dpi_to = monitor_get_dpi( monitor, type_to, &x, &y ); + return map_dpi_rect( rect, dpi_from, dpi_to ); +} + +/* map a monitor rect from MDT_RAW_DPI to MDT_DEFAULT coordinates */ +RECT map_rect_raw_to_virt( RECT rect, UINT dpi_to ) +{ + RECT pos = {rect.left, rect.top, rect.left, rect.top}; + struct monitor *monitor; + + if (!lock_display_devices()) return rect; + if ((monitor = get_monitor_from_rect( pos, MONITOR_DEFAULTTONEAREST, 0, MDT_RAW_DPI ))) + rect = map_monitor_rect( monitor, rect, 0, MDT_RAW_DPI, dpi_to, MDT_DEFAULT ); + unlock_display_devices(); + + return rect; +} + +/* map a monitor rect from MDT_DEFAULT to MDT_RAW_DPI coordinates */ +RECT map_rect_virt_to_raw( RECT rect, UINT dpi_from ) +{ + RECT pos = {rect.left, rect.top, rect.left, rect.top}; + struct monitor *monitor; + + if (!lock_display_devices()) return rect; + if ((monitor = get_monitor_from_rect( pos, MONITOR_DEFAULTTONEAREST, dpi_from, MDT_DEFAULT ))) + rect = map_monitor_rect( monitor, rect, dpi_from, MDT_DEFAULT, 0, MDT_RAW_DPI ); + unlock_display_devices(); + + return rect; +} + +/* map (absolute) window rects from MDT_DEFAULT to MDT_RAW_DPI coordinates */ +struct window_rects map_window_rects_virt_to_raw( struct window_rects rects, UINT dpi_from ) +{ + struct monitor *monitor; + + if (!lock_display_devices()) return rects; + if ((monitor = get_monitor_from_rect( rects.window, MONITOR_DEFAULTTONEAREST, dpi_from, MDT_DEFAULT ))) + { + rects.visible = map_monitor_rect( monitor, rects.visible, dpi_from, MDT_DEFAULT, 0, MDT_RAW_DPI ); + rects.window = map_monitor_rect( monitor, rects.window, dpi_from, MDT_DEFAULT, 0, MDT_RAW_DPI ); + rects.client = map_monitor_rect( monitor, rects.client, dpi_from, MDT_DEFAULT, 0, MDT_RAW_DPI ); + } + unlock_display_devices(); + + return rects; +} + static UINT get_monitor_dpi( HMONITOR handle, UINT type, UINT *x, UINT *y ) { struct monitor *monitor; @@ -6794,7 +6848,7 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) return enum_clipboard_formats( arg );
case NtUserCallOneParam_GetClipCursor: - return get_clip_cursor( (RECT *)arg, get_thread_dpi() ); + return get_clip_cursor( (RECT *)arg, get_thread_dpi(), MDT_DEFAULT );
case NtUserCallOneParam_GetCursorPos: return get_cursor_pos( (POINT *)arg ); diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 8956f83af75..f25e94a0db1 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -106,7 +106,7 @@ extern BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DW extern BOOL set_ime_composition_rect( HWND hwnd, RECT rect ); extern void toggle_caret( HWND hwnd ); extern void update_mouse_tracking_info( HWND hwnd ); -extern BOOL get_clip_cursor( RECT *rect, UINT dpi ); +extern BOOL get_clip_cursor( RECT *rect, UINT dpi, MONITOR_DPI_TYPE type ); extern BOOL process_wine_clipcursor( HWND hwnd, UINT flags, BOOL reset ); extern BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ); extern USHORT map_scan_to_kbd_vkey( USHORT scan, HKL layout ); @@ -186,6 +186,9 @@ extern RECT map_dpi_rect( RECT rect, UINT dpi_from, UINT dpi_to ); extern HRGN map_dpi_region( HRGN region, UINT dpi_from, UINT dpi_to ); extern struct window_rects map_dpi_window_rects( struct window_rects rects, UINT dpi_from, UINT dpi_to ); extern BOOL message_beep( UINT i ); +extern RECT map_rect_raw_to_virt( RECT rect, UINT dpi_to ); +extern RECT map_rect_virt_to_raw( RECT rect, UINT dpi_from ); +extern struct window_rects map_window_rects_virt_to_raw( struct window_rects rects, UINT dpi_from ); extern POINT point_phys_to_win_dpi( HWND hwnd, POINT pt ); extern POINT point_thread_to_win_dpi( HWND hwnd, POINT pt ); extern RECT rect_thread_to_win_dpi( HWND hwnd, RECT rect ); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 47ace040c37..997fd167d11 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1855,7 +1855,7 @@ static RECT get_visible_rect( HWND hwnd, BOOL shaped, UINT style, UINT ex_style,
static BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ) { - RECT virtual_rect = get_virtual_screen_rect( 0, MDT_DEFAULT ); + RECT virtual_rect = get_virtual_screen_rect( 0, MDT_RAW_DPI );
*surface_rect = *visible_rect;
@@ -1910,7 +1910,7 @@ static struct window_surface *get_window_surface( HWND hwnd, UINT swp_flags, BOO HWND parent = NtUserGetAncestor( hwnd, GA_PARENT ); struct window_surface *new_surface; struct window_rects monitor_rects; - UINT raw_dpi, monitor_dpi, style, ex_style; + UINT raw_dpi, style, ex_style; RECT dummy; HRGN shape;
@@ -1918,14 +1918,16 @@ static struct window_surface *get_window_surface( HWND hwnd, UINT swp_flags, BOO ex_style = NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ); is_child = parent && parent != NtUserGetDesktopWindow();
- if (is_child) monitor_dpi = get_win_monitor_dpi( parent, &raw_dpi ); - else monitor_dpi = monitor_dpi_from_rect( rects->window, get_thread_dpi(), &raw_dpi ); + if (is_child) get_win_monitor_dpi( parent, &raw_dpi ); + else monitor_dpi_from_rect( rects->window, get_thread_dpi(), &raw_dpi );
if (get_window_region( hwnd, FALSE, &shape, &dummy )) shaped = FALSE; else if ((shaped = !!shape)) NtGdiDeleteObjectApp( shape );
rects->visible = rects->window; - monitor_rects = map_dpi_window_rects( *rects, get_thread_dpi(), monitor_dpi ); + if (is_child) monitor_rects = map_dpi_window_rects( *rects, get_thread_dpi(), raw_dpi ); + else monitor_rects = map_window_rects_virt_to_raw( *rects, get_thread_dpi() ); + if (!user_driver->pWindowPosChanging( hwnd, swp_flags, shaped, &monitor_rects )) needs_surface = FALSE; else if (is_child) needs_surface = FALSE; else if (swp_flags & SWP_HIDEWINDOW) needs_surface = FALSE; @@ -1950,7 +1952,7 @@ static struct window_surface *get_window_surface( HWND hwnd, UINT swp_flags, BOO else if (create_layered || is_layered) needs_surface = TRUE;
if (needs_surface) - create_window_surface( hwnd, create_layered, surface_rect, monitor_dpi, &new_surface ); + create_window_surface( hwnd, create_layered, surface_rect, raw_dpi, &new_surface ); else if (new_surface && new_surface != &dummy_surface) { window_surface_release( new_surface ); @@ -2025,7 +2027,8 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru valid_rects = NULL; }
- monitor_rects = map_dpi_window_rects( *new_rects, get_thread_dpi(), monitor_dpi ); + if (is_child) monitor_rects = map_dpi_window_rects( *new_rects, get_thread_dpi(), raw_dpi ); + else monitor_rects = map_window_rects_virt_to_raw( *new_rects, get_thread_dpi() );
SERVER_START_REQ( set_window_pos ) { @@ -2144,7 +2147,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru if (owner_hint) owner_hint = NtUserGetAncestor(owner_hint, GA_ROOT);
user_driver->pWindowPosChanged( hwnd, insert_after, owner_hint, swp_flags, is_fullscreen, &monitor_rects, - get_driver_window_surface( new_surface, monitor_dpi ) ); + get_driver_window_surface( new_surface, raw_dpi ) );
update_children_window_state( hwnd ); } @@ -2292,13 +2295,13 @@ int WINAPI NtUserSetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ) { UINT swp_flags = SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE; - UINT raw_dpi, dpi; + UINT raw_dpi; HRGN monitor_hrgn;
if (!redraw) swp_flags |= SWP_NOREDRAW;
- dpi = get_win_monitor_dpi( hwnd, &raw_dpi ); - monitor_hrgn = map_dpi_region( hrgn, get_thread_dpi(), dpi ); + get_win_monitor_dpi( hwnd, &raw_dpi ); + monitor_hrgn = map_dpi_region( hrgn, get_thread_dpi(), raw_dpi ); user_driver->pSetWindowRgn( hwnd, monitor_hrgn, redraw ); if (monitor_hrgn) NtGdiDeleteObjectApp( monitor_hrgn );
@@ -5732,12 +5735,9 @@ static BOOL set_dialog_info( HWND hwnd, void *info )
static BOOL set_raw_window_pos( HWND hwnd, RECT rect, UINT flags, BOOL internal ) { - UINT dpi, raw_dpi; - TRACE( "hwnd %p, rect %s, flags %#x, internal %u\n", hwnd, wine_dbgstr_rect(&rect), flags, internal );
- dpi = get_win_monitor_dpi( hwnd, &raw_dpi ); - rect = map_dpi_rect( rect, dpi, get_thread_dpi() ); + rect = map_rect_raw_to_virt( rect, get_thread_dpi() );
if (internal) { diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index 5e99d1d95e6..dbc3de1d933 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -78,7 +78,7 @@ void init_monitors( int width, int height ) monitor_rc_work = virtual_screen_rect;
if (!hwnd || !NtUserIsWindowVisible( hwnd )) return; - if (!NtUserGetWindowRect( hwnd, &rect, NtUserGetWinMonitorDpi( hwnd, MDT_DEFAULT ) )) return; + if (!NtUserGetWindowRect( hwnd, &rect, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) )) return; if (rect.top) monitor_rc_work.bottom = rect.top; else monitor_rc_work.top = rect.bottom; TRACE( "found tray %p %s work area %s\n", hwnd, diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 17d076d65b5..76aeadc6d6f 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -98,7 +98,7 @@ static struct android_win_data *alloc_win_data( HWND hwnd ) { data->hwnd = hwnd; data->window = create_ioctl_window( hwnd, FALSE, - (float)NtUserGetWinMonitorDpi( hwnd, MDT_DEFAULT ) / NtUserGetDpiForWindow( hwnd )); + (float)NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) / NtUserGetDpiForWindow( hwnd )); pthread_mutex_lock( &win_data_mutex ); win_data_context[context_idx(hwnd)] = data; } @@ -1101,7 +1101,7 @@ void ANDROID_SetParent( HWND hwnd, HWND parent, HWND old_parent ) TRACE( "win %p parent %p -> %p\n", hwnd, old_parent, parent );
data->parent = (parent == NtUserGetDesktopWindow()) ? 0 : parent; - ioctl_set_window_parent( hwnd, parent, (float)NtUserGetWinMonitorDpi( hwnd, MDT_DEFAULT ) / NtUserGetDpiForWindow( hwnd )); + ioctl_set_window_parent( hwnd, parent, (float)NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) / NtUserGetDpiForWindow( hwnd )); release_win_data( data ); }
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 07874cf985e..f2cca652045 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -346,7 +346,7 @@ static void sync_window_min_max_info(HWND hwnd) { LONG style = NtUserGetWindowLongW(hwnd, GWL_STYLE); LONG exstyle = NtUserGetWindowLongW(hwnd, GWL_EXSTYLE); - UINT dpi = NtUserGetWinMonitorDpi(hwnd, MDT_DEFAULT); + UINT dpi = NtUserGetWinMonitorDpi(hwnd, MDT_RAW_DPI); RECT win_rect, primary_monitor_rect; MINMAXINFO minmax; LONG adjustedStyle; diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index b7ef362df5c..2178f5431cb 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -970,8 +970,8 @@ void wayland_client_surface_attach(struct wayland_client_surface *client, HWND t client->toplevel = toplevel; }
- NtUserGetClientRect(client->hwnd, &client_rect, NtUserGetWinMonitorDpi(client->hwnd, MDT_DEFAULT)); - NtUserMapWindowPoints(client->hwnd, toplevel, (POINT *)&client_rect, 2, NtUserGetWinMonitorDpi(client->hwnd, MDT_DEFAULT)); + NtUserGetClientRect(client->hwnd, &client_rect, NtUserGetWinMonitorDpi(client->hwnd, MDT_RAW_DPI)); + NtUserMapWindowPoints(client->hwnd, toplevel, (POINT *)&client_rect, 2, NtUserGetWinMonitorDpi(client->hwnd, MDT_RAW_DPI));
wayland_surface_reconfigure_client(surface, client, &client_rect); /* Commit to apply subsurface positioning. */ diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index b89cc97b08c..78e940a51a7 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -174,7 +174,7 @@ static void wayland_win_data_get_config(struct wayland_win_data *data, }
conf->state = window_state; - conf->scale = NtUserGetWinMonitorDpi(data->hwnd, MDT_DEFAULT) / 96.0; + conf->scale = NtUserGetWinMonitorDpi(data->hwnd, MDT_RAW_DPI) / 96.0; conf->visible = (style & WS_VISIBLE) == WS_VISIBLE; conf->managed = data->managed; } diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 070ab3efe2f..8d1a1dfd414 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -284,7 +284,7 @@ done:
POINT virtual_screen_to_root(INT x, INT y) { - RECT virtual = NtUserGetVirtualScreenRect( MDT_DEFAULT ); + RECT virtual = NtUserGetVirtualScreenRect( MDT_RAW_DPI ); POINT pt;
pt.x = x - virtual.left; @@ -294,7 +294,7 @@ POINT virtual_screen_to_root(INT x, INT y)
POINT root_to_virtual_screen(INT x, INT y) { - RECT virtual = NtUserGetVirtualScreenRect( MDT_DEFAULT ); + RECT virtual = NtUserGetVirtualScreenRect( MDT_RAW_DPI ); POINT pt;
pt.x = x + virtual.left; diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 7ae30f2ab3c..a1116d032e6 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -980,7 +980,7 @@ static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev )
release_win_data( data );
- NtUserExposeWindowSurface( hwnd, flags, &rect, NtUserGetWinMonitorDpi( hwnd, MDT_DEFAULT ) ); + NtUserExposeWindowSurface( hwnd, flags, &rect, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) ); return TRUE; }
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 7963d9cbbc0..e0f465a2771 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -196,7 +196,7 @@ static HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags )
BOOL needs_offscreen_rendering( HWND hwnd, BOOL known_child ) { - if (NtUserGetDpiForWindow( hwnd ) != NtUserGetWinMonitorDpi( hwnd, MDT_DEFAULT )) return TRUE; /* needs DPI scaling */ + if (NtUserGetDpiForWindow( hwnd ) != NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI )) return TRUE; /* needs DPI scaling */ if (NtUserGetAncestor( hwnd, GA_PARENT ) != NtUserGetDesktopWindow()) return TRUE; /* child window, needs compositing */ if (NtUserGetWindowRelative( hwnd, GW_CHILD )) return TRUE; /* window has children, needs compositing */ if (known_child) return TRUE; /* window is/have children, needs compositing */ diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index cbbb27d6798..f3c72b2d9f5 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1677,7 +1677,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) if (!xinput2_available) return FALSE; if (event->deviceid != thread_data->xinput2_pointer) return FALSE;
- virtual_rect = NtUserGetVirtualScreenRect( MDT_DEFAULT ); + virtual_rect = NtUserGetVirtualScreenRect( MDT_RAW_DPI );
if (x->max <= x->min) x_scale = 1; else x_scale = (virtual_rect.right - virtual_rect.left) / (x->max - x->min); @@ -1747,7 +1747,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
static BOOL X11DRV_TouchEvent( HWND hwnd, XGenericEventCookie *xev ) { - RECT virtual = NtUserGetVirtualScreenRect( MDT_DEFAULT ); + RECT virtual = NtUserGetVirtualScreenRect( MDT_RAW_DPI ); INPUT input = {.type = INPUT_HARDWARE}; XIDeviceEvent *event = xev->data; int flags = 0; diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index d82fd01233d..594ffaea2dd 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1898,8 +1898,8 @@ static void present_gl_drawable( HWND hwnd, HDC hdc, struct gl_drawable *gl, BOO
if (flush) XFlush( gdi_display );
- NtUserGetClientRect( hwnd, &rect_dst, NtUserGetWinMonitorDpi( hwnd, MDT_DEFAULT ) ); - NtUserMapWindowPoints( hwnd, toplevel, (POINT *)&rect_dst, 2, NtUserGetWinMonitorDpi( hwnd, MDT_DEFAULT ) ); + NtUserGetClientRect( hwnd, &rect_dst, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) ); + NtUserMapWindowPoints( hwnd, toplevel, (POINT *)&rect_dst, 2, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) );
if ((data = get_win_data( toplevel ))) { diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 32fb87c1368..e7c187d5c67 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -231,8 +231,8 @@ static void X11DRV_vulkan_surface_presented( HWND hwnd, void *private, VkResult window = X11DRV_get_whole_window( toplevel ); region = get_dc_monitor_region( hwnd, hdc );
- NtUserGetClientRect( hwnd, &rect_dst, NtUserGetWinMonitorDpi( hwnd, MDT_DEFAULT ) ); - NtUserMapWindowPoints( hwnd, toplevel, (POINT *)&rect_dst, 2, NtUserGetWinMonitorDpi( hwnd, MDT_DEFAULT ) ); + NtUserGetClientRect( hwnd, &rect_dst, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) ); + NtUserMapWindowPoints( hwnd, toplevel, (POINT *)&rect_dst, 2, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) );
if ((data = get_win_data( toplevel ))) { diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index c9018e97b25..58786d962cf 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1864,7 +1864,7 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colo HWND parent = NtUserGetAncestor( hwnd, GA_PARENT ); if (parent == NtUserGetDesktopWindow() || NtUserGetAncestor( parent, GA_PARENT )) return 0; if (!(data = alloc_win_data( thread_init_display(), hwnd ))) return 0; - NtUserGetClientRect( hwnd, &data->rects.client, NtUserGetWinMonitorDpi( hwnd, MDT_DEFAULT ) ); + NtUserGetClientRect( hwnd, &data->rects.client, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) ); data->rects.window = data->rects.visible = data->rects.client; }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 50788524754..f1f0f97486b 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -852,7 +852,7 @@ extern void xim_set_focus( HWND hwnd, BOOL focus );
static inline BOOL is_window_rect_mapped( const RECT *rect ) { - RECT virtual_rect = NtUserGetVirtualScreenRect( MDT_DEFAULT ); + RECT virtual_rect = NtUserGetVirtualScreenRect( MDT_RAW_DPI ); return (rect->left < virtual_rect.right && rect->top < virtual_rect.bottom && max( rect->right, rect->left + 1 ) > virtual_rect.left &&