From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winewayland.drv/wayland_surface.c | 16 ++++++++++------ dlls/winewayland.drv/waylanddrv.h | 4 +++- dlls/winewayland.drv/window.c | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index 4dc3101de76..9ac95454cfa 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -494,18 +494,19 @@ static void wayland_surface_reconfigure_size(struct wayland_surface *surface, * * Reconfigures the subsurface covering the client area. */ -void wayland_surface_reconfigure_client(struct wayland_surface *surface, struct wayland_client_surface *client) +void wayland_surface_reconfigure_client(struct wayland_surface *surface, struct wayland_client_surface *client, + const RECT *client_rect) { struct wayland_window_config *window = &surface->window; int client_x, client_y, x, y; int client_width, client_height, width, height;
/* The offset of the client area origin relatively to the window origin. */ - client_x = window->client_rect.left - window->rect.left; - client_y = window->client_rect.top - window->rect.top; + client_x = client_rect->left + window->client_rect.left - window->rect.left; + client_y = client_rect->top + window->client_rect.top - window->rect.top;
- client_width = window->client_rect.right - window->client_rect.left; - client_height = window->client_rect.bottom - window->client_rect.top; + client_width = client_rect->right - client_rect->left; + client_height = client_rect->bottom - client_rect->top;
wayland_surface_coords_from_window(surface, client_x, client_y, &x, &y); wayland_surface_coords_from_window(surface, client_width, client_height, @@ -820,6 +821,7 @@ void wayland_client_surface_attach(struct wayland_client_surface *client, HWND t { struct wayland_win_data *toplevel_data = wayland_win_data_get_nolock(toplevel); struct wayland_surface *surface; + RECT client_rect;
if (!toplevel_data || !(surface = toplevel_data->wayland_surface)) { @@ -846,7 +848,9 @@ void wayland_client_surface_attach(struct wayland_client_surface *client, HWND t client->toplevel = toplevel; }
- wayland_surface_reconfigure_client(surface, client); + NtUserGetClientRect(client->hwnd, &client_rect, get_win_monitor_dpi(client->hwnd)); + + wayland_surface_reconfigure_client(surface, client, &client_rect); /* Commit to apply subsurface positioning. */ wl_surface_commit(surface->wl_surface); } diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index bd599f2291b..ec13e76c1cf 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -243,7 +243,8 @@ void wayland_surface_attach_shm(struct wayland_surface *surface, struct wayland_shm_buffer *shm_buffer, HRGN surface_damage_region); BOOL wayland_surface_reconfigure(struct wayland_surface *surface); -void wayland_surface_reconfigure_client(struct wayland_surface *surface, struct wayland_client_surface *client); +void wayland_surface_reconfigure_client(struct wayland_surface *surface, struct wayland_client_surface *client, + const RECT *client_rect); BOOL wayland_surface_config_is_compatible(struct wayland_surface_config *conf, int width, int height, enum wayland_surface_config_state state); @@ -290,6 +291,7 @@ 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 1f219760790..f3072e6d487 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -40,7 +40,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv); /********************************************************************** * get_win_monitor_dpi */ -static UINT get_win_monitor_dpi(HWND hwnd) +UINT get_win_monitor_dpi(HWND hwnd) { return NtUserGetSystemDpiForProcess(NULL); /* FIXME: get monitor dpi */ }