From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/window.c | 3 +++ dlls/wineandroid.drv/android.h | 1 - dlls/wineandroid.drv/init.c | 2 +- dlls/wineandroid.drv/window.c | 14 ++------------ dlls/winemac.drv/window.c | 17 ++++------------- dlls/winewayland.drv/wayland_surface.c | 4 ++-- dlls/winewayland.drv/waylanddrv.h | 1 - dlls/winewayland.drv/window.c | 11 +---------- dlls/winex11.drv/event.c | 4 ++-- dlls/winex11.drv/init.c | 2 +- dlls/winex11.drv/opengl.c | 4 ++-- dlls/winex11.drv/vulkan.c | 4 ++-- dlls/winex11.drv/window.c | 11 +---------- dlls/winex11.drv/x11drv.h | 1 - include/ntuser.h | 6 ++++++ 15 files changed, 27 insertions(+), 58 deletions(-)
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index cf073fb9fcf..26b0b338b46 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5914,6 +5914,9 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) return expose_window_surface( hwnd, params->flags, params->whole ? NULL : ¶ms->rect, params->dpi ); }
+ case NtUserCallHwndParam_GetWinMonitorDpi: + return get_win_monitor_dpi( hwnd ); + /* temporary exports */ case NtUserSetWindowStyle: { diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index 63884b012fe..cab16c484a8 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -124,7 +124,6 @@ extern HWND get_capture_window(void); extern void init_monitors( int width, int height ); extern void set_screen_dpi( DWORD dpi ); extern void update_keyboard_lock_state( WORD vkey, UINT state ); -extern UINT get_win_monitor_dpi( HWND hwnd );
/* JNI entry points */ extern void desktop_changed( JNIEnv *env, jobject obj, jint width, jint height ); diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index a7dbce7a4dd..7f21a3b13f1 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, get_win_monitor_dpi( hwnd ) )) return; + if (!NtUserGetWindowRect( hwnd, &rect, NtUserGetWinMonitorDpi( hwnd ) )) 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 b7726bcf5d7..eb2a2819e6f 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -87,16 +87,6 @@ static BOOL intersect_rect( RECT *dst, const RECT *src1, const RECT *src2 ) return !IsRectEmpty( dst ); }
- -/********************************************************************** - * get_win_monitor_dpi - */ -UINT get_win_monitor_dpi( HWND hwnd ) -{ - return NtUserGetSystemDpiForProcess( NULL ); /* FIXME: get monitor dpi */ -} - - /*********************************************************************** * alloc_win_data */ @@ -108,7 +98,7 @@ static struct android_win_data *alloc_win_data( HWND hwnd ) { data->hwnd = hwnd; data->window = create_ioctl_window( hwnd, FALSE, - (float)get_win_monitor_dpi( hwnd ) / NtUserGetDpiForWindow( hwnd )); + (float)NtUserGetWinMonitorDpi( hwnd ) / NtUserGetDpiForWindow( hwnd )); pthread_mutex_lock( &win_data_mutex ); win_data_context[context_idx(hwnd)] = data; } @@ -1111,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)get_win_monitor_dpi( hwnd ) / NtUserGetDpiForWindow( hwnd )); + ioctl_set_window_parent( hwnd, parent, (float)NtUserGetWinMonitorDpi( hwnd ) / NtUserGetDpiForWindow( hwnd )); release_win_data( data ); }
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index f8235d93e24..bccb0caff16 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -46,15 +46,6 @@ static CFMutableDictionaryRef win_datas; static unsigned int activate_on_focus_time;
-/********************************************************************** - * get_win_monitor_dpi - */ -static UINT get_win_monitor_dpi(HWND hwnd) -{ - return NtUserGetSystemDpiForProcess(NULL); /* FIXME: get monitor dpi */ -} - - /* per-monitor DPI aware NtUserSetWindowPos call */ static BOOL set_window_pos(HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, UINT flags) { @@ -364,7 +355,7 @@ static void sync_window_min_max_info(HWND hwnd) { LONG style = NtUserGetWindowLongW(hwnd, GWL_STYLE); LONG exstyle = NtUserGetWindowLongW(hwnd, GWL_EXSTYLE); - UINT dpi = get_win_monitor_dpi(hwnd); + UINT dpi = NtUserGetWinMonitorDpi(hwnd); RECT win_rect, primary_monitor_rect; MINMAXINFO minmax; LONG adjustedStyle; @@ -378,7 +369,7 @@ static void sync_window_min_max_info(HWND hwnd)
if (!macdrv_get_cocoa_window(hwnd, FALSE)) return;
- NtUserGetWindowRect(hwnd, &win_rect, get_win_monitor_dpi(hwnd)); + NtUserGetWindowRect(hwnd, &win_rect, dpi); minmax.ptReserved.x = win_rect.left; minmax.ptReserved.y = win_rect.top;
@@ -1143,7 +1134,7 @@ static HMONITOR monitor_from_point(POINT pt, UINT flags) */ static LRESULT move_window(HWND hwnd, WPARAM wparam) { - UINT dpi = get_win_monitor_dpi(hwnd); + UINT dpi = NtUserGetWinMonitorDpi(hwnd); MSG msg; RECT origRect, movedRect, desktopRect; int hittest = (int)(wparam & 0x0f); @@ -1170,7 +1161,7 @@ static LRESULT move_window(HWND hwnd, WPARAM wparam) else captionHeight = 0;
- NtUserGetWindowRect(hwnd, &origRect, get_win_monitor_dpi(hwnd)); + NtUserGetWindowRect(hwnd, &origRect, NtUserGetWinMonitorDpi(hwnd)); movedRect = origRect;
if (!hittest) diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index e5794ee440f..ce0508636b3 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -847,8 +847,8 @@ void wayland_client_surface_attach(struct wayland_client_surface *client, HWND t client->toplevel = toplevel; }
- NtUserGetClientRect(client->hwnd, &client_rect, get_win_monitor_dpi(client->hwnd)); - NtUserMapWindowPoints(client->hwnd, toplevel, (POINT *)&client_rect, 2, get_win_monitor_dpi(client->hwnd)); + NtUserGetClientRect(client->hwnd, &client_rect, NtUserGetWinMonitorDpi(client->hwnd)); + NtUserMapWindowPoints(client->hwnd, toplevel, (POINT *)&client_rect, 2, NtUserGetWinMonitorDpi(client->hwnd));
wayland_surface_reconfigure_client(surface, client, &client_rect); /* Commit to apply subsurface positioning. */ diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 4b49b4fbb2f..12f63921ee7 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -290,7 +290,6 @@ struct wayland_win_data BOOL managed; };
-UINT get_win_monitor_dpi(HWND hwnd); struct wayland_win_data *wayland_win_data_get(HWND hwnd); struct wayland_win_data *wayland_win_data_get_nolock(HWND hwnd); void wayland_win_data_release(struct wayland_win_data *data); diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 2a9f4ff8036..77e0c70ad71 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -37,15 +37,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv);
-/********************************************************************** - * get_win_monitor_dpi - */ -UINT get_win_monitor_dpi(HWND hwnd) -{ - return NtUserGetSystemDpiForProcess(NULL); /* FIXME: get monitor dpi */ -} - - /* per-monitor DPI aware NtUserSetWindowPos call */ static BOOL set_window_pos(HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, UINT flags) { @@ -193,7 +184,7 @@ static void wayland_win_data_get_config(struct wayland_win_data *data, }
conf->state = window_state; - conf->scale = get_win_monitor_dpi(data->hwnd) / 96.0; + conf->scale = NtUserGetWinMonitorDpi(data->hwnd) / 96.0; conf->visible = (style & WS_VISIBLE) == WS_VISIBLE; conf->managed = data->managed; } diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 503a2154bb4..c8fc76f5048 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -917,7 +917,7 @@ static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev )
release_win_data( data );
- NtUserExposeWindowSurface( hwnd, flags, &rect, get_win_monitor_dpi( hwnd ) ); + NtUserExposeWindowSurface( hwnd, flags, &rect, NtUserGetWinMonitorDpi( hwnd ) ); return TRUE; }
@@ -1391,7 +1391,7 @@ void X11DRV_SetFocus( HWND hwnd )
static HWND find_drop_window( HWND hQueryWnd, LPPOINT lpPt ) { - UINT dpi = get_win_monitor_dpi( hQueryWnd ); + UINT dpi = NtUserGetWinMonitorDpi( hQueryWnd ); RECT tempRect;
if (!NtUserIsWindowEnabled(hQueryWnd)) return 0; diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index e7a6132fd87..0bba9727136 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 ) != get_win_monitor_dpi( hwnd )) return TRUE; /* needs DPI scaling */ + if (NtUserGetDpiForWindow( hwnd ) != NtUserGetWinMonitorDpi( hwnd )) 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/opengl.c b/dlls/winex11.drv/opengl.c index d235529bff0..f7623121b32 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, get_win_monitor_dpi( hwnd ) ); - NtUserMapWindowPoints( hwnd, toplevel, (POINT *)&rect_dst, 2, get_win_monitor_dpi( hwnd ) ); + NtUserGetClientRect( hwnd, &rect_dst, NtUserGetWinMonitorDpi( hwnd ) ); + NtUserMapWindowPoints( hwnd, toplevel, (POINT *)&rect_dst, 2, NtUserGetWinMonitorDpi( hwnd ) );
if ((data = get_win_data( toplevel ))) { diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 59714b522fb..f300ddffe58 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -221,8 +221,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, get_win_monitor_dpi( hwnd ) ); - NtUserMapWindowPoints( hwnd, toplevel, (POINT *)&rect_dst, 2, get_win_monitor_dpi( hwnd ) ); + NtUserGetClientRect( hwnd, &rect_dst, NtUserGetWinMonitorDpi( hwnd ) ); + NtUserMapWindowPoints( hwnd, toplevel, (POINT *)&rect_dst, 2, NtUserGetWinMonitorDpi( hwnd ) );
if ((data = get_win_data( toplevel ))) { diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 87eafc2e68d..f18ab302e5e 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -113,15 +113,6 @@ static const WCHAR clip_window_prop[] = static pthread_mutex_t win_data_mutex = PTHREAD_MUTEX_INITIALIZER;
-/********************************************************************** - * get_win_monitor_dpi - */ -UINT get_win_monitor_dpi( HWND hwnd ) -{ - return NtUserGetSystemDpiForProcess( NULL ); /* FIXME: get monitor dpi */ -} - - /*********************************************************************** * http://standards.freedesktop.org/startup-notification-spec */ @@ -1610,7 +1601,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, get_win_monitor_dpi( hwnd ) ); + NtUserGetClientRect( hwnd, &data->rects.client, NtUserGetWinMonitorDpi( hwnd ) ); data->rects.window = data->rects.visible = data->rects.client; }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index edb47f550e7..d2eb35b454e 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -664,7 +664,6 @@ extern XContext winContext; /* X context to associate an X cursor to a Win32 cursor handle */ extern XContext cursor_context;
-extern UINT get_win_monitor_dpi( HWND hwnd ); extern BOOL is_current_process_focused(void); extern void X11DRV_SetFocus( HWND hwnd ); extern void set_window_cursor( Window window, HCURSOR handle ); diff --git a/include/ntuser.h b/include/ntuser.h index e6f75ea9121..5c834189f4b 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1308,6 +1308,7 @@ enum NtUserCallHwndParam_ShowOwnedPopups, NtUserCallHwndParam_SendHardwareInput, NtUserCallHwndParam_ExposeWindowSurface, + NtUserCallHwndParam_GetWinMonitorDpi, /* temporary exports */ NtUserSetWindowStyle, }; @@ -1533,4 +1534,9 @@ static inline BOOL NtUserExposeWindowSurface( HWND hwnd, UINT flags, const RECT return NtUserCallHwndParam( hwnd, (UINT_PTR)¶ms, NtUserCallHwndParam_ExposeWindowSurface ); }
+static inline UINT NtUserGetWinMonitorDpi( HWND hwnd ) +{ + return NtUserCallHwndParam( hwnd, 0, NtUserCallHwndParam_GetWinMonitorDpi ); +} + #endif /* _NTUSER_ */