aboutsummaryrefslogtreecommitdiff
path: root/wayland.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-04-16 09:26:28 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-04-16 09:42:25 +0000
commitf9103d4381cab9d6c10024ab8fbcdb35b14ef239 (patch)
treed3fe7852f3b1802ae48ec01434b6f03b84e95e67 /wayland.c
parentwayland: take (visible) border width into account on configure events (diff)
wayland: add helper functions wayl_win_csd_{titlebar,borders}_visible()
Diffstat (limited to 'wayland.c')
-rw-r--r--wayland.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/wayland.c b/wayland.c
index d77cd65d..020ff914 100644
--- a/wayland.c
+++ b/wayland.c
@@ -747,9 +747,10 @@ xdg_surface_configure(void *data, struct xdg_surface *xdg_surface,
csd_destroy(win);
if (enable_csd && new_width > 0 && new_height > 0) {
- new_height -= win->term->conf->csd.title_height;
+ if (wayl_win_csd_titlebar_visible(win))
+ new_height -= win->term->conf->csd.title_height;
- if (!win->is_maximized) {
+ if (wayl_win_csd_borders_visible(win)) {
new_height -= 2 * win->term->conf->csd.border_width_visible;
new_width -= 2 * win->term->conf->csd.border_width_visible;
}
@@ -1764,6 +1765,21 @@ wayl_win_set_urgent(struct wl_window *win)
}
bool
+wayl_win_csd_titlebar_visible(const struct wl_window *win)
+{
+ return win->csd_mode == CSD_YES &&
+ !win->is_fullscreen;
+}
+
+bool
+wayl_win_csd_borders_visible(const struct wl_window *win)
+{
+ return win->csd_mode == CSD_YES &&
+ !win->is_fullscreen &&
+ !win->is_maximized;
+}
+
+bool
wayl_win_subsurface_new_with_custom_parent(
struct wl_window *win, struct wl_surface *parent,
struct wl_surf_subsurf *surf)