Skip to content

Fix touch input and home-title overlap on Windows - #57

Open
Turetsky wants to merge 2 commits into
ImAxel0:developmentfrom
Turetsky:fix/touch-press-and-hold-delay
Open

Fix touch input and home-title overlap on Windows#57
Turetsky wants to merge 2 commits into
ImAxel0:developmentfrom
Turetsky:fix/touch-press-and-hold-delay

Conversation

@Turetsky

@Turetsky Turetsky commented May 7, 2026

Copy link
Copy Markdown

Bundles two small Windows-side fixes I hit while using the app on a touchscreen laptop with a non-standard display size.

1. Touch input requires multiple taps

On Windows touchscreens, every UI button currently requires 3–4 taps before it registers — mouse is fine. The cause is that SDL2/ImGui only consumes synthesized mouse events, and Windows' press-and-hold gesture detector adds ~500 ms latency and drops button-down/up events while it evaluates whether the tap might be a long-press.

The fix subclasses the window proc and responds to WM_TABLET_QUERYSYSTEMGESTURESTATUS with the standard touch-disable flags. Same approach Krita / Inkscape use. Tested on a Windows 11 touchscreen — single-tap now works, mouse behavior unchanged. Uses explicit SetWindowLongPtrW / CallWindowProcW (not the unsuffixed variants) to keep the window's Unicode flag intact — using the auto-routed Vanara wrappers initially produced a Win32 ANSI/Unicode mismatch that mangled the title bar.

2. Home title gets covered by the logo on non-default display sizes

The "OPENTHESIA" title on the home window was placed at a fixed DisplaySize.Y / 10 while the logo image was positioned independently relative to the screen center. On display sizes other than the original target — e.g. a 2880×1800 laptop screen — the two collide and the logo covers most of the title text. The title now positions itself just above the logo with a margin.

Tested on a 3K laptop: maximized works great. In restored-down windowed mode there's not enough vertical room for the title above the logo, so the title just hides (rather than getting forced into an overlapping spot) — a more permanent fix would also dynamically scale the logo, but that's a bigger change to the original layout intent.

@Turetsky
Turetsky force-pushed the fix/touch-press-and-hold-delay branch from 400265f to b9e0f33 Compare May 7, 2026 04:12
The window proc is now subclassed to handle WM_TABLET_QUERYSYSTEMGESTURESTATUS
and disable press-and-hold gesture detection. Without this, Windows holds back
each touch tap ~500ms (and often drops events entirely) while it decides
whether the tap might be a long-press. Combined with ImGui's immediate-mode
input model, the dropped events meant users had to tap UI buttons 3-4 times
before they registered. Mouse input was unaffected because mouse events skip
the gesture-detection path.
@Turetsky
Turetsky force-pushed the fix/touch-press-and-hold-delay branch from b9e0f33 to 0ff209e Compare May 7, 2026 05:08
The home title ("OPENTHESIA") was positioned at a fixed Y of DisplaySize.Y / 10
while the logo was placed independently relative to the screen center. On
display sizes other than the original target the two would overlap and the
logo would cover most of the title text. The title now positions itself
just above the logo with a margin, and skips drawing entirely when the
window is too small for it to fit above the logo.
@Turetsky Turetsky changed the title Fix unresponsive touch input on Windows touchscreens Fix touch input and home-title overlap on Windows May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant