aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-08-02 08:20:39 +0100
committerGitHub <noreply@github.com>2018-08-02 08:20:39 +0100
commitfe39129b96794032c396411f96f2eb016050a545 (patch)
tree8f0085c1829ab97a920acd9d5116732779177631 /sway/tree
parent9564c73c0ddca9d7b45f0476fcaee8bd878d8345 (diff)
parent47bf4ed0cbf104d09bba7f39acbf2ceb84c2c694 (diff)
Merge pull request #2396 from RyanDwyer/fix-resize-wiggle
Correctly track saved surfaces during multiple transactions
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/view.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 02a33c10..051b93ce 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <wayland-server.h>
#include <wlr/render/wlr_renderer.h>
+#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_output_layout.h>
#include "config.h"
#ifdef HAVE_XWAYLAND
@@ -1093,3 +1094,22 @@ void view_set_urgent(struct sway_view *view, bool enable) {
bool view_is_urgent(struct sway_view *view) {
return view->urgent.tv_sec || view->urgent.tv_nsec;
}
+
+void view_remove_saved_buffer(struct sway_view *view) {
+ if (!sway_assert(view->saved_buffer, "Expected a saved buffer")) {
+ return;
+ }
+ wlr_buffer_unref(view->saved_buffer);
+ view->saved_buffer = NULL;
+}
+
+void view_save_buffer(struct sway_view *view) {
+ if (!sway_assert(!view->saved_buffer, "Didn't expect saved buffer")) {
+ view_remove_saved_buffer(view);
+ }
+ if (view->surface && wlr_surface_has_buffer(view->surface)) {
+ view->saved_buffer = wlr_buffer_ref(view->surface->buffer);
+ view->saved_buffer_width = view->surface->current.width;
+ view->saved_buffer_height = view->surface->current.height;
+ }
+}