From be9348d25c9556bdabb83d964a8761f920fc4a11 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 17 Nov 2018 18:32:03 +1000 Subject: Move view {x,y,width,height} into container struct This renames/moves the following properties: * sway_view.{x,y,width,height} -> sway_container.content_{x,y,width,height} * This is required to support placeholder containers as they don't have a view. * sway_container_state.view_{x,y,width,height} -> sway_container_state.content_{x,y,width,height} * To remain consistent with the above. * sway_container_state.con_{x,y,width,height} -> sway_container_state.{x,y,width,height} * The con prefix was there to give it contrast from the view properties, and is no longer useful. The function container_set_geometry_from_floating_view has also been renamed to container_set_geometry_from_content. --- sway/input/cursor.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'sway/input/cursor.c') diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 81b82abc..c81e9ab1 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -348,7 +348,7 @@ static void handle_move_tiling_motion(struct sway_seat *seat, } // Find the closest edge - size_t thickness = fmin(con->view->width, con->view->height) * 0.3; + size_t thickness = fmin(con->content_width, con->content_height) * 0.3; size_t closest_dist = INT_MAX; size_t dist; seat->op_target_edge = WLR_EDGE_NONE; @@ -374,10 +374,10 @@ static void handle_move_tiling_motion(struct sway_seat *seat, } seat->op_target_node = node; - seat->op_drop_box.x = con->view->x; - seat->op_drop_box.y = con->view->y; - seat->op_drop_box.width = con->view->width; - seat->op_drop_box.height = con->view->height; + seat->op_drop_box.x = con->content_x; + seat->op_drop_box.y = con->content_y; + seat->op_drop_box.width = con->content_width; + seat->op_drop_box.height = con->content_height; resize_box(&seat->op_drop_box, seat->op_target_edge, thickness); desktop_damage_box(&seat->op_drop_box); } @@ -498,13 +498,10 @@ static void handle_resize_floating_motion(struct sway_seat *seat, con->width += relative_grow_width; con->height += relative_grow_height; - if (con->view) { - struct sway_view *view = con->view; - view->x += relative_grow_x; - view->y += relative_grow_y; - view->width += relative_grow_width; - view->height += relative_grow_height; - } + con->content_x += relative_grow_x; + con->content_y += relative_grow_y; + con->content_width += relative_grow_width; + con->content_height += relative_grow_height; arrange_container(con); } -- cgit v1.2.3-54-g00ecf