imgui_ctru: Send proper mouse events for touchscreen

This is the canonical way of handling touch events. Some controls (e.g. TabBar) depends on knowing the input is a touchscreen to work properly.
This commit is contained in:
alvinhochun 2025-04-01 17:56:27 +08:00 committed by GitHub
parent e0f2ed69c4
commit 5037297b7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -85,7 +85,7 @@ void updateTouch (ImGuiIO &io_)
if (!(hidKeysHeld () & KEY_TOUCH))
{
// set mouse cursor off-screen
io_.AddMousePosEvent (-10.0f, -10.0f);
io_.AddMousePosEvent (-FLT_MAX, -FLT_MAX);
io_.AddMouseButtonEvent (0, false);
return;
}
@ -228,6 +228,9 @@ bool imgui::ctru::init ()
// disable mouse cursor
io.MouseDrawCursor = false;
// we only support touchscreen as mouse source
io.AddMouseSourceEvent (ImGuiMouseSource_TouchScreen);
auto &platformIO = ImGui::GetPlatformIO ();
// clipboard callbacks