mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 05:00:08 +02:00
An ungrabbed keyboard reached both sides at once: gamescope, which in VR reads every input device itself (the SteamOS build's InputStealer), typed into its focused app, and ft-screens typed into the desktop. Space in the desktop paused Spotify on the dashboard, including every space frame-voice dictated. And while the SteamVR dashboard was open, the desktop got no keys at all. Typing now follows the last click. ft-screens sees clicks on its own screens; the pointer helper reports the panel under the dot on each mouse press, so a click on any other panel sends typing to Steam. While typing goes to the desktop and the screens are showing, ft-screens tells the relay every second, and the relay grabs pass-through keyboards. A grab waits until no key is down, and the relay lets go if ft-screens stops reporting. Controller clicks on other panels aren't visible to overlay apps, so they don't move typing (noted in the README). A program that reads every keyboard for a hotkey loses a grabbed one. Repeating the keys on another input device doesn't work, since gamescope reads that too, so with SHARE_KEYS=1 the relay sends them to @frametop_keys as datagrams with the device name. It's off by default: any local process that binds that name first would get every key typed into the desktop. The docs now say gamescope reads keyboards and the headset's buttons itself; they said SteamVR passed keys on to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
1.8 KiB
C
53 lines
1.8 KiB
C
// The OpenVR side of ft-screens (vr.cpp), called from the wlroots compositor (compositor.c).
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct ft_dmabuf {
|
|
int width, height;
|
|
uint32_t format; // DRM_FORMAT_*
|
|
uint64_t modifier; // DRM_FORMAT_MOD_*
|
|
int n_planes;
|
|
uint32_t offset[4], stride[4];
|
|
int fd[4];
|
|
};
|
|
|
|
enum ft_event_type { FT_MOTION, FT_BUTTON, FT_SCROLL, FT_LEAVE, FT_QUIT };
|
|
|
|
struct ft_event {
|
|
enum ft_event_type type;
|
|
int screen;
|
|
double x, y; // FT_MOTION: buffer pixels from the top left
|
|
uint32_t button; // FT_BUTTON: linux BTN_*
|
|
bool pressed;
|
|
double dx, dy; // FT_SCROLL: notches (positive dy: scroll down)
|
|
};
|
|
|
|
bool ft_vr_init(void);
|
|
void ft_vr_shutdown(void);
|
|
// Modifiers SteamVR can import for a DRM format. Returns the count (at most max).
|
|
int ft_vr_modifiers(uint32_t format, uint64_t *out, int max);
|
|
// The screens are showing (by the visibility mode; not counting a wrist-pinned screen).
|
|
bool ft_vr_screens_shown(void);
|
|
// A panel for screen `index`, width in metres, placed in a row in front of the head.
|
|
void ft_vr_screen_create(int index, double metres, int count);
|
|
void ft_vr_screen_destroy(int index);
|
|
// Show a client buffer (identified by `key`) on the screen's panel. False if SteamVR
|
|
// can't import it.
|
|
bool ft_vr_screen_present(int index, const void *key, const struct ft_dmabuf *buf);
|
|
// A buffer is going away: drop its import.
|
|
void ft_vr_forget(const void *key);
|
|
// Poll panel input and SteamVR events.
|
|
void ft_vr_poll(void (*handle)(const struct ft_event *, void *), void *data);
|
|
// A command from the control socket (@ft_screens); writes the reply (see vr.cpp).
|
|
void ft_vr_command(const char *command, char *reply, int reply_size);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|