From: Alexandros Frantzis alexandros.frantzis@collabora.com
Set the position of the client area subsurface relative to its parent surface. --- dlls/winewayland.drv/wayland_surface.c | 23 +++++++++++++++++++++++ dlls/winewayland.drv/waylanddrv.h | 1 + dlls/winewayland.drv/window.c | 11 +++++++++-- 3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index 61bbfdc2588..91c8d396975 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -427,6 +427,26 @@ static void wayland_surface_reconfigure_geometry(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 x, y; + + if (!surface->client) return; + + x = window->client_rect.left - window->rect.left; + y = window->client_rect.top - window->rect.top; + + TRACE("hwnd=%p subsurface=%d,%d\n", surface->hwnd, x, y); + + wl_subsurface_set_position(surface->client->wl_subsurface, x, y); +} + /********************************************************************** * wayland_surface_reconfigure * @@ -480,6 +500,7 @@ BOOL wayland_surface_reconfigure(struct wayland_surface *surface) }
wayland_surface_reconfigure_geometry(surface); + wayland_surface_reconfigure_client(surface);
return TRUE; } @@ -673,6 +694,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 37c6cef570a..b5d5462d18e 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -146,6 +146,7 @@ struct wayland_surface_config struct wayland_window_config { RECT rect; + RECT client_rect; enum wayland_surface_config_state state; };
diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 57d2f15a06b..984dfbe5d26 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); @@ -309,7 +314,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); @@ -360,6 +366,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);