Plan cursor visibility in app core
This commit is contained in:
@@ -27,6 +27,14 @@ void invoke_picked_path_if_selected(
|
||||
: action == pp::app::VirtualKeyboardAction::hide_keyboard;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool should_dispatch_cursor_visibility(bool visible) noexcept
|
||||
{
|
||||
const auto action = pp::app::plan_cursor_visibility(visible);
|
||||
return visible
|
||||
? action == pp::app::CursorVisibilityAction::show_cursor
|
||||
: action == pp::app::CursorVisibilityAction::hide_cursor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
@@ -120,6 +128,9 @@ void App::resize(float w, float h)
|
||||
|
||||
void App::show_cursor()
|
||||
{
|
||||
if (!should_dispatch_cursor_visibility(true))
|
||||
return;
|
||||
|
||||
#ifdef _WIN32
|
||||
win32_show_cursor(true);
|
||||
#elif __OSX__
|
||||
@@ -129,6 +140,9 @@ void App::show_cursor()
|
||||
|
||||
void App::hide_cursor()
|
||||
{
|
||||
if (!should_dispatch_cursor_visibility(false))
|
||||
return;
|
||||
|
||||
#ifdef _WIN32
|
||||
win32_show_cursor(false);
|
||||
#elif __OSX__
|
||||
|
||||
Reference in New Issue
Block a user