Module: wine Branch: master Commit: 65a4789a7c8170a3864b0aa5d89106a8bfba25d9 URL: https://gitlab.winehq.org/wine/wine/-/commit/65a4789a7c8170a3864b0aa5d89106a...
Author: Alexandros Frantzis alexandros.frantzis@collabora.com Date: Mon Nov 6 10:40:59 2023 +0200
winewayland.drv: Set client area subsurface position.
Set the position of the client area subsurface relative to its parent surface.
---
dlls/winewayland.drv/wayland_surface.c | 26 ++++++++++++++++++++++++++ dlls/winewayland.drv/waylanddrv.h | 1 + dlls/winewayland.drv/window.c | 11 +++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index cdcee27a042..f4a64d19ecd 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -468,6 +468,29 @@ static void wayland_surface_reconfigure_size(struct wayland_surface *surface, } }
+/********************************************************************** + * wayland_surface_reconfigure_client + * + * Reconfigures the subsurface covering the client area. + */ +static void wayland_surface_reconfigure_client(struct wayland_surface *surface) +{ + struct wayland_window_config *window = &surface->window; + int client_x, client_y, x, y; + + if (!surface->client) return; + + /* 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; + + wayland_surface_coords_from_window(surface, client_x, client_y, &x, &y); + + TRACE("hwnd=%p subsurface=%d,%d\n", surface->hwnd, x, y); + + wl_subsurface_set_position(surface->client->wl_subsurface, x, y); +} + /********************************************************************** * wayland_surface_reconfigure * @@ -525,6 +548,7 @@ BOOL wayland_surface_reconfigure(struct wayland_surface *surface)
wayland_surface_reconfigure_geometry(surface, width, height); wayland_surface_reconfigure_size(surface, width, height); + wayland_surface_reconfigure_client(surface);
return TRUE; } @@ -744,6 +768,8 @@ struct wayland_client_surface *wayland_surface_get_client(struct wayland_surface goto err; }
+ wayland_surface_reconfigure_client(surface); + return surface->client;
err: diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 928c2f023eb..2dc49a2fd4b 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -159,6 +159,7 @@ struct wayland_surface_config struct wayland_window_config { RECT rect; + RECT client_rect; enum wayland_surface_config_state state; /* The scale (i.e., normalized dpi) the window is rendering at. */ double scale; diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 1423164834e..fff3749e9ad 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -45,6 +45,8 @@ struct wayland_win_data struct window_surface *window_surface; /* USER window rectangle relative to win32 parent window client area */ RECT window_rect; + /* USER client rectangle relative to win32 parent window client area */ + RECT client_rect; };
static int wayland_win_data_cmp_rb(const void *key, @@ -68,7 +70,8 @@ static struct rb_tree win_data_rb = { wayland_win_data_cmp_rb }; * Create a data window structure for an existing window. */ static struct wayland_win_data *wayland_win_data_create(HWND hwnd, - const RECT *window_rect) + const RECT *window_rect, + const RECT *client_rect) { struct wayland_win_data *data; struct rb_entry *rb_entry; @@ -83,6 +86,7 @@ static struct wayland_win_data *wayland_win_data_create(HWND hwnd,
data->hwnd = hwnd; data->window_rect = *window_rect; + data->client_rect = *client_rect;
pthread_mutex_lock(&win_data_mutex);
@@ -157,6 +161,7 @@ static void wayland_win_data_get_config(struct wayland_win_data *data, DWORD style;
conf->rect = data->window_rect; + conf->client_rect = data->client_rect; style = NtUserGetWindowLongW(data->hwnd, GWL_STYLE);
TRACE("window=%s style=%#lx\n", wine_dbgstr_rect(&conf->rect), (long)style); @@ -310,7 +315,8 @@ BOOL WAYLAND_WindowPosChanging(HWND hwnd, HWND insert_after, UINT swp_flags, hwnd, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), wine_dbgstr_rect(visible_rect), insert_after, swp_flags);
- if (!data && !(data = wayland_win_data_create(hwnd, window_rect))) return TRUE; + if (!data && !(data = wayland_win_data_create(hwnd, window_rect, client_rect))) + return TRUE;
/* Release the dummy surface wine provides for toplevels. */ if (*surface) window_surface_release(*surface); @@ -361,6 +367,7 @@ void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, if (!data) return;
data->window_rect = *window_rect; + data->client_rect = *client_rect;
if (surface) window_surface_add_ref(surface); if (data->window_surface) window_surface_release(data->window_surface);