aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/transaction.c
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/desktop/transaction.c
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/desktop/transaction.c')
-rw-r--r--sway/desktop/transaction.c17
1 files changed, 11 insertions, 6 deletions
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}