From 851799e791ceb72a1f9c36f20fe44108c90ce8df Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 2 May 2014 10:14:07 -0400 Subject: [PATCH] shell: Make margin double-buffered state that's applied on commit --- desktop-shell/shell.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 591d8321..dd0b2f98 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -172,7 +172,8 @@ struct shell_surface { struct { int left, right, top, bottom; - } margin; + } margin, next_margin; + bool has_next_margin; int focus_count; }; @@ -2126,10 +2127,11 @@ static void set_margin(struct shell_surface *shsurf, int32_t left, int32_t right, int32_t top, int32_t bottom) { - shsurf->margin.left = left; - shsurf->margin.right = right; - shsurf->margin.top = top; - shsurf->margin.bottom = bottom; + shsurf->next_margin.left = left; + shsurf->next_margin.right = right; + shsurf->next_margin.top = top; + shsurf->next_margin.bottom = bottom; + shsurf->has_next_margin = true; } static void @@ -5120,6 +5122,11 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy) if (es->width == 0) return; + if (shsurf->has_next_margin) { + shsurf->margin = shsurf->next_margin; + shsurf->has_next_margin = false; + } + if (shsurf->state_changed) { set_surface_type(shsurf); type_changed = 1;