Fix mpv damage issue when unfullscreening into floating

This commit is contained in:
Ryan Dwyer 2018-05-31 18:21:49 +10:00
parent c9e3a313b4
commit a2c1cb9072
2 changed files with 12 additions and 4 deletions

View file

@ -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;

View file

@ -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;
if (container_is_floating(view->swayc)) {
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;
if (container_is_floating(view->swayc)) {
view->swayc->x = view->swayc->saved_x;
view->swayc->y = view->swayc->saved_y;
view_autoconfigure(view);
}
}