summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-09-25 11:15:20 +0000
committerAlyssa Ross <hi@alyssa.is>2023-09-25 11:15:20 +0000
commitc4d483799ed893449534d0b5a548e8b33b80b8b4 (patch)
treef9ca1db8c50d34ac70583c4672bf23687ff446ed
parent66f0f584b7b1508fab40cd21f6aafefee80e5c49 (diff)
downloadspectrum-c4d483799ed893449534d0b5a548e8b33b80b8b4.tar
spectrum-c4d483799ed893449534d0b5a548e8b33b80b8b4.tar.gz
spectrum-c4d483799ed893449534d0b5a548e8b33b80b8b4.tar.bz2
spectrum-c4d483799ed893449534d0b5a548e8b33b80b8b4.tar.lz
spectrum-c4d483799ed893449534d0b5a548e8b33b80b8b4.tar.xz
spectrum-c4d483799ed893449534d0b5a548e8b33b80b8b4.tar.zst
spectrum-c4d483799ed893449534d0b5a548e8b33b80b8b4.zip
release/checks/wayland: use foot
This is a more realistic test case, and it's more robust too, since we
can look for a specific app ID rather than using a size-based
heuristic.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
-rw-r--r--release/checks/wayland/default.nix2
-rw-r--r--release/checks/wayland/surface-notify/module.c21
2 files changed, 11 insertions, 12 deletions
diff --git a/release/checks/wayland/default.nix b/release/checks/wayland/default.nix
index 8872f05..65ff29b 100644
--- a/release/checks/wayland/default.nix
+++ b/release/checks/wayland/default.nix
@@ -5,7 +5,7 @@ import ../../../lib/eval-config.nix ({ config, ... }:
 
 let
   inherit (import ../../../host/rootfs { inherit config; }) appvm;
-  run = import ../../../vm/app/hello-wayland.nix { inherit config; };
+  run = import ../../../vm/app/foot.nix { inherit config; };
   surface-notify = import ./surface-notify { inherit config; };
 in
 
diff --git a/release/checks/wayland/surface-notify/module.c b/release/checks/wayland/surface-notify/module.c
index c49ea99..bfd177d 100644
--- a/release/checks/wayland/surface-notify/module.c
+++ b/release/checks/wayland/surface-notify/module.c
@@ -2,25 +2,24 @@
 // SPDX-FileCopyrightText: 2023 Alyssa Ross <hi@alyssa.is>
 
 // A Weston module that sends a notification into a fifo when a
-// hello-wayland window appears.
+// window with a specific app ID appears.
 
 #include <fcntl.h>
 #include <unistd.h>
+#include <string.h>
 
-#include <libweston/libweston.h>
+#include <libweston/desktop.h>
+
+static const char APP_ID[] = "foot";
 
 static void on_commit(struct wl_listener *, struct weston_surface *surface)
 {
+	struct weston_desktop_surface *desktop_surface;
 	int fd;
-	int32_t width, height;
-
-	// Use the size of the surface as a heuristic for identifying
-	// hello-wayland.  If we had security contexts[1], we could be
-	// more precise about this.
-	//
-	// [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/68
-	weston_surface_get_content_size(surface, &width, &height);
-	if (!surface->output || width != 128 || height != 128)
+
+	if (!(desktop_surface = weston_surface_get_desktop_surface(surface)))
+		return;
+	if (strcmp(weston_desktop_surface_get_app_id(desktop_surface), APP_ID))
 		return;
 
 	if ((fd = open("/run/surface-notify", O_WRONLY)) == -1) {