aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-06-06 19:19:30 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-06-09 10:08:43 +1000
commitf9e6d703d298dbdee0770fd9e0c64ab2d7ac7deb (patch)
tree8c8ffd879e368aff3d749a637aabfa784800db5c /sway/desktop
parent59c94887018bdfa578c4371c4275061ca6e71b3e (diff)
downloadsway-f9e6d703d298dbdee0770fd9e0c64ab2d7ac7deb.tar.xz
Make main properties be the pending state
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/desktop.c3
-rw-r--r--sway/desktop/output.c28
-rw-r--r--sway/desktop/transaction.c49
-rw-r--r--sway/desktop/xwayland.c9
4 files changed, 48 insertions, 41 deletions
diff --git a/sway/desktop/desktop.c b/sway/desktop/desktop.c
index 66f33151..e495790c 100644
--- a/sway/desktop/desktop.c
+++ b/sway/desktop/desktop.c
@@ -7,7 +7,8 @@ void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly,
for (int i = 0; i < root_container.children->length; ++i) {
struct sway_container *cont = root_container.children->items[i];
if (cont->type == C_OUTPUT) {
- output_damage_surface(cont->sway_output, lx - cont->x, ly - cont->y,
+ output_damage_surface(cont->sway_output,
+ lx - cont->current.swayc_x, ly - cont->current.swayc_y,
surface, whole);
}
}
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index c5d445a6..8af05bc3 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -774,9 +774,10 @@ static void render_container_stacked(struct sway_output *output,
marks_texture = view ? view->marks_unfocused : NULL;
}
- int y = con->y + container_titlebar_height() * i;
- render_titlebar(output, damage, child, child->x, y, child->width,
- colors, title_texture, marks_texture);
+ int y = con->current.swayc_y + container_titlebar_height() * i;
+ render_titlebar(output, damage, child, child->current.swayc_x, y,
+ child->current.swayc_width, colors,
+ title_texture, marks_texture);
if (child == current) {
current_colors = colors;
@@ -795,7 +796,7 @@ static void render_container_stacked(struct sway_output *output,
static void render_container(struct sway_output *output,
pixman_region32_t *damage, struct sway_container *con,
bool parent_focused) {
- switch (con->layout) {
+ switch (con->current.layout) {
case L_NONE:
case L_HORIZ:
case L_VERT:
@@ -832,9 +833,10 @@ static void render_floating_container(struct sway_output *soutput,
marks_texture = view->marks_unfocused;
}
- if (con->sway_view->border == B_NORMAL) {
- render_titlebar(soutput, damage, con, con->x, con->y, con->width,
- colors, title_texture, marks_texture);
+ if (con->current.border == B_NORMAL) {
+ render_titlebar(soutput, damage, con, con->current.swayc_x,
+ con->current.swayc_y, con->current.swayc_width, colors,
+ title_texture, marks_texture);
} else {
render_top_border(soutput, damage, con, colors);
}
@@ -1184,8 +1186,8 @@ void output_damage_from_view(struct sway_output *output,
void output_damage_box(struct sway_output *output, struct wlr_box *_box) {
struct wlr_box box;
memcpy(&box, _box, sizeof(struct wlr_box));
- box.x -= output->swayc->x;
- box.y -= output->swayc->y;
+ box.x -= output->swayc->current.swayc_x;
+ box.y -= output->swayc->current.swayc_y;
scale_box(&box, output->wlr_output->scale);
wlr_output_damage_add_box(output->damage, &box);
}
@@ -1204,10 +1206,10 @@ static void output_damage_whole_container_iterator(struct sway_container *con,
void output_damage_whole_container(struct sway_output *output,
struct sway_container *con) {
struct wlr_box box = {
- .x = con->x - output->wlr_output->lx,
- .y = con->y - output->wlr_output->ly,
- .width = con->width,
- .height = con->height,
+ .x = con->current.swayc_x - output->wlr_output->lx,
+ .y = con->current.swayc_y - output->wlr_output->ly,
+ .width = con->current.swayc_width,
+ .height = con->current.swayc_height,
};
scale_box(&box, output->wlr_output->scale);
wlr_output_damage_add_box(output->damage, &box);
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 69f97e3d..313e707b 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -67,8 +67,30 @@ void transaction_add_container(struct sway_transaction *transaction,
calloc(1, sizeof(struct sway_transaction_instruction));
instruction->transaction = transaction;
instruction->container = container;
- memcpy(&instruction->state, &container->pending,
- sizeof(struct sway_container_state));
+
+ // Copy the container's main (pending) properties into the instruction state
+ struct sway_container_state *state = &instruction->state;
+ state->layout = container->layout;
+ state->swayc_x = container->x;
+ state->swayc_y = container->y;
+ state->swayc_width = container->width;
+ state->swayc_height = container->height;
+
+ if (container->type == C_VIEW) {
+ struct sway_view *view = container->sway_view;
+ state->view_x = view->x;
+ state->view_y = view->y;
+ state->view_width = view->width;
+ state->view_height = view->height;
+ state->is_fullscreen = view->is_fullscreen;
+ state->border = view->border;
+ state->border_thickness = view->border_thickness;
+ state->border_top = view->border_top;
+ state->border_left = view->border_left;
+ state->border_right = view->border_right;
+ state->border_bottom = view->border_bottom;
+ }
+
list_add(transaction->instructions, instruction);
}
@@ -102,30 +124,13 @@ static void transaction_apply(struct sway_transaction *transaction) {
for (i = 0; i < transaction->instructions->length; ++i) {
struct sway_transaction_instruction *instruction =
transaction->instructions->items[i];
- struct sway_container_state *state = &instruction->state;
struct sway_container *container = instruction->container;
- container->layout = state->layout;
- container->x = state->swayc_x;
- container->y = state->swayc_y;
- container->width = state->swayc_width;
- container->height = state->swayc_height;
+ memcpy(&instruction->container->current, &instruction->state,
+ sizeof(struct sway_container_state));
if (container->type == C_VIEW) {
- struct sway_view *view = container->sway_view;
- view->x = state->view_x;
- view->y = state->view_y;
- view->width = state->view_width;
- view->height = state->view_height;
- view->is_fullscreen = state->is_fullscreen;
- view->border = state->border;
- view->border_thickness = state->border_thickness;
- view->border_top = state->border_top;
- view->border_left = state->border_left;
- view->border_right = state->border_right;
- view->border_bottom = state->border_bottom;
-
- remove_saved_view_texture(view);
+ remove_saved_view_texture(container->sway_view);
}
}
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 6a3c1b66..d8442530 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -257,11 +257,9 @@ static void handle_commit(struct wl_listener *listener, void *data) {
if (view->swayc && container_is_floating(view->swayc)) {
view_update_size(view, xsurface->width, xsurface->height);
} else {
- view_update_size(view, view->swayc->pending.swayc_width,
- view->swayc->pending.swayc_height);
+ view_update_size(view, view->swayc->width, view->swayc->height);
}
- view_update_position(view,
- view->swayc->pending.view_x, view->swayc->pending.view_y);
+ view_update_position(view, view->x, view->y);
view_damage_from(view);
}
}
@@ -314,7 +312,8 @@ static void handle_request_configure(struct wl_listener *listener, void *data) {
return;
}
// TODO: Let floating views do whatever
- configure(view, view->swayc->x, view->swayc->y, view->width, view->height);
+ configure(view, view->swayc->current.view_x, view->swayc->current.view_y,
+ view->swayc->current.view_width, view->swayc->current.view_height);
}
static void handle_request_fullscreen(struct wl_listener *listener, void *data) {