diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-02-26 19:59:11 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-02-26 19:59:11 +0000 |
| commit | ddbfb3676cce56d289271f8287a4389daea562f3 (patch) | |
| tree | 85d421114ef7452f69041d998d979c227555fd48 | |
| parent | wayland: once again switch to positioning CSDs outside the main surface (diff) | |
render: remember, and use, last unmaximized size
When the compositor wants us to decide the size (it sends a configure
event with width/height == 0), then use the last unmaximized size, if
there is one.
If there isn't one, use the size from the user configuration.
| -rw-r--r-- | render.c | 36 | ||||
| -rw-r--r-- | terminal.h | 2 |
2 files changed, 28 insertions, 10 deletions
@@ -1160,16 +1160,6 @@ maybe_resize(struct terminal *term, int width, int height, bool force) scale = 1; } - if (width == 0 && height == 0) { - width = term->conf->width; - height = term->conf->height; - -#if FOOT_CSD_OUTSIDE - width -= 2 * csd_border_size; - height -= 2 * csd_border_size + csd_title_size; -#endif - } - width *= scale; height *= scale; @@ -1182,6 +1172,27 @@ maybe_resize(struct terminal *term, int width, int height, bool force) const int csd_title = term->window->use_csd == CSD_YES ? csd_title_size * scale : 0; #endif + if (width == 0 && height == 0) { + /* + * The compositor is letting us choose the size + * + * If we have a "last" used size - use that. Otherwise, use + * the size from the user configuration. + */ + if (term->unmaximized_width != 0 && term->unmaximized_height != 0) { + width = term->unmaximized_width; + height = term->unmaximized_height; + } else { + width = term->conf->width * scale; + height = term->conf->height * scale; + +#if FOOT_CSD_OUTSIDE + width -= 2 * csd_border; + height -= 2 * csd_border + csd_title; +#endif + } + } + const int csd_x = 2 * csd_border; const int csd_y = 2 * csd_border + csd_title; @@ -1301,6 +1312,11 @@ maybe_resize(struct terminal *term, int width, int height, bool force) term->render.last_cursor.cell = NULL; damage_view: + if (!term->window->is_maximized) { + term->unmaximized_width = term->width; + term->unmaximized_height = term->height; + } + xdg_toplevel_set_min_size( term->window->xdg_toplevel, min_width / scale, min_height / scale); tll_free(term->normal.scroll_damage); @@ -248,6 +248,8 @@ struct terminal { int scale; int width; /* pixels */ int height; /* pixels */ + int unmaximized_width; /* last unmaximized size, pixels */ + int unmaximized_height; /* last unmaximized size, pixels */ struct { int left; int right; |
