mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-15 19:43:28 +01:00
Viewports: Fixed setting focus from platform decoration from accidentally closing modals (#6299, #6357)
+ Fixed double-assignment static analyzer warning. # Conflicts: # imgui.cpp
This commit is contained in:
parent
bba39762dc
commit
d2291df551
@ -128,7 +128,9 @@ Other changes:
|
||||
|
||||
Docking+Viewports Branch:
|
||||
|
||||
- Viewports: added void* ImGuiPlatformMonitor::PlatformHandle field (backend-dependant),
|
||||
- Viewports: Fixed platform-side focus (e.g. Alt+Tab) from leading to accidental
|
||||
closure of Modal windows. Regression from 1.89.5. (#6357, #6299)
|
||||
- Viewports: Added void* ImGuiPlatformMonitor::PlatformHandle field (backend-dependant),
|
||||
for usage by user code.
|
||||
- Backends: SDL2: Update monitor list when receiving a display event. (#6348)
|
||||
Note however that SDL2 currently doesn't have an event for a DPI/Scaling change,
|
||||
|
@ -13957,12 +13957,13 @@ static void ImGui::UpdateViewportsNewFrame()
|
||||
// FIXME: perhaps 'FocusTopMostWindowUnderOne()' can handle the 'focused_window->Window != NULL' case as well.
|
||||
if (!IsAnyMouseDown())
|
||||
{
|
||||
ImGuiFocusRequestFlags focus_request_flags = ImGuiFocusRequestFlags_UnlessBelowModal | ImGuiFocusRequestFlags_RestoreFocusedChild;
|
||||
if (focused_viewport->Window != NULL)
|
||||
FocusWindow(NavRestoreLastChildNavWindow(focused_viewport->Window));
|
||||
FocusWindow(focused_viewport->Window, focus_request_flags);
|
||||
else if (focused_viewport->LastFocusedHadNavWindow)
|
||||
FocusTopMostWindowUnderOne(NULL, NULL, focused_viewport, ImGuiFocusRequestFlags_None);
|
||||
FocusTopMostWindowUnderOne(NULL, NULL, focused_viewport, focus_request_flags); // Focus top most in viewport
|
||||
else
|
||||
FocusWindow(NULL);
|
||||
FocusWindow(NULL, focus_request_flags); // No window had focus last time viewport was focused
|
||||
}
|
||||
}
|
||||
if (focused_viewport)
|
||||
|
@ -1765,7 +1765,7 @@ struct ImGuiViewportP : public ImGuiViewport
|
||||
ImVec2 BuildWorkOffsetMin; // Work Area: Offset being built during current frame. Generally >= 0.0f.
|
||||
ImVec2 BuildWorkOffsetMax; // Work Area: Offset being built during current frame. Generally <= 0.0f.
|
||||
|
||||
ImGuiViewportP() { Window = NULL; Idx = -1; LastFrameActive = DrawListsLastFrame[0] = DrawListsLastFrame[1] = LastFocusedStampCount = -1; LastNameHash = 0; Alpha = LastAlpha = 1.0f; LastFocusedHadNavWindow = false; PlatformMonitor = -1; Window = NULL; DrawLists[0] = DrawLists[1] = NULL; LastPlatformPos = LastPlatformSize = LastRendererSize = ImVec2(FLT_MAX, FLT_MAX); }
|
||||
ImGuiViewportP() { Window = NULL; Idx = -1; LastFrameActive = DrawListsLastFrame[0] = DrawListsLastFrame[1] = LastFocusedStampCount = -1; LastNameHash = 0; Alpha = LastAlpha = 1.0f; LastFocusedHadNavWindow = false; PlatformMonitor = -1; DrawLists[0] = DrawLists[1] = NULL; LastPlatformPos = LastPlatformSize = LastRendererSize = ImVec2(FLT_MAX, FLT_MAX); }
|
||||
~ImGuiViewportP() { if (DrawLists[0]) IM_DELETE(DrawLists[0]); if (DrawLists[1]) IM_DELETE(DrawLists[1]); }
|
||||
void ClearRequestFlags() { PlatformRequestClose = PlatformRequestMove = PlatformRequestResize = false; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user