wayland: add helper functions wayl_win_csd_{titlebar,borders}_visible()

This commit is contained in:
Daniel Eklöf 2022-04-16 11:26:28 +02:00
parent 7a0e7c6c01
commit f9103d4381
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 36 additions and 20 deletions

View file

@ -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;
}
@ -1763,6 +1764,21 @@ wayl_win_set_urgent(struct wl_window *win)
#endif
}
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,