[client] X11: test grabbed input routing
Some checks are pending
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Waiting to run
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Waiting to run
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Waiting to run
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Waiting to run
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Waiting to run
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Waiting to run
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Waiting to run
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Waiting to run
build / module (push) Waiting to run
build / host-linux (push) Waiting to run
build / host-windows-cross (push) Waiting to run
build / host-windows-native (push) Waiting to run
build / idd (push) Waiting to run
build / obs (clang) (push) Waiting to run
build / obs (gcc) (push) Waiting to run
build / docs (push) Waiting to run

Keep raw and cooked event selection inside the tested X11 policy.

Exercise grab transitions and held-key normalization directly.
This commit is contained in:
Geoffrey McRae
2026-08-10 17:56:23 +10:00
parent 15e0cbbcc4
commit 4afb0254d1
6 changed files with 258 additions and 87 deletions

View File

@@ -23,6 +23,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdatomic.h>
#include <stdint.h>
#include "../input.h"
@@ -32,14 +33,23 @@ typedef struct X11Input
const LG_DSInputSink * sink;
void * opaque;
uint32_t buttons;
_Atomic(bool) pointerGrabbed;
_Atomic(bool) keyboardGrabbed;
bool entered;
bool focused;
}
X11Input;
#define X11_INPUT_KEYMAP_SIZE 32
void x11InputInit(X11Input * input, const LG_DSInputSink * sink,
void * opaque);
void x11InputSetPointerGrabbed(X11Input * input, bool grabbed);
bool x11InputIsPointerGrabbed(const X11Input * input);
void x11InputSetKeyboardGrabbed(X11Input * input, bool grabbed);
bool x11InputIsKeyboardGrabbed(const X11Input * input);
bool x11InputFocus(X11Input * input, bool focused,
const uint32_t * keys, size_t count);
bool x11InputPointerEnter(X11Input * input, bool mainWindow,
@@ -51,11 +61,15 @@ void x11InputPointerButton(X11Input * input, unsigned int button,
bool pressed, bool raw);
void x11InputRelativeMotion(X11Input * input,
double x, double y, double rawX, double rawY);
void x11InputKeyboardKey(X11Input * input, unsigned int keycode,
int minKeycode, bool pressed, bool raw, bool inputActive,
const char * text);
bool x11InputKeyboardKey(X11Input * input, unsigned int keycode,
int minKeycode, bool pressed, bool raw);
void x11InputKeyboardText(X11Input * input, const char * text);
void x11InputKeyboardState(X11Input * input,
bool ctrl, bool shift, bool alt, bool super,
bool numLock, bool capsLock, bool scrollLock);
size_t x11InputHeldKeys(
const char keymap[X11_INPUT_KEYMAP_SIZE],
int minKeycode, int maxKeycode,
uint32_t * keys, size_t capacity);
#endif