mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05: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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue