diff options
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r-- | sway/desktop/transaction.c | 17 |
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 | ||
395 | struct wlr_texture *transaction_get_texture(struct sway_view *view) { | 398 | struct 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 | } |