@ -8169,7 +8169,7 @@ static void ImGui::NavUpdate()
g . IO . NavVisible = ( g . IO . NavActive & & g . NavId ! = 0 & & ! g . NavDisableHighlight ) | | ( g . NavWindowingTarget ! = NULL ) ;
// Process NavCancel input (to close a popup, get back to parent, clear focus)
if ( IsNavInput Pressed ( ImGuiNavInput_Cancel , ImGuiInputReadMode_Pressed ) )
if ( IsNavInput Test ( ImGuiNavInput_Cancel , ImGuiInputReadMode_Pressed ) )
{
if ( g . ActiveId ! = 0 )
{
@ -8213,14 +8213,14 @@ static void ImGui::NavUpdate()
if ( g . NavId ! = 0 & & ! g . NavDisableHighlight & & ! g . NavWindowingTarget & & g . NavWindow & & ! ( g . NavWindow - > Flags & ImGuiWindowFlags_NoNavInputs ) )
{
bool activate_down = IsNavInputDown ( ImGuiNavInput_Activate ) ;
bool activate_pressed = activate_down & & IsNavInput Pressed ( ImGuiNavInput_Activate , ImGuiInputReadMode_Pressed ) ;
bool activate_pressed = activate_down & & IsNavInput Test ( ImGuiNavInput_Activate , ImGuiInputReadMode_Pressed ) ;
if ( g . ActiveId = = 0 & & activate_pressed )
g . NavActivateId = g . NavId ;
if ( ( g . ActiveId = = 0 | | g . ActiveId = = g . NavId ) & & activate_down )
g . NavActivateDownId = g . NavId ;
if ( ( g . ActiveId = = 0 | | g . ActiveId = = g . NavId ) & & activate_pressed )
g . NavActivatePressedId = g . NavId ;
if ( ( g . ActiveId = = 0 | | g . ActiveId = = g . NavId ) & & IsNavInput Pressed ( ImGuiNavInput_Input , ImGuiInputReadMode_Pressed ) )
if ( ( g . ActiveId = = 0 | | g . ActiveId = = g . NavId ) & & IsNavInput Test ( ImGuiNavInput_Input , ImGuiInputReadMode_Pressed ) )
g . NavInputId = g . NavId ;
}
if ( g . NavWindow & & ( g . NavWindow - > Flags & ImGuiWindowFlags_NoNavInputs ) )
@ -8241,10 +8241,11 @@ static void ImGui::NavUpdate()
g . NavMoveRequestFlags = ImGuiNavMoveFlags_None ;
if ( g . NavWindow & & ! g . NavWindowingTarget & & ! ( g . NavWindow - > Flags & ImGuiWindowFlags_NoNavInputs ) )
{
if ( ! IsActiveIdUsingNavDir ( ImGuiDir_Left ) & & IsNavInputPressedAnyOfTwo ( ImGuiNavInput_DpadLeft , ImGuiNavInput_KeyLeft_ , ImGuiInputReadMode_Repeat ) ) { g . NavMoveDir = ImGuiDir_Left ; }
if ( ! IsActiveIdUsingNavDir ( ImGuiDir_Right ) & & IsNavInputPressedAnyOfTwo ( ImGuiNavInput_DpadRight , ImGuiNavInput_KeyRight_ , ImGuiInputReadMode_Repeat ) ) { g . NavMoveDir = ImGuiDir_Right ; }
if ( ! IsActiveIdUsingNavDir ( ImGuiDir_Up ) & & IsNavInputPressedAnyOfTwo ( ImGuiNavInput_DpadUp , ImGuiNavInput_KeyUp_ , ImGuiInputReadMode_Repeat ) ) { g . NavMoveDir = ImGuiDir_Up ; }
if ( ! IsActiveIdUsingNavDir ( ImGuiDir_Down ) & & IsNavInputPressedAnyOfTwo ( ImGuiNavInput_DpadDown , ImGuiNavInput_KeyDown_ , ImGuiInputReadMode_Repeat ) ) { g . NavMoveDir = ImGuiDir_Down ; }
const ImGuiInputReadMode read_mode = ImGuiInputReadMode_Repeat ;
if ( ! IsActiveIdUsingNavDir ( ImGuiDir_Left ) & & ( IsNavInputTest ( ImGuiNavInput_DpadLeft , read_mode ) | | IsNavInputTest ( ImGuiNavInput_KeyLeft_ , read_mode ) ) ) { g . NavMoveDir = ImGuiDir_Left ; }
if ( ! IsActiveIdUsingNavDir ( ImGuiDir_Right ) & & ( IsNavInputTest ( ImGuiNavInput_DpadRight , read_mode ) | | IsNavInputTest ( ImGuiNavInput_KeyRight_ , read_mode ) ) ) { g . NavMoveDir = ImGuiDir_Right ; }
if ( ! IsActiveIdUsingNavDir ( ImGuiDir_Up ) & & ( IsNavInputTest ( ImGuiNavInput_DpadUp , read_mode ) | | IsNavInputTest ( ImGuiNavInput_KeyUp_ , read_mode ) ) ) { g . NavMoveDir = ImGuiDir_Up ; }
if ( ! IsActiveIdUsingNavDir ( ImGuiDir_Down ) & & ( IsNavInputTest ( ImGuiNavInput_DpadDown , read_mode ) | | IsNavInputTest ( ImGuiNavInput_KeyDown_ , read_mode ) ) ) { g . NavMoveDir = ImGuiDir_Down ; }
}
g . NavMoveClipDir = g . NavMoveDir ;
}
@ -8539,7 +8540,7 @@ static void ImGui::NavUpdateWindowing()
}
// Start CTRL-TAB or Square+L/R window selection
bool start_windowing_with_gamepad = ! g . NavWindowingTarget & & IsNavInput Pressed ( ImGuiNavInput_Menu , ImGuiInputReadMode_Pressed ) ;
bool start_windowing_with_gamepad = ! g . NavWindowingTarget & & IsNavInput Test ( ImGuiNavInput_Menu , ImGuiInputReadMode_Pressed ) ;
bool start_windowing_with_keyboard = ! g . NavWindowingTarget & & g . IO . KeyCtrl & & IsKeyPressedMap ( ImGuiKey_Tab ) & & ( g . IO . ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard ) ;
if ( start_windowing_with_gamepad | | start_windowing_with_keyboard )
if ( ImGuiWindow * window = g . NavWindow ? g . NavWindow : FindWindowNavFocusable ( g . WindowsFocusOrder . Size - 1 , - INT_MAX , - 1 ) )
@ -8558,7 +8559,7 @@ static void ImGui::NavUpdateWindowing()
g . NavWindowingHighlightAlpha = ImMax ( g . NavWindowingHighlightAlpha , ImSaturate ( ( g . NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY ) / 0.05f ) ) ;
// Select window to focus
const int focus_change_dir = ( int ) IsNavInput Pressed ( ImGuiNavInput_FocusPrev , ImGuiInputReadMode_RepeatSlow ) - ( int ) IsNavInput Pressed ( ImGuiNavInput_FocusNext , ImGuiInputReadMode_RepeatSlow ) ;
const int focus_change_dir = ( int ) IsNavInput Test ( ImGuiNavInput_FocusPrev , ImGuiInputReadMode_RepeatSlow ) - ( int ) IsNavInput Test ( ImGuiNavInput_FocusNext , ImGuiInputReadMode_RepeatSlow ) ;
if ( focus_change_dir ! = 0 )
{
NavUpdateWindowingHighlightWindow ( focus_change_dir ) ;
@ -8590,9 +8591,9 @@ static void ImGui::NavUpdateWindowing()
// Keyboard: Press and Release ALT to toggle menu layer
// FIXME: We lack an explicit IO variable for "is the imgui window focused", so compare mouse validity to detect the common case of back-end clearing releases all keys on ALT-TAB
if ( IsNavInput Pressed ( ImGuiNavInput_KeyMenu_ , ImGuiInputReadMode_Pressed ) )
if ( IsNavInput Test ( ImGuiNavInput_KeyMenu_ , ImGuiInputReadMode_Pressed ) )
g . NavWindowingToggleLayer = true ;
if ( ( g . ActiveId = = 0 | | g . ActiveIdAllowOverlap ) & & g . NavWindowingToggleLayer & & IsNavInput Pressed ( ImGuiNavInput_KeyMenu_ , ImGuiInputReadMode_Released ) )
if ( ( g . ActiveId = = 0 | | g . ActiveIdAllowOverlap ) & & g . NavWindowingToggleLayer & & IsNavInput Test ( ImGuiNavInput_KeyMenu_ , ImGuiInputReadMode_Released ) )
if ( IsMousePosValid ( & g . IO . MousePos ) = = IsMousePosValid ( & g . IO . MousePosPrev ) )
apply_toggle_layer = true ;