diff options
author | Zandr Martin <zandrmartin@gmail.com> | 2016-07-31 21:45:27 -0500 |
---|---|---|
committer | Zandr Martin <zandrmartin@gmail.com> | 2016-07-31 21:45:27 -0500 |
commit | b18c169036ed41513971600983c0e812cd567be9 (patch) | |
tree | 9bd53e1ca6201e393a4c3d5e489542dfdc505ce5 /sway | |
parent | a947cb691933ee7e1df329c2cd7ca883ea71d036 (diff) |
cache floating container size when fullscreening
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c index 28dcc996..f0c9cc52 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -2501,6 +2501,30 @@ static struct cmd_results *cmd_fullscreen(int argc, char **argv) { swayc_t *workspace = swayc_parent_by_type(container, C_WORKSPACE); bool current = swayc_is_fullscreen(container); wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, !current); + + if (container->is_floating) { + if (current) { + // set dimensions back to what they were before we fullscreened this + container->x = container->cached_geometry.origin.x; + container->y = container->cached_geometry.origin.y; + container->width = container->cached_geometry.size.w; + container->height = container->cached_geometry.size.h; + } else { + // cache dimensions so we can reset them after we "unfullscreen" this + struct wlc_geometry geo = { + .origin = { + .x = container->x, + .y = container->y + }, + .size = { + .w = container->width, + .h = container->height + } + }; + container->cached_geometry = geo; + } + } + // Resize workspace if going from fullscreen -> notfullscreen // otherwise just resize container if (!current) { |