AtlatestRepositorysigil-ui
1
;;; Run in an owned compositor that offers xdg-decoration server mode.2
(import (sigil test) (sigil process) (sigil fs) (sigil string)3
(sigil ui wayland) (sigil ui raster))4
(define trace (or (getenv "SIGIL_UI_TEST_CLIENT_TRACE")5
(error "Decoration checks require an owned client trace")))6
(test "server decorations negotiate before the first buffer and retain the chosen mode"7
(let ((surface (open-wayland-surface title: "Server decoration check" server-decorations?: #t)))8
(dynamic-wind (lambda () #f)9
(lambda ()10
(assert-equal 'server-side (wayland-decoration-mode surface))11
(wayland-present! surface12
(make-canvas (wayland-surface-device-width surface) (wayland-surface-device-height surface)))13
(wayland-dispatch surface 20)14
(assert-equal 'server-side (wayland-decoration-mode surface)))15
(lambda () (wayland-surface-close! surface)))))16
(test "ordinary opens preserve the default and never bind the decoration manager"17
(let* ((before (string-count (read-file-string trace) "\"zxdg_decoration_manager_v1\", 1, new id"))18
(surface (open-wayland-surface title: "Default decoration check")))19
(dynamic-wind (lambda () #f)20
(lambda ()21
(assert-false (wayland-decoration-mode surface))22
(assert-equal before23
(string-count (read-file-string trace) "\"zxdg_decoration_manager_v1\", 1, new id")))24
(lambda () (wayland-surface-close! surface)))))25
(test "a compositor without xdg-decoration remains a supported fallback"26
(let ((previous (getenv "SIGIL_UI_WAYLAND_IGNORE")) (surface #f))27
(dynamic-wind28
(lambda () (setenv! "SIGIL_UI_WAYLAND_IGNORE" "zxdg_decoration_manager_v1"))29
(lambda ()30
(set! surface (open-wayland-surface title: "No decoration protocol" server-decorations?: #t))31
(assert-false (wayland-decoration-mode surface))32
(wayland-present! surface33
(make-canvas (wayland-surface-device-width surface) (wayland-surface-device-height surface))))34
(lambda ()35
(when surface (wayland-surface-close! surface))36
(setenv! "SIGIL_UI_WAYLAND_IGNORE" previous)))))37
(test "decoration preferences reject nonboolean and fullscreen requests"38
(assert-error (open-wayland-surface server-decorations?: 'server))39
(assert-error (open-wayland-surface role: 'fullscreen server-decorations?: #t)))