|
@@ -1199,6 +1199,7 @@ static bool NavScoreItem(ImGuiNavItemData* result);
|
|
static void NavApplyItemToResult(ImGuiNavItemData* result);
|
|
static void NavApplyItemToResult(ImGuiNavItemData* result);
|
|
static void NavProcessItem();
|
|
static void NavProcessItem();
|
|
static void NavProcessItemForTabbingRequest(ImGuiID id, ImGuiItemFlags item_flags, ImGuiNavMoveFlags move_flags);
|
|
static void NavProcessItemForTabbingRequest(ImGuiID id, ImGuiItemFlags item_flags, ImGuiNavMoveFlags move_flags);
|
|
|
|
+static ImGuiInputSource NavCalcPreferredRefPosSource();
|
|
static ImVec2 NavCalcPreferredRefPos();
|
|
static ImVec2 NavCalcPreferredRefPos();
|
|
static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window);
|
|
static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window);
|
|
static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window);
|
|
static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window);
|
|
@@ -12177,14 +12178,14 @@ ImVec2 ImGui::FindBestWindowPosForPopup(ImGuiWindow* window)
|
|
const float scale = g.Style.MouseCursorScale;
|
|
const float scale = g.Style.MouseCursorScale;
|
|
const ImVec2 ref_pos = NavCalcPreferredRefPos();
|
|
const ImVec2 ref_pos = NavCalcPreferredRefPos();
|
|
|
|
|
|
- if (g.IO.MouseSource == ImGuiMouseSource_TouchScreen)
|
|
|
|
|
|
+ if (g.IO.MouseSource == ImGuiMouseSource_TouchScreen && NavCalcPreferredRefPosSource() == ImGuiInputSource_Mouse)
|
|
{
|
|
{
|
|
- ImVec2 tooltip_pos = g.IO.MousePos + TOOLTIP_DEFAULT_OFFSET_TOUCH * scale - (TOOLTIP_DEFAULT_PIVOT_TOUCH * window->Size);
|
|
|
|
|
|
+ ImVec2 tooltip_pos = ref_pos + TOOLTIP_DEFAULT_OFFSET_TOUCH * scale - (TOOLTIP_DEFAULT_PIVOT_TOUCH * window->Size);
|
|
if (r_outer.Contains(ImRect(tooltip_pos, tooltip_pos + window->Size)))
|
|
if (r_outer.Contains(ImRect(tooltip_pos, tooltip_pos + window->Size)))
|
|
return tooltip_pos;
|
|
return tooltip_pos;
|
|
}
|
|
}
|
|
|
|
|
|
- ImVec2 tooltip_pos = g.IO.MousePos + TOOLTIP_DEFAULT_OFFSET_MOUSE * scale;
|
|
|
|
|
|
+ ImVec2 tooltip_pos = ref_pos + TOOLTIP_DEFAULT_OFFSET_MOUSE * scale;
|
|
ImRect r_avoid;
|
|
ImRect r_avoid;
|
|
if (!g.NavDisableHighlight && g.NavDisableMouseHover && !g.IO.ConfigNavMoveSetMousePos)
|
|
if (!g.NavDisableHighlight && g.NavDisableMouseHover && !g.IO.ConfigNavMoveSetMousePos)
|
|
r_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 16, ref_pos.y + 8);
|
|
r_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 16, ref_pos.y + 8);
|
|
@@ -12779,7 +12780,7 @@ void ImGui::NavInitWindow(ImGuiWindow* window, bool force_reinit)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static ImVec2 ImGui::NavCalcPreferredRefPos()
|
|
|
|
|
|
+static ImGuiInputSource ImGui::NavCalcPreferredRefPosSource()
|
|
{
|
|
{
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiWindow* window = g.NavWindow;
|
|
ImGuiWindow* window = g.NavWindow;
|
|
@@ -12787,6 +12788,21 @@ static ImVec2 ImGui::NavCalcPreferredRefPos()
|
|
|
|
|
|
// Testing for !activated_shortcut here could in theory be removed if we decided that activating a remote shortcut altered one of the g.NavDisableXXX flag.
|
|
// Testing for !activated_shortcut here could in theory be removed if we decided that activating a remote shortcut altered one of the g.NavDisableXXX flag.
|
|
if ((g.NavDisableHighlight || !g.NavDisableMouseHover || !window) && !activated_shortcut)
|
|
if ((g.NavDisableHighlight || !g.NavDisableMouseHover || !window) && !activated_shortcut)
|
|
|
|
+ return ImGuiInputSource_Mouse;
|
|
|
|
+ else
|
|
|
|
+ return ImGuiInputSource_Keyboard; // or Nav in general
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static ImVec2 ImGui::NavCalcPreferredRefPos()
|
|
|
|
+{
|
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
|
+ ImGuiWindow* window = g.NavWindow;
|
|
|
|
+ ImGuiInputSource source = NavCalcPreferredRefPosSource();
|
|
|
|
+
|
|
|
|
+ const bool activated_shortcut = g.ActiveId != 0 && g.ActiveIdFromShortcut && g.ActiveId == g.LastItemData.ID;
|
|
|
|
+
|
|
|
|
+ // Testing for !activated_shortcut here could in theory be removed if we decided that activating a remote shortcut altered one of the g.NavDisableXXX flag.
|
|
|
|
+ if (source == ImGuiInputSource_Mouse)
|
|
{
|
|
{
|
|
// Mouse (we need a fallback in case the mouse becomes invalid after being used)
|
|
// Mouse (we need a fallback in case the mouse becomes invalid after being used)
|
|
// The +1.0f offset when stored by OpenPopupEx() allows reopening this or another popup (same or another mouse button) while not moving the mouse, it is pretty standard.
|
|
// The +1.0f offset when stored by OpenPopupEx() allows reopening this or another popup (same or another mouse button) while not moving the mouse, it is pretty standard.
|