#ifndef DISPLAYMODE_INPUT_TAP_H #define DISPLAYMODE_INPUT_TAP_H /* The renderer's event tap: what it listens to, and nothing else. * * This header is the single place that fixes the event mask of the tap the * split renderer opens while a split is active. It is published as-is (see * /verify/ on the website) so that anyone can read the mask and compare it * with the one the running binary reports through the public * CGGetEventTapList API. The mask is the only thing this file decides: mouse * movement, mouse drags, mouse buttons and the scroll wheel. No keyboard * event type is in it, so no keystroke ever reaches the tap. What the * renderer does with the events it receives is not part of this file. * * Measured on the shipped binary (2026-09-17): mask 0xe4000fe, the keyboard * bits 0x1c00 (kCGEventKeyDown, kCGEventKeyUp, kCGEventFlagsChanged) absent. * test_taps.c keeps it that way. */ #include /* The mask, built from the event types by name so the intent is readable. */ static inline CGEventMask DMInputTapMask(void) { return CGEventMaskBit(kCGEventMouseMoved) | CGEventMaskBit(kCGEventLeftMouseDragged) | CGEventMaskBit(kCGEventRightMouseDragged) | CGEventMaskBit(kCGEventOtherMouseDragged) | CGEventMaskBit(kCGEventLeftMouseDown) | CGEventMaskBit(kCGEventLeftMouseUp) | CGEventMaskBit(kCGEventRightMouseDown) | CGEventMaskBit(kCGEventRightMouseUp) | CGEventMaskBit(kCGEventOtherMouseDown) | CGEventMaskBit(kCGEventOtherMouseUp) | CGEventMaskBit(kCGEventScrollWheel); } /* Opens the tap: session-wide, inserted at the head, active (the callback may * change the event), with the mask above. The caller owns the returned port * and enables it. NULL when the system refuses (no Accessibility consent). */ static inline CFMachPortRef DMInputTapCreate(CGEventTapCallBack callback, void *userInfo) { return CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, DMInputTapMask(), callback, userInfo); } #endif