[client] displayserver: support external event sources

Allow display servers to dispatch a caller-owned event source on their
native event thread. This lets background input readers marshal events
to the thread that owns application and display-server state.

Poll X11 fairly when native events remain continuously available, and
use bounded polling if the external descriptor cannot be registered.
This commit is contained in:
Geoffrey McRae
2026-08-21 05:43:11 +10:00
parent 71733433ed
commit 8b38546049
5 changed files with 89 additions and 26 deletions

View File

@@ -103,6 +103,18 @@ LG_DSWaitFrameResult;
#define LG_POINTER_COUNT (LG_POINTER_NOT_ALLOWED + 1)
typedef void (*LG_DSEventCallback)(void * opaque);
typedef struct LG_DSEventSource
{
/* The callback must be nonblocking and tolerate spurious calls. The caller
* retains ownership of fd and opaque until display-server shutdown. */
int fd;
LG_DSEventCallback callback;
void * opaque;
}
LG_DSEventSource;
typedef struct LG_DSInitParams
{
const char * title;
@@ -122,6 +134,8 @@ typedef struct LG_DSInitParams
// x11 needs to know if this is in use so we can decide to setup for
// presentation times
bool jitRender;
LG_DSEventSource eventSource;
}
LG_DSInitParams;