From 50c48a4a09d0ace2c0dab6b0ee5c2a025ef0fc65 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Sun, 8 Oct 2023 21:49:31 -0400 Subject: [PATCH] Add wzSeemsLikeNonTouchPlatform() --- lib/framework/wzapp.h | 1 + lib/sdl/main_sdl.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/framework/wzapp.h b/lib/framework/wzapp.h index e91eb40abec..b3dd1d07634 100644 --- a/lib/framework/wzapp.h +++ b/lib/framework/wzapp.h @@ -135,6 +135,7 @@ void wzDelay(unsigned int delay); //delay in ms void StartTextInput(void* pTextInputRequester); void StopTextInput(void* pTextInputResigner); bool isInTextInputMode(); +bool wzSeemsLikeNonTouchPlatform(); // NOTE: wzBackendAttemptOpenURL should *not* be called directly - instead, call openURLInBrowser() from urlhelpers.h bool wzBackendAttemptOpenURL(const char *url); diff --git a/lib/sdl/main_sdl.cpp b/lib/sdl/main_sdl.cpp index 486199b9951..53bc88a3131 100644 --- a/lib/sdl/main_sdl.cpp +++ b/lib/sdl/main_sdl.cpp @@ -307,6 +307,16 @@ bool isInTextInputMode() return result; } +bool wzHasTouchInputDevices() +{ + return SDL_GetNumTouchDevices() > 0; +} + +bool wzSeemsLikeNonTouchPlatform() +{ + return !wzHasTouchInputDevices() || (SDL_HasScreenKeyboardSupport() == SDL_FALSE); +} + /* Put a character into a text buffer overwriting any text under the cursor */ WzString wzGetSelection() {