diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-06 19:19:30 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-09 10:08:43 +1000 |
commit | f9e6d703d298dbdee0770fd9e0c64ab2d7ac7deb (patch) | |
tree | 8c8ffd879e368aff3d749a637aabfa784800db5c /sway/desktop | |
parent | WIP: Atomic layout updates ground work (diff) | |
download | sway-f9e6d703d298dbdee0770fd9e0c64ab2d7ac7deb.tar.gz sway-f9e6d703d298dbdee0770fd9e0c64ab2d7ac7deb.tar.zst sway-f9e6d703d298dbdee0770fd9e0c64ab2d7ac7deb.zip |
Make main properties be the pending state
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/desktop.c | 3 | ||||
-rw-r--r-- | sway/desktop/output.c | 28 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 49 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 9 |
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, | |||
7 | for (int i = 0; i < root_container.children->length; ++i) { | 7 | for (int i = 0; i < root_container.children->length; ++i) { |
8 | struct sway_container *cont = root_container.children->items[i]; | 8 | struct sway_container *cont = root_container.children->items[i]; |
9 | if (cont->type == C_OUTPUT) { | 9 | if (cont->type == C_OUTPUT) { |
10 | output_damage_surface(cont->sway_output, lx - cont->x, ly - cont->y, | 10 | output_damage_surface(cont->sway_output, |
11 | lx - cont->current.swayc_x, ly - cont->current.swayc_y, | ||
11 | surface, whole); | 12 | surface, whole); |
12 | } | 13 | } |
13 | } | 14 | } |
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, | |||
774 | marks_texture = view ? view->marks_unfocused : NULL; | 774 | marks_texture = view ? view->marks_unfocused : NULL; |
775 | } | 775 | } |
776 | 776 | ||
777 | int y = con->y + container_titlebar_height() * i; | 777 | int y = con->current.swayc_y + container_titlebar_height() * i; |
778 | render_titlebar(output, damage, child, child->x, y, child->width, | 778 | render_titlebar(output, damage, child, child->current.swayc_x, y, |
779 | colors, title_texture, marks_texture); | 779 | child->current.swayc_width, colors, |
780 | title_texture, marks_texture); | ||
780 | 781 | ||
781 | if (child == current) { | 782 | if (child == current) { |
782 | current_colors = colors; | 783 | current_colors = colors; |
@@ -795,7 +796,7 @@ static void render_container_stacked(struct sway_output *output, | |||
795 | static void render_container(struct sway_output *output, | 796 | static void render_container(struct sway_output *output, |
796 | pixman_region32_t *damage, struct sway_container *con, | 797 | pixman_region32_t *damage, struct sway_container *con, |
797 | bool parent_focused) { | 798 | bool parent_focused) { |
798 | switch (con->layout) { | 799 | switch (con->current.layout) { |
799 | case L_NONE: | 800 | case L_NONE: |
800 | case L_HORIZ: | 801 | case L_HORIZ: |
801 | case L_VERT: | 802 | case L_VERT: |
@@ -832,9 +833,10 @@ static void render_floating_container(struct sway_output *soutput, | |||
832 | marks_texture = view->marks_unfocused; | 833 | marks_texture = view->marks_unfocused; |
833 | } | 834 | } |
834 | 835 | ||
835 | if (con->sway_view->border == B_NORMAL) { | 836 | if (con->current.border == B_NORMAL) { |
836 | render_titlebar(soutput, damage, con, con->x, con->y, con->width, | 837 | render_titlebar(soutput, damage, con, con->current.swayc_x, |
837 | colors, title_texture, marks_texture); | 838 | con->current.swayc_y, con->current.swayc_width, colors, |
839 | title_texture, marks_texture); | ||
838 | } else { | 840 | } else { |
839 | render_top_border(soutput, damage, con, colors); | 841 | render_top_border(soutput, damage, con, colors); |
840 | } | 842 | } |
@@ -1184,8 +1186,8 @@ void output_damage_from_view(struct sway_output *output, | |||
1184 | void output_damage_box(struct sway_output *output, struct wlr_box *_box) { | 1186 | void output_damage_box(struct sway_output *output, struct wlr_box *_box) { |
1185 | struct wlr_box box; | 1187 | struct wlr_box box; |
1186 | memcpy(&box, _box, sizeof(struct wlr_box)); | 1188 | memcpy(&box, _box, sizeof(struct wlr_box)); |
1187 | box.x -= output->swayc->x; | 1189 | box.x -= output->swayc->current.swayc_x; |
1188 | box.y -= output->swayc->y; | 1190 | box.y -= output->swayc->current.swayc_y; |
1189 | scale_box(&box, output->wlr_output->scale); | 1191 | scale_box(&box, output->wlr_output->scale); |
1190 | wlr_output_damage_add_box(output->damage, &box); | 1192 | wlr_output_damage_add_box(output->damage, &box); |
1191 | } | 1193 | } |
@@ -1204,10 +1206,10 @@ static void output_damage_whole_container_iterator(struct sway_container *con, | |||
1204 | void output_damage_whole_container(struct sway_output *output, | 1206 | void output_damage_whole_container(struct sway_output *output, |
1205 | struct sway_container *con) { | 1207 | struct sway_container *con) { |
1206 | struct wlr_box box = { | 1208 | struct wlr_box box = { |
1207 | .x = con->x - output->wlr_output->lx, | 1209 | .x = con->current.swayc_x - output->wlr_output->lx, |
1208 | .y = con->y - output->wlr_output->ly, | 1210 | .y = con->current.swayc_y - output->wlr_output->ly, |
1209 | .width = con->width, | 1211 | .width = con->current.swayc_width, |
1210 | .height = con->height, | 1212 | .height = con->current.swayc_height, |
1211 | }; | 1213 | }; |
1212 | scale_box(&box, output->wlr_output->scale); | 1214 | scale_box(&box, output->wlr_output->scale); |
1213 | wlr_output_damage_add_box(output->damage, &box); | 1215 | 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, | |||
67 | calloc(1, sizeof(struct sway_transaction_instruction)); | 67 | calloc(1, sizeof(struct sway_transaction_instruction)); |
68 | instruction->transaction = transaction; | 68 | instruction->transaction = transaction; |
69 | instruction->container = container; | 69 | instruction->container = container; |
70 | memcpy(&instruction->state, &container->pending, | 70 | |
71 | sizeof(struct sway_container_state)); | 71 | // Copy the container's main (pending) properties into the instruction state |
72 | struct sway_container_state *state = &instruction->state; | ||
73 | state->layout = container->layout; | ||
74 | state->swayc_x = container->x; | ||
75 | state->swayc_y = container->y; | ||
76 | state->swayc_width = container->width; | ||
77 | state->swayc_height = container->height; | ||
78 | |||
79 | if (container->type == C_VIEW) { | ||
80 | struct sway_view *view = container->sway_view; | ||
81 | state->view_x = view->x; | ||
82 | state->view_y = view->y; | ||
83 | state->view_width = view->width; | ||
84 | state->view_height = view->height; | ||
85 | state->is_fullscreen = view->is_fullscreen; | ||
86 | state->border = view->border; | ||
87 | state->border_thickness = view->border_thickness; | ||
88 | state->border_top = view->border_top; | ||
89 | state->border_left = view->border_left; | ||
90 | state->border_right = view->border_right; | ||
91 | state->border_bottom = view->border_bottom; | ||
92 | } | ||
93 | |||
72 | list_add(transaction->instructions, instruction); | 94 | list_add(transaction->instructions, instruction); |
73 | } | 95 | } |
74 | 96 | ||
@@ -102,30 +124,13 @@ static void transaction_apply(struct sway_transaction *transaction) { | |||
102 | for (i = 0; i < transaction->instructions->length; ++i) { | 124 | for (i = 0; i < transaction->instructions->length; ++i) { |
103 | struct sway_transaction_instruction *instruction = | 125 | struct sway_transaction_instruction *instruction = |
104 | transaction->instructions->items[i]; | 126 | transaction->instructions->items[i]; |
105 | struct sway_container_state *state = &instruction->state; | ||
106 | struct sway_container *container = instruction->container; | 127 | struct sway_container *container = instruction->container; |
107 | 128 | ||
108 | container->layout = state->layout; | 129 | memcpy(&instruction->container->current, &instruction->state, |
109 | container->x = state->swayc_x; | 130 | sizeof(struct sway_container_state)); |
110 | container->y = state->swayc_y; | ||
111 | container->width = state->swayc_width; | ||
112 | container->height = state->swayc_height; | ||
113 | 131 | ||
114 | if (container->type == C_VIEW) { | 132 | if (container->type == C_VIEW) { |
115 | struct sway_view *view = container->sway_view; | 133 | remove_saved_view_texture(container->sway_view); |
116 | view->x = state->view_x; | ||
117 | view->y = state->view_y; | ||
118 | view->width = state->view_width; | ||
119 | view->height = state->view_height; | ||
120 | view->is_fullscreen = state->is_fullscreen; | ||
121 | view->border = state->border; | ||
122 | view->border_thickness = state->border_thickness; | ||
123 | view->border_top = state->border_top; | ||
124 | view->border_left = state->border_left; | ||
125 | view->border_right = state->border_right; | ||
126 | view->border_bottom = state->border_bottom; | ||
127 | |||
128 | remove_saved_view_texture(view); | ||
129 | } | 134 | } |
130 | } | 135 | } |
131 | 136 | ||
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) { | |||
257 | if (view->swayc && container_is_floating(view->swayc)) { | 257 | if (view->swayc && container_is_floating(view->swayc)) { |
258 | view_update_size(view, xsurface->width, xsurface->height); | 258 | view_update_size(view, xsurface->width, xsurface->height); |
259 | } else { | 259 | } else { |
260 | view_update_size(view, view->swayc->pending.swayc_width, | 260 | view_update_size(view, view->swayc->width, view->swayc->height); |
261 | view->swayc->pending.swayc_height); | ||
262 | } | 261 | } |
263 | view_update_position(view, | 262 | view_update_position(view, view->x, view->y); |
264 | view->swayc->pending.view_x, view->swayc->pending.view_y); | ||
265 | view_damage_from(view); | 263 | view_damage_from(view); |
266 | } | 264 | } |
267 | } | 265 | } |
@@ -314,7 +312,8 @@ static void handle_request_configure(struct wl_listener *listener, void *data) { | |||
314 | return; | 312 | return; |
315 | } | 313 | } |
316 | // TODO: Let floating views do whatever | 314 | // TODO: Let floating views do whatever |
317 | configure(view, view->swayc->x, view->swayc->y, view->width, view->height); | 315 | configure(view, view->swayc->current.view_x, view->swayc->current.view_y, |
316 | view->swayc->current.view_width, view->swayc->current.view_height); | ||
318 | } | 317 | } |
319 | 318 | ||
320 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { | 319 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { |