Skip to content

Commit

Permalink
Add wzSeemsLikeNonTouchPlatform()
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Oct 9, 2023
1 parent c576f32 commit 50c48a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/framework/wzapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions lib/sdl/main_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down

0 comments on commit 50c48a4

Please sign in to comment.