mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Viewport: Fixed a viewport bug which led some popups to merge in underlying host viewport when they should be z-over their parent viewport.
This commit is contained in:
		| @@ -287,7 +287,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i | |||||||
|  - viewport: with platform decoration enabled, platform may force constraint (e.g. minimum size) |  - viewport: with platform decoration enabled, platform may force constraint (e.g. minimum size) | ||||||
|  - viewport: use getfocus/setfocus api to synchronize imgui<>platform focus better (e.g imgui-side ctrl-tab can focus os window, OS initial setup and alt-tab can focus imgui window etc.) |  - viewport: use getfocus/setfocus api to synchronize imgui<>platform focus better (e.g imgui-side ctrl-tab can focus os window, OS initial setup and alt-tab can focus imgui window etc.) | ||||||
|  - viewport: store per-viewport/monitor DPI in .ini file so an application reload or main window changing DPI on reload can be properly patched for. |  - viewport: store per-viewport/monitor DPI in .ini file so an application reload or main window changing DPI on reload can be properly patched for. | ||||||
|  - viewport: implicit Debug window can hog a zombie viewport (harmless, noisy?) > could at least clear out the reference on a per session basis? |  - viewport: implicit/fallback Debug window can hog a zombie viewport (harmless, noisy?) > could at least clear out the reference on a per session basis? | ||||||
|  - viewport: need to clarify how to use GetMousePos() from a user point of view. |  - viewport: need to clarify how to use GetMousePos() from a user point of view. | ||||||
|  - platform: glfw: no support for ImGuiBackendFlags_HasMouseHoveredViewport.  |  - platform: glfw: no support for ImGuiBackendFlags_HasMouseHoveredViewport.  | ||||||
|  - platform: sdl: no support for ImGuiBackendFlags_HasMouseHoveredViewport. maybe we could use SDL_GetMouseFocus() / SDL_WINDOW_MOUSE_FOCUS if imgui could fallback on its heuristic when NoInputs is set |  - platform: sdl: no support for ImGuiBackendFlags_HasMouseHoveredViewport. maybe we could use SDL_GetMouseFocus() / SDL_WINDOW_MOUSE_FOCUS if imgui could fallback on its heuristic when NoInputs is set | ||||||
|   | |||||||
| @@ -7487,10 +7487,6 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window) | |||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // Merge into host viewport |  | ||||||
|     bool try_to_merge_into_host_viewport = false; |  | ||||||
|     if (window->ViewportOwned && g.ActiveId == 0) |  | ||||||
|         try_to_merge_into_host_viewport = true; |  | ||||||
|     window->ViewportOwned = false; |     window->ViewportOwned = false; | ||||||
|  |  | ||||||
|     // Appearing popups reset their viewport so they can inherit again |     // Appearing popups reset their viewport so they can inherit again | ||||||
| @@ -7541,6 +7537,9 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window) | |||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
|  |         // Merge into host viewport? | ||||||
|  |         // We cannot test window->ViewportOwned as it set lower in the function. | ||||||
|  |         bool try_to_merge_into_host_viewport = (window->Viewport && window == window->Viewport->Window && g.ActiveId == 0); | ||||||
|         if (try_to_merge_into_host_viewport) |         if (try_to_merge_into_host_viewport) | ||||||
|             UpdateTryMergeWindowIntoHostViewport(window, g.Viewports[0]); |             UpdateTryMergeWindowIntoHostViewport(window, g.Viewports[0]); | ||||||
|     } |     } | ||||||
| @@ -7594,7 +7593,7 @@ void ImGui::UpdatePlatformWindows() | |||||||
|     { |     { | ||||||
|         ImGuiViewportP* viewport = g.Viewports[i]; |         ImGuiViewportP* viewport = g.Viewports[i]; | ||||||
|  |  | ||||||
|         // Destroy platform window if the viewport hasn't been submitted or if it is hosting a hidden window (the implicit Debug window will be registered its viewport then be disabled) |         // Destroy platform window if the viewport hasn't been submitted or if it is hosting a hidden window (the implicit/fallback Debug window will be registered its viewport then be disabled) | ||||||
|         bool destroy_platform_window = false; |         bool destroy_platform_window = false; | ||||||
|         destroy_platform_window |= (viewport->LastFrameActive < g.FrameCount - 1); |         destroy_platform_window |= (viewport->LastFrameActive < g.FrameCount - 1); | ||||||
|         destroy_platform_window |= (viewport->Window && !IsWindowActiveAndVisible(viewport->Window)); |         destroy_platform_window |= (viewport->Window && !IsWindowActiveAndVisible(viewport->Window)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user