Fix touch input and home-title overlap on Windows - #57
Open
Turetsky wants to merge 2 commits into
Open
Conversation
Turetsky
force-pushed
the
fix/touch-press-and-hold-delay
branch
from
May 7, 2026 04:12
400265f to
b9e0f33
Compare
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
force-pushed
the
fix/touch-press-and-hold-delay
branch
from
May 7, 2026 05:08
b9e0f33 to
0ff209e
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_QUERYSYSTEMGESTURESTATUSwith the standard touch-disable flags. Same approach Krita / Inkscape use. Tested on a Windows 11 touchscreen — single-tap now works, mouse behavior unchanged. Uses explicitSetWindowLongPtrW/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 / 10while 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.