aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/transaction.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/desktop/transaction.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/desktop/transaction.c')
-rw-r--r--sway/desktop/transaction.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 44156d41..39cb641f 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -130,10 +130,10 @@ static void copy_container_state(struct sway_container *container,
130 struct sway_container_state *state = &instruction->container_state; 130 struct sway_container_state *state = &instruction->container_state;
131 131
132 state->layout = container->layout; 132 state->layout = container->layout;
133 state->con_x = container->x; 133 state->x = container->x;
134 state->con_y = container->y; 134 state->y = container->y;
135 state->con_width = container->width; 135 state->width = container->width;
136 state->con_height = container->height; 136 state->height = container->height;
137 state->is_fullscreen = container->is_fullscreen; 137 state->is_fullscreen = container->is_fullscreen;
138 state->parent = container->parent; 138 state->parent = container->parent;
139 state->workspace = container->workspace; 139 state->workspace = container->workspace;
@@ -143,14 +143,12 @@ static void copy_container_state(struct sway_container *container,
143 state->border_left = container->border_left; 143 state->border_left = container->border_left;
144 state->border_right = container->border_right; 144 state->border_right = container->border_right;
145 state->border_bottom = container->border_bottom; 145 state->border_bottom = container->border_bottom;
146 state->content_x = container->content_x;
147 state->content_y = container->content_y;
148 state->content_width = container->content_width;
149 state->content_height = container->content_height;
146 150
147 if (container->view) { 151 if (!container->view) {
148 struct sway_view *view = container->view;
149 state->view_x = view->x;
150 state->view_y = view->y;
151 state->view_width = view->width;
152 state->view_height = view->height;
153 } else {
154 state->children = create_list(); 152 state->children = create_list();
155 list_cat(state->children, container->children); 153 list_cat(state->children, container->children);
156 } 154 }
@@ -217,8 +215,8 @@ static void apply_container_state(struct sway_container *container,
217 desktop_damage_whole_container(container); 215 desktop_damage_whole_container(container);
218 if (view && view->saved_buffer) { 216 if (view && view->saved_buffer) {
219 struct wlr_box box = { 217 struct wlr_box box = {
220 .x = container->current.view_x - view->saved_geometry.x, 218 .x = container->current.content_x - view->saved_geometry.x,
221 .y = container->current.view_y - view->saved_geometry.y, 219 .y = container->current.content_y - view->saved_geometry.y,
222 .width = view->saved_buffer_width, 220 .width = view->saved_buffer_width,
223 .height = view->saved_buffer_height, 221 .height = view->saved_buffer_height,
224 }; 222 };
@@ -245,8 +243,8 @@ static void apply_container_state(struct sway_container *container,
245 if (view && view->surface) { 243 if (view && view->surface) {
246 struct wlr_surface *surface = view->surface; 244 struct wlr_surface *surface = view->surface;
247 struct wlr_box box = { 245 struct wlr_box box = {
248 .x = container->current.view_x - view->geometry.x, 246 .x = container->current.content_x - view->geometry.x,
249 .y = container->current.view_y - view->geometry.y, 247 .y = container->current.content_y - view->geometry.y,
250 .width = surface->current.width, 248 .width = surface->current.width,
251 .height = surface->current.height, 249 .height = surface->current.height,
252 }; 250 };
@@ -386,14 +384,14 @@ static bool should_configure(struct sway_node *node,
386 // Xwayland views are position-aware and need to be reconfigured 384 // Xwayland views are position-aware and need to be reconfigured
387 // when their position changes. 385 // when their position changes.
388 if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) { 386 if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) {
389 if (cstate->view_x != istate->view_x || 387 if (cstate->content_x != istate->content_x ||
390 cstate->view_y != istate->view_y) { 388 cstate->content_y != istate->content_y) {
391 return true; 389 return true;
392 } 390 }
393 } 391 }
394#endif 392#endif
395 if (cstate->view_width == istate->view_width && 393 if (cstate->content_width == istate->content_width &&
396 cstate->view_height == istate->view_height) { 394 cstate->content_height == istate->content_height) {
397 return false; 395 return false;
398 } 396 }
399 return true; 397 return true;
@@ -409,10 +407,10 @@ static void transaction_commit(struct sway_transaction *transaction) {
409 struct sway_node *node = instruction->node; 407 struct sway_node *node = instruction->node;
410 if (should_configure(node, instruction)) { 408 if (should_configure(node, instruction)) {
411 instruction->serial = view_configure(node->sway_container->view, 409 instruction->serial = view_configure(node->sway_container->view,
412 instruction->container_state.view_x, 410 instruction->container_state.content_x,
413 instruction->container_state.view_y, 411 instruction->container_state.content_y,
414 instruction->container_state.view_width, 412 instruction->container_state.content_width,
415 instruction->container_state.view_height); 413 instruction->container_state.content_height);
416 ++transaction->num_waiting; 414 ++transaction->num_waiting;
417 415
418 // From here on we are rendering a saved buffer of the view, which 416 // From here on we are rendering a saved buffer of the view, which
@@ -504,8 +502,8 @@ void transaction_notify_view_ready_by_size(struct sway_view *view,
504 int width, int height) { 502 int width, int height) {
505 struct sway_transaction_instruction *instruction = 503 struct sway_transaction_instruction *instruction =
506 view->container->node.instruction; 504 view->container->node.instruction;
507 if (instruction->container_state.view_width == width && 505 if (instruction->container_state.content_width == width &&
508 instruction->container_state.view_height == height) { 506 instruction->container_state.content_height == height) {
509 set_instruction_ready(instruction); 507 set_instruction_ready(instruction);
510 } 508 }
511} 509}