@ -10138,12 +10138,8 @@ float ImGui::GetNavInputAmount(ImGuiNavInput n, ImGuiNavReadMode mode)
return io . NavInputs [ n ] ;
return io . NavInputs [ n ] ;
const float t = io . NavInputsDownDuration [ n ] ;
const float t = io . NavInputsDownDuration [ n ] ;
if ( t < 0.0f & & mode = = ImGuiNavReadMode_Released ) // Return 1.0f when just released, no repeat, ignore analog input.
return ( io . NavInputsDownDurationPrev [ n ] > = 0.0f ? 1.0f : 0.0f ) ;
if ( t < 0.0f )
if ( t < 0.0f )
return 0.0f ;
return 0.0f ;
if ( mode = = ImGuiNavReadMode_Pressed ) // Return 1.0f when just pressed, no repeat, ignore analog input.
return ( t = = 0.0f ) ? 1.0f : 0.0f ;
if ( mode = = ImGuiNavReadMode_Repeat )
if ( mode = = ImGuiNavReadMode_Repeat )
return ( float ) CalcTypematicRepeatAmount ( t - io . DeltaTime , t , io . KeyRepeatDelay * 0.72f , io . KeyRepeatRate * 0.80f ) ;
return ( float ) CalcTypematicRepeatAmount ( t - io . DeltaTime , t , io . KeyRepeatDelay * 0.72f , io . KeyRepeatRate * 0.80f ) ;
if ( mode = = ImGuiNavReadMode_RepeatSlow )
if ( mode = = ImGuiNavReadMode_RepeatSlow )
@ -10271,8 +10267,8 @@ static void ImGui::NavUpdate()
{
{
bool activate_down = IsNavInputDown ( ImGuiNavInput_Activate ) ;
bool activate_down = IsNavInputDown ( ImGuiNavInput_Activate ) ;
bool input_down = IsNavInputDown ( ImGuiNavInput_Input ) ;
bool input_down = IsNavInputDown ( ImGuiNavInput_Input ) ;
bool activate_pressed = activate_down & & IsNavInputTest ( ImGuiNavInput_Activate , ImGuiNavReadMode_Pressed ) ;
bool activate_pressed = activate_down & & IsNavInputPressed ( ImGuiNavInput_Activate ) ;
bool input_pressed = input_down & & IsNavInputTest ( ImGuiNavInput_Input , ImGuiNavReadMode_Pressed ) ;
bool input_pressed = input_down & & IsNavInputPressed ( ImGuiNavInput_Input ) ;
if ( g . ActiveId = = 0 & & activate_pressed )
if ( g . ActiveId = = 0 & & activate_pressed )
{
{
g . NavActivateId = g . NavId ;
g . NavActivateId = g . NavId ;
@ -10612,7 +10608,7 @@ void ImGui::NavMoveRequestApplyResult()
static void ImGui : : NavUpdateCancelRequest ( )
static void ImGui : : NavUpdateCancelRequest ( )
{
{
ImGuiContext & g = * GImGui ;
ImGuiContext & g = * GImGui ;
if ( ! IsNavInputTest ( ImGuiNavInput_Cancel , ImGuiNavReadMode_Pressed ) )
if ( ! IsNavInputPressed ( ImGuiNavInput_Cancel ) )
return ;
return ;
IMGUI_DEBUG_LOG_NAV ( " [nav] ImGuiNavInput_Cancel \n " ) ;
IMGUI_DEBUG_LOG_NAV ( " [nav] ImGuiNavInput_Cancel \n " ) ;
@ -10864,12 +10860,12 @@ static void ImGui::NavUpdateWindowing()
}
}
// Start CTRL+Tab or Square+L/R window selection
// Start CTRL+Tab or Square+L/R window selection
const bool start_windowing_with_gamepad = allow_windowing & & ! g . NavWindowingTarget & & IsNavInputTest ( ImGuiNavInput_Menu , ImGuiNavReadMode_Pressed ) ;
const bool start_windowing_with_gamepad = allow_windowing & & ! g . NavWindowingTarget & & IsNavInputPressed ( ImGuiNavInput_Menu ) ;
const bool start_windowing_with_keyboard = allow_windowing & & ! g . NavWindowingTarget & & io . KeyCtrl & & IsKeyPressed ( ImGuiKey_Tab ) ;
const bool start_windowing_with_keyboard = allow_windowing & & ! g . NavWindowingTarget & & io . KeyCtrl & & IsKeyPressed ( ImGuiKey_Tab ) ;
if ( start_windowing_with_gamepad | | start_windowing_with_keyboard )
if ( start_windowing_with_gamepad | | start_windowing_with_keyboard )
if ( ImGuiWindow * window = g . NavWindow ? g . NavWindow : FindWindowNavFocusable ( g . WindowsFocusOrder . Size - 1 , - INT_MAX , - 1 ) )
if ( ImGuiWindow * window = g . NavWindow ? g . NavWindow : FindWindowNavFocusable ( g . WindowsFocusOrder . Size - 1 , - INT_MAX , - 1 ) )
{
{
g . NavWindowingTarget = g . NavWindowingTargetAnim = window ;
g . NavWindowingTarget = g . NavWindowingTargetAnim = window - > RootWindow ;
g . NavWindowingTimer = g . NavWindowingHighlightAlpha = 0.0f ;
g . NavWindowingTimer = g . NavWindowingHighlightAlpha = 0.0f ;
g . NavWindowingAccumDeltaPos = g . NavWindowingAccumDeltaSize = ImVec2 ( 0.0f , 0.0f ) ;
g . NavWindowingAccumDeltaPos = g . NavWindowingAccumDeltaSize = ImVec2 ( 0.0f , 0.0f ) ;
g . NavWindowingToggleLayer = start_windowing_with_gamepad ? true : false ; // Gamepad starts toggling layer
g . NavWindowingToggleLayer = start_windowing_with_gamepad ? true : false ; // Gamepad starts toggling layer