aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-02-26 19:59:11 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-02-26 19:59:11 +0000
commitddbfb3676cce56d289271f8287a4389daea562f3 (patch)
tree85d421114ef7452f69041d998d979c227555fd48 /render.c
parentwayland: 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.
Diffstat (limited to 'render.c')
-rw-r--r--render.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/render.c b/render.c
index a752dd8e..98ea90f6 100644
--- a/render.c
+++ b/render.c
@@ -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);