summaryrefslogtreecommitdiff
path: root/sway/desktop/transaction.c
diff options
context:
space:
mode:
authorRyan Dwyer <[email protected]>2018-11-17 18:32:03 +1000
committerRyan Dwyer <[email protected]>2018-11-17 21:29:42 +1000
commitbe9348d25c9556bdabb83d964a8761f920fc4a11 (patch)
treec06bde3d10e9bfea04acdd9b055cd596f13d4522 /sway/desktop/transaction.c
parentcb63321de6b663530a5b27f323363843cd2720a7 (diff)
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,
struct sway_container_state *state = &instruction->container_state;
state->layout = container->layout;
- state->con_x = container->x;
- state->con_y = container->y;
- state->con_width = container->width;
- state->con_height = container->height;
+ state->x = container->x;
+ state->y = container->y;
+ state->width = container->width;
+ state->height = container->height;
state->is_fullscreen = container->is_fullscreen;
state->parent = container->parent;
state->workspace = container->workspace;
@@ -143,14 +143,12 @@ static void copy_container_state(struct sway_container *container,
state->border_left = container->border_left;
state->border_right = container->border_right;
state->border_bottom = container->border_bottom;
+ state->content_x = container->content_x;
+ state->content_y = container->content_y;
+ state->content_width = container->content_width;
+ state->content_height = container->content_height;
- if (container->view) {
- struct sway_view *view = container->view;
- state->view_x = view->x;
- state->view_y = view->y;
- state->view_width = view->width;
- state->view_height = view->height;
- } else {
+ if (!container->view) {
state->children = create_list();
list_cat(state->children, container->children);
}
@@ -217,8 +215,8 @@ static void apply_container_state(struct sway_container *container,
desktop_damage_whole_container(container);
if (view && view->saved_buffer) {
struct wlr_box box = {
- .x = container->current.view_x - view->saved_geometry.x,
- .y = container->current.view_y - view->saved_geometry.y,
+ .x = container->current.content_x - view->saved_geometry.x,
+ .y = container->current.content_y - view->saved_geometry.y,
.width = view->saved_buffer_width,
.height = view->saved_buffer_height,
};
@@ -245,8 +243,8 @@ static void apply_container_state(struct sway_container *container,
if (view && view->surface) {
struct wlr_surface *surface = view->surface;
struct wlr_box box = {
- .x = container->current.view_x - view->geometry.x,
- .y = container->current.view_y - view->geometry.y,
+ .x = container->current.content_x - view->geometry.x,
+ .y = container->current.content_y - view->geometry.y,
.width = surface->current.width,
.height = surface->current.height,
};
@@ -386,14 +384,14 @@ static bool should_configure(struct sway_node *node,
// Xwayland views are position-aware and need to be reconfigured
// when their position changes.
if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) {
- if (cstate->view_x != istate->view_x ||
- cstate->view_y != istate->view_y) {
+ if (cstate->content_x != istate->content_x ||
+ cstate->content_y != istate->content_y) {
return true;
}
}
#endif
- if (cstate->view_width == istate->view_width &&
- cstate->view_height == istate->view_height) {
+ if (cstate->content_width == istate->content_width &&
+ cstate->content_height == istate->content_height) {
return false;
}
return true;
@@ -409,10 +407,10 @@ static void transaction_commit(struct sway_transaction *transaction) {
struct sway_node *node = instruction->node;
if (should_configure(node, instruction)) {
instruction->serial = view_configure(node->sway_container->view,
- instruction->container_state.view_x,
- instruction->container_state.view_y,
- instruction->container_state.view_width,
- instruction->container_state.view_height);
+ instruction->container_state.content_x,
+ instruction->container_state.content_y,
+ instruction->container_state.content_width,
+ instruction->container_state.content_height);
++transaction->num_waiting;
// 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,
int width, int height) {
struct sway_transaction_instruction *instruction =
view->container->node.instruction;
- if (instruction->container_state.view_width == width &&
- instruction->container_state.view_height == height) {
+ if (instruction->container_state.content_width == width &&
+ instruction->container_state.content_height == height) {
set_instruction_ready(instruction);
}
}