#!/bin/sh
# Generate the client glue for the protocols this demo binds beyond the core:
# xdg-shell (stable) and xdg-output-unstable-v1 (the logical-geometry side
# channel). Invoked by dub's preGenerateCommands (see ./dub.sdl); idempotent so
# incremental builds stay fast. The dev shell provides wayland-scanner +
# wayland-protocols; the protocol XML is located via pkg-config, never hardcoded.
set -eu
cd ""
pdir=""
gen() { # gen <xml-path> <basename>
[ -f "$2-client-protocol.h" ] || wayland-scanner client-header "$1" "$2-client-protocol.h"
[ -f "$2-protocol.c" ] || wayland-scanner private-code "$1" "$2-protocol.c"
}
gen "$pdir/stable/xdg-shell/xdg-shell.xml" xdg-shell
gen "$pdir/unstable/xdg-output/xdg-output-unstable-v1.xml" xdg-output-unstable-v1