mirror of
https://github.com/ocornut/imgui.git
synced 2026-06-03 10:34:52 +00:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp
This commit is contained in:
13
imgui.cpp
13
imgui.cpp
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.8
|
||||
// dear imgui, v1.92.9 WIP
|
||||
// (main code and documentation)
|
||||
|
||||
// Help:
|
||||
@@ -5522,14 +5522,15 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
|
||||
|
||||
// Click on empty space to focus window and start moving
|
||||
// (after we're done with all our widgets, so e.g. clicking on docking tab-bar which have set HoveredId already and not get us here!)
|
||||
if (g.IO.MouseClicked[0])
|
||||
if (IsMouseClicked(0, ImGuiInputFlags_None, ImGuiKeyOwner_NoOwner))
|
||||
{
|
||||
// Handle the edge case of a popup being closed while clicking in its empty space.
|
||||
// If we try to focus it, FocusWindow() > ClosePopupsOverWindow() will accidentally close any parent popups because they are not linked together any more.
|
||||
ImGuiWindow* hovered_root = hovered_window ? hovered_window->RootWindow : NULL;
|
||||
const bool is_closed_popup = hovered_root && (hovered_root->Flags & ImGuiWindowFlags_Popup) && !IsPopupOpen(hovered_root->PopupId, ImGuiPopupFlags_AnyPopupLevel);
|
||||
const bool is_queued_focus_request = g.NavMoveSubmitted && (g.NavMoveFlags & ImGuiNavMoveFlags_FocusApi);
|
||||
|
||||
if (hovered_window != NULL && !is_closed_popup)
|
||||
if (hovered_window != NULL && !is_closed_popup && !is_queued_focus_request)
|
||||
{
|
||||
StartMouseMovingWindow(hovered_window); //-V595
|
||||
|
||||
@@ -5560,7 +5561,7 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
|
||||
// With right mouse button we close popups without changing focus based on where the mouse is aimed
|
||||
// Instead, focus will be restored to the window under the bottom-most closed popup.
|
||||
// (The left mouse button path calls FocusWindow on the hovered window, which will lead NewFrame->ClosePopupsOverWindow to trigger)
|
||||
if (g.IO.MouseClicked[1] && g.HoveredId == 0)
|
||||
if (g.HoveredId == 0 && IsMouseClicked(1, ImGuiInputFlags_None, ImGuiKeyOwner_NoOwner))
|
||||
{
|
||||
// Find the top-most window between HoveredWindow and the top-most Modal Window.
|
||||
// This is where we can trim the popup stack.
|
||||
@@ -14509,13 +14510,13 @@ static void ImGui::NavUpdate()
|
||||
// FIXME-NAV: Now that keys are separated maybe we can get rid of NavInputSource?
|
||||
const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
|
||||
const ImGuiKey nav_gamepad_keys_to_change_source[] = { ImGuiKey_GamepadFaceRight, ImGuiKey_GamepadFaceLeft, ImGuiKey_GamepadFaceUp, ImGuiKey_GamepadFaceDown, ImGuiKey_GamepadDpadRight, ImGuiKey_GamepadDpadLeft, ImGuiKey_GamepadDpadUp, ImGuiKey_GamepadDpadDown };
|
||||
if (nav_gamepad_active)
|
||||
if (nav_gamepad_active && g.NavInputSource != ImGuiInputSource_Gamepad)
|
||||
for (ImGuiKey key : nav_gamepad_keys_to_change_source)
|
||||
if (IsKeyDown(key))
|
||||
g.NavInputSource = ImGuiInputSource_Gamepad;
|
||||
const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||
const ImGuiKey nav_keyboard_keys_to_change_source[] = { ImGuiKey_Space, ImGuiKey_Enter, ImGuiKey_Escape, ImGuiKey_RightArrow, ImGuiKey_LeftArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow };
|
||||
if (nav_keyboard_active)
|
||||
if (nav_keyboard_active && g.NavInputSource != ImGuiInputSource_Keyboard)
|
||||
for (ImGuiKey key : nav_keyboard_keys_to_change_source)
|
||||
if (IsKeyDown(key))
|
||||
g.NavInputSource = ImGuiInputSource_Keyboard;
|
||||
|
||||
Reference in New Issue
Block a user