Files
DeeJanuz--frametop/screens/keyboard.h
T
DeeJanuzandClaude Opus 5.5 c7c7c1f772 Screens: in games, pointing a controller at a panel turns its laser on
SteamVR's own floating windows take the laser while a controller points
at them in a game and give it back when it points away. Frametop's
panels didn't: with the controllers left to the game (outside_games, the
default, or dashboard), they couldn't be clicked without the dashboard.

ft-screens now sets MakeOverlaysInteractiveIfVisible on a screen or
floating window while a hand controller's laser pose meets it, its
controls, or its popups (UpdateAim; curved screens hit on their
cylinder), and clears it 0.3 s after the aim leaves a wider margin. A
drag or a held button keeps it on. The keyboard, one overlay, uses
ComputeOverlayIntersection and now follows the mode when a game starts
or ends while it's open. This replaces the reset button's own aim zone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:27:49 -06:00

36 lines
1.2 KiB
C++

// Frametop's keyboard (keyboard.cpp): a panel of keys that ft-screens shows for a text
// field on the desktop. Any laser or the 3D mouse types on it, as on the screens.
#pragma once
#include <openvr.h>
#include <cstdint>
namespace keyboard {
// What happened on the panel since the last Poll.
struct Event {
enum Type { Key, Closed } type;
uint32_t code; // Key: linux KEY_*
bool pressed; // Key: down or up
};
// Show the panel at `pose` (standing universe; its front faces +z), creating it the first
// time. False if SteamVR won't make the overlay.
bool Show(const vr::HmdMatrix34_t &pose);
void Hide();
bool Shown();
// Where it is now (it can be carried by its grab bar).
const vr::HmdMatrix34_t &Pose();
// A button came up on `device` somewhere else: stop carrying the panel if it was.
void EndDragBy(uint32_t device);
// Controllers' lasers work the panel with the dashboard closed, like the screens'.
void SetLasers(bool on);
// A laser (its pose, aiming along -z) points at the panel.
bool Aimed(const vr::HmdMatrix34_t &laser);
// The panel's input: key presses and releases, and Closed for its Close key.
void Poll(void (*handle)(const Event &, void *), void *data);
void Destroy();
} // namespace keyboard