|
@@ -4016,6 +4016,7 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
|
|
|
|
|
|
// All platforms use Ctrl+Tab but Ctrl<>Super are swapped on Mac...
|
|
|
// FIXME: Because this value is stored, it annoyingly interfere with toggling io.ConfigMacOSXBehaviors updating this..
|
|
|
+ ConfigNavWindowingWithGamepad = true;
|
|
|
ConfigNavWindowingKeyNext = IO.ConfigMacOSXBehaviors ? (ImGuiMod_Super | ImGuiKey_Tab) : (ImGuiMod_Ctrl | ImGuiKey_Tab);
|
|
|
ConfigNavWindowingKeyPrev = IO.ConfigMacOSXBehaviors ? (ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey_Tab) : (ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab);
|
|
|
NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL;
|
|
@@ -13799,19 +13800,22 @@ static void ImGui::NavUpdateWindowing()
|
|
|
}
|
|
|
|
|
|
// Gamepad update
|
|
|
- g.NavWindowingTimer += io.DeltaTime;
|
|
|
if (g.NavWindowingTarget && g.NavInputSource == ImGuiInputSource_Gamepad)
|
|
|
{
|
|
|
- // Highlight only appears after a brief time holding the button, so that a fast tap on ImGuiKey_NavGamepadMenu (to toggle NavLayer) doesn't add visual noise
|
|
|
- // However inputs are accepted immediately, so you press ImGuiKey_NavGamepadMenu + L1/R1 fast.
|
|
|
- g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05f));
|
|
|
-
|
|
|
- // Select window to focus
|
|
|
- const int focus_change_dir = (int)IsKeyPressed(ImGuiKey_GamepadL1) - (int)IsKeyPressed(ImGuiKey_GamepadR1);
|
|
|
- if (focus_change_dir != 0 && !just_started_windowing_from_null_focus)
|
|
|
+ if (g.ConfigNavWindowingWithGamepad)
|
|
|
{
|
|
|
- NavUpdateWindowingTarget(focus_change_dir);
|
|
|
- g.NavWindowingHighlightAlpha = 1.0f;
|
|
|
+ // Highlight only appears after a brief time holding the button, so that a fast tap on ImGuiKey_NavGamepadMenu (to toggle NavLayer) doesn't add visual noise
|
|
|
+ // However inputs are accepted immediately, so you press ImGuiKey_NavGamepadMenu + L1/R1 fast.
|
|
|
+ g.NavWindowingTimer += io.DeltaTime;
|
|
|
+ g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05f));
|
|
|
+
|
|
|
+ // Select window to focus
|
|
|
+ const int focus_change_dir = (int)IsKeyPressed(ImGuiKey_GamepadL1) - (int)IsKeyPressed(ImGuiKey_GamepadR1);
|
|
|
+ if (focus_change_dir != 0 && !just_started_windowing_from_null_focus)
|
|
|
+ {
|
|
|
+ NavUpdateWindowingTarget(focus_change_dir);
|
|
|
+ g.NavWindowingHighlightAlpha = 1.0f;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Single press toggles NavLayer, long press with L/R apply actual focus on release (until then the window was merely rendered top-most)
|
|
@@ -13820,7 +13824,7 @@ static void ImGui::NavUpdateWindowing()
|
|
|
g.NavWindowingToggleLayer &= (g.NavWindowingHighlightAlpha < 1.0f); // Once button was held long enough we don't consider it a tap-to-toggle-layer press anymore.
|
|
|
if (g.NavWindowingToggleLayer && g.NavWindow)
|
|
|
apply_toggle_layer = true;
|
|
|
- else if (!g.NavWindowingToggleLayer)
|
|
|
+ else if (!g.NavWindowingToggleLayer && g.ConfigNavWindowingWithGamepad)
|
|
|
apply_focus_window = g.NavWindowingTarget;
|
|
|
g.NavWindowingTarget = NULL;
|
|
|
}
|
|
@@ -13832,6 +13836,7 @@ static void ImGui::NavUpdateWindowing()
|
|
|
// Visuals only appears after a brief time after pressing TAB the first time, so that a fast CTRL+TAB doesn't add visual noise
|
|
|
ImGuiKeyChord shared_mods = ((g.ConfigNavWindowingKeyNext ? g.ConfigNavWindowingKeyNext : ImGuiMod_Mask_) & (g.ConfigNavWindowingKeyPrev ? g.ConfigNavWindowingKeyPrev : ImGuiMod_Mask_)) & ImGuiMod_Mask_;
|
|
|
IM_ASSERT(shared_mods != 0); // Next/Prev shortcut currently needs a shared modifier to "hold", otherwise Prev actions would keep cycling between two windows.
|
|
|
+ g.NavWindowingTimer += io.DeltaTime;
|
|
|
g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05f)); // 1.0f
|
|
|
if ((keyboard_next_window || keyboard_prev_window) && !just_started_windowing_from_null_focus)
|
|
|
NavUpdateWindowingTarget(keyboard_next_window ? -1 : +1);
|