XmSetWMProtocolHooks(3) on Linux
The text 51e6007ebc7d, as Debian 13 (Trixie), Debian 12 (Bookworm), Debian 11 (Bullseye), Debian 10 (Buster), Debian 9 (Stretch), Debian 8 (Jessie) shipped it.
A VendorShell convenience interface that allows preactions and postactions to be executed when a protocol message is received from the window manager "XmSetWMProtocolHooks" "VendorShell functions" "XmSetWMProtocolHooks" "protocols"