aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-29 21:13:22 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-29 21:13:22 +1000
commit3a6ed5110c76ef5bed8cc4c26a97759f6201eaac (patch)
treea24798e2e0954daef195806b01938ec8a8bbcaed /sway
parentMerge remote-tracking branch 'upstream/master' into atomic (diff)
downloadsway-3a6ed5110c76ef5bed8cc4c26a97759f6201eaac.tar.gz
sway-3a6ed5110c76ef5bed8cc4c26a97759f6201eaac.tar.zst
sway-3a6ed5110c76ef5bed8cc4c26a97759f6201eaac.zip
Render saved buffers with the surface's dimensions
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/output.c8
-rw-r--r--sway/desktop/transaction.c17
2 files changed, 16 insertions, 9 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 69d0bdd4..b55a3962 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -354,15 +354,17 @@ static void render_saved_view(struct sway_view *view,
354 struct sway_output *output, pixman_region32_t *damage, float alpha) { 354 struct sway_output *output, pixman_region32_t *damage, float alpha) {
355 struct wlr_output *wlr_output = output->wlr_output; 355 struct wlr_output *wlr_output = output->wlr_output;
356 356
357 struct wlr_texture *texture = transaction_get_texture(view); 357 int width, height;
358 struct wlr_texture *texture =
359 transaction_get_saved_texture(view, &width, &height);
358 if (!texture) { 360 if (!texture) {
359 return; 361 return;
360 } 362 }
361 struct wlr_box box = { 363 struct wlr_box box = {
362 .x = view->swayc->current.view_x - output->swayc->current.swayc_x, 364 .x = view->swayc->current.view_x - output->swayc->current.swayc_x,
363 .y = view->swayc->current.view_y - output->swayc->current.swayc_y, 365 .y = view->swayc->current.view_y - output->swayc->current.swayc_y,
364 .width = view->swayc->current.view_width, 366 .width = width,
365 .height = view->swayc->current.view_height, 367 .height = height,
366 }; 368 };
367 369
368 struct wlr_box output_box = { 370 struct wlr_box output_box = {
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index fc23ef35..7c5a9b8f 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -41,6 +41,7 @@ struct sway_transaction_instruction {
41 struct sway_container *container; 41 struct sway_container *container;
42 struct sway_container_state state; 42 struct sway_container_state state;
43 struct wlr_buffer *saved_buffer; 43 struct wlr_buffer *saved_buffer;
44 int saved_buffer_width, saved_buffer_height;
44 uint32_t serial; 45 uint32_t serial;
45 bool ready; 46 bool ready;
46}; 47};
@@ -71,6 +72,8 @@ static void save_view_buffer(struct sway_view *view,
71 } 72 }
72 if (view->surface && wlr_surface_has_buffer(view->surface)) { 73 if (view->surface && wlr_surface_has_buffer(view->surface)) {
73 instruction->saved_buffer = wlr_buffer_ref(view->surface->buffer); 74 instruction->saved_buffer = wlr_buffer_ref(view->surface->buffer);
75 instruction->saved_buffer_width = view->surface->current->width;
76 instruction->saved_buffer_height = view->surface->current->height;
74 } 77 }
75} 78}
76 79
@@ -392,12 +395,14 @@ void transaction_notify_view_ready_by_size(struct sway_view *view,
392 } 395 }
393} 396}
394 397
395struct wlr_texture *transaction_get_texture(struct sway_view *view) { 398struct wlr_texture *transaction_get_saved_texture(struct sway_view *view,
396 if (!view->swayc || !view->swayc->instructions->length) { 399 int *width, int *height) {
397 return view->surface->buffer->texture;
398 }
399 struct sway_transaction_instruction *instruction = 400 struct sway_transaction_instruction *instruction =
400 view->swayc->instructions->items[0]; 401 view->swayc->instructions->items[0];
401 return instruction->saved_buffer ? 402 if (!instruction->saved_buffer) {
402 instruction->saved_buffer->texture : NULL; 403 return NULL;
404 }
405 *width = instruction->saved_buffer_width;
406 *height = instruction->saved_buffer_height;
407 return instruction->saved_buffer->texture;
403} 408}