Fix macOS accent menu (#708)
* `SDL_StartTextInput` only when textfield is focused * [macOS] "Reveal in Finder" button for Home Directory * only enable for `USE_SDL`
This commit is contained in:
parent
75ff5409f4
commit
3c94cd3194
|
@ -44,6 +44,9 @@
|
|||
#include "lua/lua.h"
|
||||
#include "gui_chat.h"
|
||||
#include "imgui_driver.h"
|
||||
#if defined(USE_SDL)
|
||||
#include "sdl/sdl.h"
|
||||
#endif
|
||||
|
||||
static bool game_started;
|
||||
|
||||
|
@ -373,6 +376,17 @@ static void gui_newFrame()
|
|||
|
||||
if (showOnScreenKeyboard != nullptr)
|
||||
showOnScreenKeyboard(io.WantTextInput);
|
||||
|
||||
#if defined(USE_SDL)
|
||||
if (io.WantTextInput && !SDL_IsTextInputActive())
|
||||
{
|
||||
SDL_StartTextInput();
|
||||
}
|
||||
else if (!io.WantTextInput && SDL_IsTextInputActive())
|
||||
{
|
||||
SDL_StopTextInput();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void delayedKeysUp()
|
||||
|
@ -1359,6 +1373,15 @@ static void gui_display_settings()
|
|||
ImGui::SameLine(ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize("Change").x - ImGui::GetStyle().FramePadding.x);
|
||||
if (ImGui::Button("Change"))
|
||||
gui_state = GuiState::Onboarding;
|
||||
#endif
|
||||
#if defined(__APPLE__) && TARGET_OS_OSX
|
||||
ImGui::SameLine(ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize("Reveal in Finder").x - ImGui::GetStyle().FramePadding.x);
|
||||
if (ImGui::Button("Reveal in Finder"))
|
||||
{
|
||||
char temp[512];
|
||||
sprintf(temp, "open \"%s\"", get_writable_config_path("").c_str());
|
||||
system(temp);
|
||||
}
|
||||
#endif
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue