mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 05:45:38 +00:00
Frontend: Clear focus after loading/saving state
This commit is contained in:
parent
4181b8c6b5
commit
83b67b3c4c
|
@ -180,8 +180,8 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
|
|||
{
|
||||
static constexpr unsigned int mapping[][2] = {{SDL_CONTROLLER_BUTTON_A, ImGuiNavInput_Activate},
|
||||
{SDL_CONTROLLER_BUTTON_B, ImGuiNavInput_Cancel},
|
||||
{SDL_CONTROLLER_BUTTON_X, ImGuiNavInput_Input},
|
||||
{SDL_CONTROLLER_BUTTON_Y, ImGuiNavInput_Menu},
|
||||
{SDL_CONTROLLER_BUTTON_Y, ImGuiNavInput_Input},
|
||||
// {SDL_CONTROLLER_BUTTON_X, ImGuiNavInput_Menu},
|
||||
{SDL_CONTROLLER_BUTTON_LEFTSHOULDER, ImGuiNavInput_FocusPrev},
|
||||
{SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, ImGuiNavInput_FocusNext},
|
||||
{SDL_CONTROLLER_BUTTON_DPAD_UP, ImGuiNavInput_DpadUp},
|
||||
|
|
|
@ -405,7 +405,7 @@ static void HandleSDLControllerAxisEventForController(const SDL_Event* ev, Digit
|
|||
{
|
||||
// Log_DevPrintf("axis %d %d", ev->caxis.axis, ev->caxis.value);
|
||||
|
||||
static constexpr int deadzone = 5000;
|
||||
static constexpr int deadzone = 8192;
|
||||
const bool negative = (ev->caxis.value < 0);
|
||||
const bool active = (std::abs(ev->caxis.value) >= deadzone);
|
||||
|
||||
|
@ -583,6 +583,11 @@ void SDLInterface::HandleSDLKeyEvent(const SDL_Event* event)
|
|||
}
|
||||
}
|
||||
|
||||
void SDLInterface::ClearImGuiFocus()
|
||||
{
|
||||
ImGui::SetWindowFocus(nullptr);
|
||||
}
|
||||
|
||||
void SDLInterface::Render()
|
||||
{
|
||||
DrawImGui();
|
||||
|
@ -1091,6 +1096,8 @@ void SDLInterface::DoStartDisc()
|
|||
AddOSDMessage(SmallString::FromFormat("Starting disc from '%s'...", path));
|
||||
if (!InitializeSystem(path, nullptr))
|
||||
return;
|
||||
|
||||
ClearImGuiFocus();
|
||||
}
|
||||
|
||||
void SDLInterface::DoStartBIOS()
|
||||
|
@ -1100,6 +1107,8 @@ void SDLInterface::DoStartBIOS()
|
|||
AddOSDMessage("Starting BIOS...");
|
||||
if (!InitializeSystem(nullptr, nullptr))
|
||||
return;
|
||||
|
||||
ClearImGuiFocus();
|
||||
}
|
||||
|
||||
void SDLInterface::DoLoadState(u32 index)
|
||||
|
@ -1112,12 +1121,14 @@ void SDLInterface::DoLoadState(u32 index)
|
|||
m_last_internal_frame_number = m_system->GetInternalFrameNumber();
|
||||
m_last_global_tick_counter = m_system->GetGlobalTickCounter();
|
||||
m_fps_timer.Reset();
|
||||
ClearImGuiFocus();
|
||||
}
|
||||
|
||||
void SDLInterface::DoSaveState(u32 index)
|
||||
{
|
||||
Assert(m_system);
|
||||
SaveState(GetSaveStateFilename(index));
|
||||
ClearImGuiFocus();
|
||||
}
|
||||
|
||||
void SDLInterface::Run()
|
||||
|
|
|
@ -75,6 +75,8 @@ private:
|
|||
|
||||
void HandleSDLEvent(const SDL_Event* event);
|
||||
void HandleSDLKeyEvent(const SDL_Event* event);
|
||||
void ClearImGuiFocus();
|
||||
|
||||
void Render();
|
||||
void RenderDisplay();
|
||||
void DrawMainMenuBar();
|
||||
|
|
Loading…
Reference in a new issue