aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-11-17 18:32:03 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-11-17 21:29:42 +1000
commitbe9348d25c9556bdabb83d964a8761f920fc4a11 (patch)
treec06bde3d10e9bfea04acdd9b055cd596f13d4522 /sway/tree/view.c
parentMerge pull request #3132 from emersion/dispatch-cursor-btn-segfault (diff)
downloadsway-be9348d25c9556bdabb83d964a8761f920fc4a11.tar.gz
sway-be9348d25c9556bdabb83d964a8761f920fc4a11.tar.zst
sway-be9348d25c9556bdabb83d964a8761f920fc4a11.zip
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.
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 21b32649..18195467 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -196,22 +196,22 @@ static bool gaps_to_edge(struct sway_view *view) {
196} 196}
197 197
198void view_autoconfigure(struct sway_view *view) { 198void view_autoconfigure(struct sway_view *view) {
199 if (!view->container->workspace) { 199 struct sway_container *con = view->container;
200 if (!con->workspace) {
200 // Hidden in the scratchpad 201 // Hidden in the scratchpad
201 return; 202 return;
202 } 203 }
203 struct sway_output *output = view->container->workspace->output; 204 struct sway_output *output = con->workspace->output;
204 205
205 if (view->container->is_fullscreen) { 206 if (con->is_fullscreen) {
206 view->x = output->lx; 207 con->content_x = output->lx;
207 view->y = output->ly; 208 con->content_y = output->ly;
208 view->width = output->width; 209 con->content_width = output->width;
209 view->height = output->height; 210 con->content_height = output->height;
210 return; 211 return;
211 } 212 }
212 213
213 struct sway_workspace *ws = view->container->workspace; 214 struct sway_workspace *ws = view->container->workspace;
214 struct sway_container *con = view->container;
215 215
216 bool smart = config->hide_edge_borders == E_SMART || 216 bool smart = config->hide_edge_borders == E_SMART ||
217 config->hide_edge_borders == E_SMART_NO_GAPS; 217 config->hide_edge_borders == E_SMART_NO_GAPS;
@@ -289,10 +289,10 @@ void view_autoconfigure(struct sway_view *view) {
289 break; 289 break;
290 } 290 }
291 291
292 view->x = x; 292 con->content_x = x;
293 view->y = y; 293 con->content_y = y;
294 view->width = width; 294 con->content_width = width;
295 view->height = height; 295 con->content_height = height;
296} 296}
297 297
298void view_set_activated(struct sway_view *view, bool activated) { 298void view_set_activated(struct sway_view *view, bool activated) {
@@ -667,11 +667,11 @@ void view_update_size(struct sway_view *view, int width, int height) {
667 "Expected a floating container")) { 667 "Expected a floating container")) {
668 return; 668 return;
669 } 669 }
670 view->width = width; 670 view->container->content_width = width;
671 view->height = height; 671 view->container->content_height = height;
672 view->container->current.view_width = width; 672 view->container->current.content_width = width;
673 view->container->current.view_height = height; 673 view->container->current.content_height = height;
674 container_set_geometry_from_floating_view(view->container); 674 container_set_geometry_from_content(view->container);
675} 675}
676 676
677static void subsurface_get_root_coords(struct sway_view_child *child, 677static void subsurface_get_root_coords(struct sway_view_child *child,
@@ -707,7 +707,8 @@ static void view_child_damage(struct sway_view_child *child, bool whole) {
707 int sx, sy; 707 int sx, sy;
708 child->impl->get_root_coords(child, &sx, &sy); 708 child->impl->get_root_coords(child, &sx, &sy);
709 desktop_damage_surface(child->surface, 709 desktop_damage_surface(child->surface,
710 child->view->x + sx, child->view->y + sy, whole); 710 child->view->container->content_x + sx,
711 child->view->container->content_y + sy, whole);
711} 712}
712 713
713static void view_child_handle_surface_commit(struct wl_listener *listener, 714static void view_child_handle_surface_commit(struct wl_listener *listener,