mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-23 05:33:57 -04:00
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.
This commit is contained in:
parent
77b37fb288
commit
ddbfb3676c
2 changed files with 28 additions and 10 deletions
36
render.c
36
render.c
|
|
@ -1160,16 +1160,6 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
|
||||||
scale = 1;
|
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;
|
width *= scale;
|
||||||
height *= 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;
|
const int csd_title = term->window->use_csd == CSD_YES ? csd_title_size * scale : 0;
|
||||||
#endif
|
#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_x = 2 * csd_border;
|
||||||
const int csd_y = 2 * csd_border + csd_title;
|
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;
|
term->render.last_cursor.cell = NULL;
|
||||||
|
|
||||||
damage_view:
|
damage_view:
|
||||||
|
if (!term->window->is_maximized) {
|
||||||
|
term->unmaximized_width = term->width;
|
||||||
|
term->unmaximized_height = term->height;
|
||||||
|
}
|
||||||
|
|
||||||
xdg_toplevel_set_min_size(
|
xdg_toplevel_set_min_size(
|
||||||
term->window->xdg_toplevel, min_width / scale, min_height / scale);
|
term->window->xdg_toplevel, min_width / scale, min_height / scale);
|
||||||
tll_free(term->normal.scroll_damage);
|
tll_free(term->normal.scroll_damage);
|
||||||
|
|
|
||||||
|
|
@ -248,6 +248,8 @@ struct terminal {
|
||||||
int scale;
|
int scale;
|
||||||
int width; /* pixels */
|
int width; /* pixels */
|
||||||
int height; /* pixels */
|
int height; /* pixels */
|
||||||
|
int unmaximized_width; /* last unmaximized size, pixels */
|
||||||
|
int unmaximized_height; /* last unmaximized size, pixels */
|
||||||
struct {
|
struct {
|
||||||
int left;
|
int left;
|
||||||
int right;
|
int right;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue