diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 99fb6af1..682c674d 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -2357,7 +2357,7 @@ set_position_from_xwayland(struct shell_surface *shsurf) #ifdef WM_DEBUG weston_log("%s: XWM %d, %d; geometry %d, %d; view %f, %f\n", __func__, shsurf->xwayland.x, shsurf->xwayland.y, - (int)geometry.coord.x, (int)geometry.coord.y, pos.x, pos.y); + (int)geometry.x, (int)geometry.y, pos.c.x, pos.c.y); #endif } diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index 1df73ac1..77371f5c 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -58,10 +58,6 @@ struct weston_geometry { int32_t width, height; }; -struct weston_position { - int32_t x, y; -}; - struct weston_size { int32_t width, height; }; diff --git a/libweston/desktop/surface.c b/libweston/desktop/surface.c index 83151750..39b6e482 100644 --- a/libweston/desktop/surface.c +++ b/libweston/desktop/surface.c @@ -51,7 +51,7 @@ struct weston_desktop_surface { void *user_data; struct weston_surface *surface; struct wl_list view_list; - struct weston_position buffer_move; + struct weston_coord_surface buffer_move; struct wl_listener surface_commit_listener; struct wl_listener surface_destroy_listener; struct wl_listener client_destroy_listener; @@ -69,7 +69,7 @@ struct weston_desktop_surface { struct { struct weston_desktop_surface *parent; struct wl_list children_link; - struct weston_position position; + struct weston_coord pos_offset; bool use_geometry; }; struct { @@ -83,8 +83,8 @@ weston_desktop_surface_update_view_position(struct weston_desktop_surface *surfa struct weston_desktop_view *view; struct weston_desktop_surface *parent = weston_desktop_surface_get_parent(surface); - int32_t x = surface->position.x; - int32_t y = surface->position.y; + int32_t x = surface->pos_offset.x; + int32_t y = surface->pos_offset.y; if (!parent) { struct weston_coord_global pos; @@ -187,12 +187,13 @@ weston_desktop_surface_surface_committed(struct wl_listener *listener, { struct weston_desktop_surface *surface = wl_container_of(listener, surface, surface_commit_listener); + struct weston_surface *wsurface = surface->surface; if (surface->implementation->committed != NULL) surface->implementation->committed(surface, surface->implementation_data, - surface->buffer_move.x, - surface->buffer_move.y); + surface->buffer_move.c.x, + surface->buffer_move.c.y); if (surface->parent != NULL) { struct weston_desktop_view *view; @@ -212,8 +213,7 @@ weston_desktop_surface_surface_committed(struct wl_listener *listener, weston_desktop_surface_update_view_position(child); } - surface->buffer_move.x = 0; - surface->buffer_move.y = 0; + surface->buffer_move = weston_coord_surface(0, 0, wsurface); } static void @@ -242,8 +242,7 @@ weston_desktop_surface_committed(struct weston_surface *wsurface, { struct weston_desktop_surface *surface = wsurface->committed_private; - surface->buffer_move.x = new_origin.c.x; - surface->buffer_move.y = new_origin.c.y; + surface->buffer_move = new_origin; } static void @@ -797,8 +796,8 @@ weston_desktop_surface_set_relative_to(struct weston_desktop_surface *surface, assert(parent); - surface->position.x = x; - surface->position.y = y; + surface->pos_offset.x = x; + surface->pos_offset.y = y; surface->use_geometry = use_geometry; if (surface->parent == parent) diff --git a/libweston/desktop/xdg-shell-v6.c b/libweston/desktop/xdg-shell-v6.c index 92579ac6..96ffa714 100644 --- a/libweston/desktop/xdg-shell-v6.c +++ b/libweston/desktop/xdg-shell-v6.c @@ -53,7 +53,7 @@ struct weston_desktop_xdg_positioner { enum zxdg_positioner_v6_anchor anchor; enum zxdg_positioner_v6_gravity gravity; enum zxdg_positioner_v6_constraint_adjustment constraint_adjustment; - struct weston_position offset; + struct weston_coord offset; }; enum weston_desktop_xdg_surface_role { @@ -279,8 +279,7 @@ weston_desktop_xdg_positioner_protocol_set_offset(struct wl_client *wl_client, struct weston_desktop_xdg_positioner *positioner = wl_resource_get_user_data(resource); - positioner->offset.x = x; - positioner->offset.y = y; + positioner->offset = weston_coord(x, y); } static void @@ -1397,6 +1396,7 @@ weston_desktop_xdg_shell_protocol_create_positioner(struct wl_client *wl_client, free(positioner); return; } + positioner->offset = weston_coord(0, 0); wl_resource_set_implementation(positioner->resource, &weston_desktop_xdg_positioner_implementation, positioner, weston_desktop_xdg_positioner_destroy); diff --git a/libweston/desktop/xdg-shell.c b/libweston/desktop/xdg-shell.c index fb8536ac..ca476f78 100644 --- a/libweston/desktop/xdg-shell.c +++ b/libweston/desktop/xdg-shell.c @@ -60,7 +60,7 @@ struct weston_desktop_xdg_positioner { enum xdg_positioner_anchor anchor; enum xdg_positioner_gravity gravity; enum xdg_positioner_constraint_adjustment constraint_adjustment; - struct weston_position offset; + struct weston_coord offset; }; enum weston_desktop_xdg_surface_role { @@ -304,8 +304,7 @@ weston_desktop_xdg_positioner_protocol_set_offset(struct wl_client *wl_client, struct weston_desktop_xdg_positioner *positioner = wl_resource_get_user_data(resource); - positioner->offset.x = x; - positioner->offset.y = y; + positioner->offset = weston_coord(x, y); } static void @@ -1608,6 +1607,7 @@ weston_desktop_xdg_shell_protocol_create_positioner(struct wl_client *wl_client, free(positioner); return; } + positioner->offset = weston_coord(0, 0); wl_resource_set_implementation(positioner->resource, &weston_desktop_xdg_positioner_implementation, positioner, weston_desktop_xdg_positioner_destroy);