Files
neko/server/pkg/xorg/xorg.h
T
Ruben Vereecken dafda5bd5c XInput keyboard: dispatch via XTestFakeDeviceKeyEvent (#642)
GDK3 (used by Firefox/Camoufox) selects XI2 for the seat keyboard at
startup and ignores core-protocol KeyPress events. XTestFakeKeyEvent
produces core events, so typed characters from the Neko viewer silently
never reach Firefox.

Fix: discover the "Virtual core XTEST keyboard" XInput1 device at
startup, cache it, and dispatch key events via XTestFakeDeviceKeyEvent
which goes through the XI path. Falls back to the old core XTest path
if the device isn't found.

Requires -lXi (libxi-dev at build, libxi6 at runtime).
2026-08-04 15:44:18 +02:00

51 lines
1.5 KiB
C

#pragma once
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/XTest.h>
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/XInput.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
// for computing xrandr modelines at runtime
#include <libxcvt/libxcvt.h>
extern void goCreateScreenSize(int index, int width, int height, int mwidth, int mheight);
extern void goSetScreenRates(int index, int rate_index, short rate);
Display *getXDisplay(void);
int XDisplayOpen(char *input);
void XDisplayClose(void);
void XMove(int x, int y);
void XCursorPosition(int *x, int *y);
void XScroll(int deltaX, int deltaY);
void XButton(unsigned int button, int down);
typedef struct xkeyentry_t {
KeySym keysym;
KeyCode keycode;
struct xkeyentry_t *next;
} xkeyentry_t;
static void XKeyEntryAdd(KeySym keysym, KeyCode keycode);
static KeyCode XKeyEntryGet(KeySym keysym);
static KeyCode XkbKeysymToKeycode(Display *dpy, KeySym keysym);
void XKey(KeySym keysym, int down);
Status XSetScreenConfiguration(int width, int height, short rate);
void XGetScreenConfiguration(int *width, int *height, short *rate);
void XGetScreenConfigurations();
void XCreateScreenMode(int width, int height, short rate);
XRRModeInfo *XCreateScreenModeInfo(int hdisplay, int vdisplay, short vrefresh);
void XSetKeyboardModifier(unsigned char mod, int on);
unsigned char XGetKeyboardModifiers();
XFixesCursorImage *XGetCursorImage(void);
char *XGetScreenshot(int *w, int *h);