In preparation for per-monitor DPI awareness, though currently not doing much.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index ea0fab4611e..503a2154bb4 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -535,7 +535,7 @@ static inline BOOL can_activate_window( HWND hwnd ) if (style & WS_MINIMIZE) return FALSE; if (NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_NOACTIVATE) return FALSE; if (hwnd == NtUserGetDesktopWindow()) return FALSE; - if (NtUserGetWindowRect( hwnd, &rect, get_win_monitor_dpi( hwnd ) ) && IsRectEmpty( &rect )) return FALSE; + if (NtUserGetWindowRect( hwnd, &rect, NtUserGetDpiForWindow( hwnd ) ) && IsRectEmpty( &rect )) return FALSE; return !(style & WS_DISABLED); }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/sysparams.c | 17 +++++++++++++---- dlls/wineandroid.drv/init.c | 3 ++- dlls/winemac.drv/display.c | 3 ++- dlls/winewayland.drv/display.c | 3 ++- dlls/winex11.drv/display.c | 3 ++- include/wine/gdi_driver.h | 4 ++-- 6 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index f07f0d53628..ced9c61db06 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -70,6 +70,7 @@ static const WCHAR yesW[] = {'Y','e','s',0}; static const WCHAR noW[] = {'N','o',0}; static const WCHAR modesW[] = {'M','o','d','e','s',0}; static const WCHAR mode_countW[] = {'M','o','d','e','C','o','u','n','t',0}; +static const WCHAR dpiW[] = {'D','p','i',0};
static const char guid_devclass_displayA[] = "{4D36E968-E325-11CE-BFC1-08002BE10318}"; static const WCHAR guid_devclass_displayW[] = @@ -106,6 +107,7 @@ struct source char path[MAX_PATH]; unsigned int id; struct gpu *gpu; + UINT dpi; UINT state_flags; UINT monitor_count; UINT mode_count; @@ -643,6 +645,10 @@ static BOOL read_source_from_registry( unsigned int index, struct source *source if (query_reg_ascii_value( hkey, "StateFlags", value, sizeof(buffer) ) && value->Type == REG_DWORD) source->state_flags = *(const DWORD *)value->Data;
+ /* Dpi */ + if (query_reg_ascii_value( hkey, "Dpi", value, sizeof(buffer) ) && value->Type == REG_DWORD) + source->dpi = *(DWORD *)value->Data; + /* ModeCount */ if (query_reg_ascii_value( hkey, "ModeCount", value, sizeof(buffer) ) && value->Type == REG_DWORD) source->mode_count = *(const DWORD *)value->Data; @@ -1344,6 +1350,7 @@ static BOOL write_source_to_registry( const struct source *source, HKEY *source_ set_reg_ascii_value( *source_key, "GPUID", gpu->path ); set_reg_value( *source_key, state_flagsW, REG_DWORD, &source->state_flags, sizeof(source->state_flags) ); + set_reg_value( *source_key, dpiW, REG_DWORD, &source->dpi, sizeof(source->dpi) );
snprintf( buffer, sizeof(buffer), "System\CurrentControlSet\Control\Video\%s\%04x", gpu->guid, source_index ); hkey = reg_create_ascii_key( config_key, buffer, REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK, NULL ); @@ -1356,7 +1363,7 @@ static BOOL write_source_to_registry( const struct source *source, HKEY *source_ return TRUE; }
-static void add_source( const char *name, UINT state_flags, void *param ) +static void add_source( const char *name, UINT state_flags, UINT dpi, void *param ) { struct device_manager_ctx *ctx = param;
@@ -1375,6 +1382,7 @@ static void add_source( const char *name, UINT state_flags, void *param ) ctx->source.id = 0; ctx->has_primary = TRUE; } + ctx->source.dpi = dpi;
/* Wine specific config key where source settings will be held, symlinked with the logically indexed config key */ snprintf( ctx->source.path, sizeof(ctx->source.path), "%s\%s\Video\%s\Sources\%s", config_keyA, @@ -1811,7 +1819,7 @@ static NTSTATUS default_update_display_devices( struct device_manager_ctx *ctx ) DEVMODEW mode = {.dmSize = sizeof(mode)};
add_gpu( "Wine GPU", &pci_id, NULL, ctx ); - add_source( "Default", source_flags, ctx ); + add_source( "Default", source_flags, system_dpi, ctx );
if (!read_source_mode( ctx->source_key, ENUM_CURRENT_SETTINGS, &mode )) { @@ -2130,8 +2138,9 @@ static void release_display_dc( HDC hdc ) /* display_lock must be held */ static UINT monitor_get_dpi( struct monitor *monitor ) { - /* FIXME: use the monitor DPI instead */ - return system_dpi; + UINT dpi; + if (!monitor->source || !(dpi = monitor->source->dpi)) dpi = system_dpi; + return dpi; }
/* display_lock must be held */ diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index d5488388e0d..a7dbce7a4dd 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -280,10 +280,11 @@ UINT ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manag DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY, .dmBitsPerPel = screen_bpp, .dmPelsWidth = screen_width, .dmPelsHeight = screen_height, .dmDisplayFrequency = 60, }; + UINT dpi = NtUserGetSystemDpiForProcess( NULL ); DEVMODEW current = mode;
device_manager->add_gpu( "Wine GPU", &pci_id, NULL, param ); - device_manager->add_source( "Default", source_flags, param ); + device_manager->add_source( "Default", source_flags, dpi, param ); device_manager->add_monitor( &gdi_monitor, param );
current.dmFields |= DM_POSITION; diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c index 4a9e9ab721e..c160c286d21 100644 --- a/dlls/winemac.drv/display.c +++ b/dlls/winemac.drv/display.c @@ -1156,10 +1156,11 @@ UINT macdrv_UpdateDisplayDevices(const struct gdi_device_manager *device_manager for (adapter = adapters; adapter < adapters + adapter_count; adapter++) { DEVMODEW current_mode = { .dmSize = sizeof(current_mode) }; + UINT dpi = NtUserGetSystemDpiForProcess( NULL ); char buffer[32];
sprintf( buffer, "%04x", adapter->id ); - device_manager->add_source( buffer, adapter->state_flags, param ); + device_manager->add_source( buffer, adapter->state_flags, dpi, param );
if (macdrv_get_monitors(adapter->id, &monitors, &monitor_count)) break; TRACE("adapter: %#x, monitor count: %d\n", adapter->id, monitor_count); diff --git a/dlls/winewayland.drv/display.c b/dlls/winewayland.drv/display.c index 9b4ebe7cdc1..5d65fd01c54 100644 --- a/dlls/winewayland.drv/display.c +++ b/dlls/winewayland.drv/display.c @@ -199,9 +199,10 @@ static void wayland_add_device_gpu(const struct gdi_device_manager *device_manag static void wayland_add_device_source(const struct gdi_device_manager *device_manager, void *param, UINT state_flags, struct output_info *output_info) { + UINT dpi = NtUserGetSystemDpiForProcess( NULL ); TRACE("name=%s state_flags=0x%x\n", output_info->output->name, state_flags); - device_manager->add_source(output_info->output->name, state_flags, param); + device_manager->add_source(output_info->output->name, state_flags, dpi, param); }
static void wayland_add_device_monitor(const struct gdi_device_manager *device_manager, diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 6b92e046fb8..3ce21d203d2 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -525,9 +525,10 @@ UINT X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage char buffer[32]; x11drv_settings_id settings_id; BOOL is_primary = adapters[adapter].state_flags & DISPLAY_DEVICE_PRIMARY_DEVICE; + UINT dpi = NtUserGetSystemDpiForProcess( NULL );
sprintf( buffer, "%04lx", adapters[adapter].id ); - device_manager->add_source( buffer, adapters[adapter].state_flags, param ); + device_manager->add_source( buffer, adapters[adapter].state_flags, dpi, param );
if (!host_handler.get_monitors( adapters[adapter].id, &monitors, &monitor_count )) break; TRACE("adapter: %#lx, monitor count: %d\n", adapters[adapter].id, monitor_count); diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index a5ceae87022..6e051cfdaa3 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -219,7 +219,7 @@ struct gdi_dc_funcs };
/* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 96 +#define WINE_GDI_DRIVER_VERSION 97
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ @@ -312,7 +312,7 @@ struct gdi_monitor struct gdi_device_manager { void (*add_gpu)( const char *name, const struct pci_id *pci_id, const GUID *vulkan_uuid, void *param ); - void (*add_source)( const char *name, UINT state_flags, void *param ); + void (*add_source)( const char *name, UINT state_flags, UINT dpi, void *param ); void (*add_monitor)( const struct gdi_monitor *monitor, void *param ); void (*add_modes)( const DEVMODEW *current, UINT modes_count, const DEVMODEW *modes, void *param ); };
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_ */
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/dce.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 2faf73f2f53..b7272b8bef8 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -274,10 +274,15 @@ void create_window_surface( HWND hwnd, BOOL create_layered, const RECT *surface_ UINT dpi = get_dpi_for_window( hwnd ); RECT monitor_rect;
- if ((driver_surface = get_driver_window_surface( *window_surface, monitor_dpi ))) - window_surface_add_ref( driver_surface );
monitor_rect = get_surface_rect( map_dpi_rect( *surface_rect, dpi, monitor_dpi ) ); + if ((driver_surface = get_driver_window_surface( *window_surface, monitor_dpi ))) + { + /* reuse the underlying driver surface only if it also matches the target monitor rect */ + if (EqualRect( &driver_surface->rect, &monitor_rect )) window_surface_add_ref( driver_surface ); + else window_surface_add_ref( (driver_surface = &dummy_surface) ); + } + if (!user_driver->pCreateWindowSurface( hwnd, create_layered, &monitor_rect, &driver_surface )) { if (driver_surface) window_surface_release( driver_surface );
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/defwnd.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 5a615f6cf3f..225f687b218 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2936,6 +2936,16 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, return result; }
+static void update_children_window_state( HWND hwnd ) +{ + HWND *children; + int i; + + if (!(children = list_window_children( 0, hwnd, NULL, 0 ))) return; + for (i = 0; children[i]; i++) update_window_state( children[i] ); + free( children ); +} + LRESULT desktop_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { static const WCHAR wine_display_device_guidW[] = @@ -2992,6 +3002,8 @@ LRESULT desktop_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) flags | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE ); NtUserSetThreadDpiAwarenessContext( context );
+ update_children_window_state( hwnd ); + return send_message_timeout( HWND_BROADCAST, WM_WINE_DESKTOP_RESIZED, old_rect.left, old_rect.top, SMTO_ABORTIFHUNG, 2000, FALSE ); }