mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Viewport: Disable extra viewports from hosting other windows. (#1542)
This commit is contained in:
parent
d8719cf59b
commit
9ea16e344a
@ -392,7 +392,6 @@ int main(int, char**)
|
|||||||
VkCommandPool command_pool = wd->Frames[wd->FrameIndex].CommandPool;
|
VkCommandPool command_pool = wd->Frames[wd->FrameIndex].CommandPool;
|
||||||
VkCommandBuffer command_buffer = wd->Frames[wd->FrameIndex].CommandBuffer;
|
VkCommandBuffer command_buffer = wd->Frames[wd->FrameIndex].CommandBuffer;
|
||||||
|
|
||||||
VkResult err;
|
|
||||||
err = vkResetCommandPool(g_Device, command_pool, 0);
|
err = vkResetCommandPool(g_Device, command_pool, 0);
|
||||||
check_vk_result(err);
|
check_vk_result(err);
|
||||||
VkCommandBufferBeginInfo begin_info = {};
|
VkCommandBufferBeginInfo begin_info = {};
|
||||||
|
@ -3252,7 +3252,7 @@ static void ImGui::UpdateMovingWindowDropViewport(ImGuiWindow* window)
|
|||||||
ImRect mouse_viewport_rect = g.MouseViewport->GetRect();
|
ImRect mouse_viewport_rect = g.MouseViewport->GetRect();
|
||||||
ImVec2 window_pos_in_mouse_viewport = ConvertOsDesktopPosToViewportPos(ConvertViewportPosToOsDesktopPos(window->Pos, window->Viewport), g.MouseViewport);
|
ImVec2 window_pos_in_mouse_viewport = ConvertOsDesktopPosToViewportPos(ConvertViewportPosToOsDesktopPos(window->Pos, window->Viewport), g.MouseViewport);
|
||||||
ImRect window_rect_in_mouse_viewport = ImRect(window_pos_in_mouse_viewport, window_pos_in_mouse_viewport + window->Size);
|
ImRect window_rect_in_mouse_viewport = ImRect(window_pos_in_mouse_viewport, window_pos_in_mouse_viewport + window->Size);
|
||||||
if (mouse_viewport_rect.Contains(window_rect_in_mouse_viewport))
|
if ((g.MouseViewport->Flags & ImGuiViewportFlags_HostOtherWindows) && mouse_viewport_rect.Contains(window_rect_in_mouse_viewport))
|
||||||
{
|
{
|
||||||
// Drop on an existing viewport
|
// Drop on an existing viewport
|
||||||
ImGuiViewport* old_viewport = window->Viewport;
|
ImGuiViewport* old_viewport = window->Viewport;
|
||||||
@ -3388,7 +3388,7 @@ static void ImGui::UpdateViewports()
|
|||||||
ImVec2 main_viewport_os_desktop_pos = ImVec2(0.0f, 0.0f);
|
ImVec2 main_viewport_os_desktop_pos = ImVec2(0.0f, 0.0f);
|
||||||
if ((g.IO.ConfigFlags & ImGuiConfigFlags_EnableViewports))
|
if ((g.IO.ConfigFlags & ImGuiConfigFlags_EnableViewports))
|
||||||
main_viewport_os_desktop_pos = g.IO.PlatformInterface.GetWindowPos(main_viewport);
|
main_viewport_os_desktop_pos = g.IO.PlatformInterface.GetWindowPos(main_viewport);
|
||||||
Viewport(IMGUI_VIEWPORT_DEFAULT_ID, ImGuiViewportFlags_MainViewport, main_viewport_os_desktop_pos, g.IO.DisplaySize);
|
Viewport(IMGUI_VIEWPORT_DEFAULT_ID, ImGuiViewportFlags_MainViewport | ImGuiViewportFlags_HostOtherWindows, main_viewport_os_desktop_pos, g.IO.DisplaySize);
|
||||||
|
|
||||||
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_EnableViewports))
|
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_EnableViewports))
|
||||||
{
|
{
|
||||||
|
@ -517,9 +517,10 @@ struct ImDrawDataBuilder
|
|||||||
enum ImGuiViewportFlags_
|
enum ImGuiViewportFlags_
|
||||||
{
|
{
|
||||||
ImGuiViewportFlags_MainViewport = 1 << 0,
|
ImGuiViewportFlags_MainViewport = 1 << 0,
|
||||||
ImGuiViewportFlags_NoDecoration = 1 << 1, // Platform Window: Disable platform title bar, borders, etc.
|
ImGuiViewportFlags_HostOtherWindows = 1 << 1,
|
||||||
ImGuiViewportFlags_NoFocusOnAppearing = 1 << 2, // Platform Window: Don't take focus when created.
|
ImGuiViewportFlags_NoDecoration = 1 << 2, // Platform Window: Disable platform title bar, borders, etc.
|
||||||
ImGuiViewportFlags_NoInputs = 1 << 3 // Platform Window: Make mouse pass through so we can drag this window while peaking behind it.
|
ImGuiViewportFlags_NoFocusOnAppearing = 1 << 3, // Platform Window: Don't take focus when created.
|
||||||
|
ImGuiViewportFlags_NoInputs = 1 << 4 // Platform Window: Make mouse pass through so we can drag this window while peaking behind it.
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiViewport
|
struct ImGuiViewport
|
||||||
|
Loading…
Reference in New Issue
Block a user