aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-02-28 17:42:10 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-02-28 17:42:10 +0000
commitb69c9b5f58ce74831490ae2cd2377ed0e9a55cce (patch)
tree4d7c431ad81c6491d340df527a6da31bb5f139e1
parentwayland: warn when compositor doesn't implement the decoration manager interface (diff)
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
-rw-r--r--wayland.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/wayland.c b/wayland.c
index 21a69ac3..979c3bd7 100644
--- a/wayland.c
+++ b/wayland.c
@@ -537,8 +537,12 @@ xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
* *inside* the main surface.
*/
#if FOOT_CSD_OUTSIDE
- width -= 2 * csd_border_size * win->term->scale;
- height -= (2 * csd_border_size + csd_title_size) * win->term->scale;
+ if (!is_maximized) {
+ width -= 2 * csd_border_size;
+ height -= 2 * csd_border_size + csd_title_size;
+ } else {
+ height -= csd_title_size;
+ }
#endif
}
@@ -630,17 +634,21 @@ xdg_toplevel_decoration_configure(void *data,
break;
}
- if (win->is_configured) {
-#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 */
+ if (win->is_configured && win->use_csd == CSD_YES) {
struct terminal *term = win->term;
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
+ render_resize_force(term, width, height);
}
}