mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-04 01:40:21 -05:00
wayland: fix window size adjustment for CSDs placed outside main surface
* Do this both in XDG configure, and when the decoration manager switches between CSDs/SSDs at run-time. * Exclude CSD borders when we're maximized
This commit is contained in:
parent
6c20abf279
commit
b69c9b5f58
1 changed files with 18 additions and 10 deletions
28
wayland.c
28
wayland.c
|
|
@ -537,8 +537,12 @@ xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
|
||||||
* *inside* the main surface.
|
* *inside* the main surface.
|
||||||
*/
|
*/
|
||||||
#if FOOT_CSD_OUTSIDE
|
#if FOOT_CSD_OUTSIDE
|
||||||
width -= 2 * csd_border_size * win->term->scale;
|
if (!is_maximized) {
|
||||||
height -= (2 * csd_border_size + csd_title_size) * win->term->scale;
|
width -= 2 * csd_border_size;
|
||||||
|
height -= 2 * csd_border_size + csd_title_size;
|
||||||
|
} else {
|
||||||
|
height -= csd_title_size;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -630,17 +634,21 @@ xdg_toplevel_decoration_configure(void *data,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (win->is_configured) {
|
if (win->is_configured && win->use_csd == CSD_YES) {
|
||||||
#if FOOT_CSD_OUTSIDE
|
|
||||||
render_csd(win->term);
|
|
||||||
#else
|
|
||||||
/* TODO: we could increase the width/height to account for the
|
|
||||||
* CSDs. This would increase the window size, but keep the
|
|
||||||
* grid size fixed */
|
|
||||||
struct terminal *term = win->term;
|
struct terminal *term = win->term;
|
||||||
int scale = term->scale;
|
int scale = term->scale;
|
||||||
render_resize_force(term, term->width / scale, term->height / scale);
|
|
||||||
|
int width = term->width / scale;
|
||||||
|
int height = term->height / scale;
|
||||||
|
|
||||||
|
#if FOOT_CSD_OUTSIDE
|
||||||
|
if (!term->window->is_maximized) {
|
||||||
|
width -= 2 * csd_border_size;
|
||||||
|
height -= 2 * csd_border_size + csd_title_size;
|
||||||
|
} else
|
||||||
|
height -= csd_title_size;
|
||||||
#endif
|
#endif
|
||||||
|
render_resize_force(term, width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue