diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-31 18:21:49 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-01 23:14:58 +1000 |
commit | a2c1cb9072b990de9181bffeb69e43f9b3030804 (patch) | |
tree | 1588d8d58a84c04fbc02f0e5701394a6ebf47de2 | |
parent | c9e3a313b440c171ae0bf78eb5b85bf63c3121b9 (diff) |
Fix mpv damage issue when unfullscreening into floating
-rw-r--r-- | include/sway/tree/view.h | 3 | ||||
-rw-r--r-- | sway/tree/view.c | 13 |
2 files changed, 12 insertions, 4 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 7362df5c..3df38e2d 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -51,6 +51,9 @@ struct sway_view { double x, y; int width, height; + double saved_x, saved_y; + int saved_width, saved_height; + // The size the view would want to be if it weren't tiled. // Used when changing a view from tiled to floating. int natural_width, natural_height; diff --git a/sway/tree/view.c b/sway/tree/view.c index 2eaa5d49..3117ded6 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -274,6 +274,10 @@ void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen) { view_set_fullscreen(workspace->sway_workspace->fullscreen, false); } workspace->sway_workspace->fullscreen = view; + view->saved_x = view->x; + view->saved_y = view->y; + view->saved_width = view->width; + view->saved_height = view->height; view->swayc->saved_x = view->swayc->x; view->swayc->saved_y = view->swayc->y; view->swayc->saved_width = view->swayc->width; @@ -296,11 +300,12 @@ void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen) { } } else { workspace->sway_workspace->fullscreen = NULL; - view->swayc->width = view->swayc->saved_width; - view->swayc->height = view->swayc->saved_height; if (container_is_floating(view->swayc)) { - view->swayc->x = view->swayc->saved_x; - view->swayc->y = view->swayc->saved_y; + view_configure(view, view->saved_x, view->saved_y, + view->saved_width, view->saved_height); + } else { + view->swayc->width = view->swayc->saved_width; + view->swayc->height = view->swayc->saved_height; view_autoconfigure(view); } } |