mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Viewport: Misc renaming.
This commit is contained in:
parent
01f940dc9a
commit
36cbe1e521
24
imgui.cpp
24
imgui.cpp
@ -7187,7 +7187,7 @@ static bool ImGui::GetWindowAlwaysWantOwnViewport(ImGuiWindow* window)
|
||||
static bool ImGui::UpdateTryMergeWindowIntoHostViewport(ImGuiWindow* window, ImGuiViewportP* viewport)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (!(viewport->Flags & ImGuiViewportFlags_CanHostOtherWindows) || window->Viewport == viewport || viewport->PlatformIsMinimized)
|
||||
if (!(viewport->Flags & ImGuiViewportFlags_CanHostOtherWindows) || window->Viewport == viewport || viewport->PlatformWindowMinimized)
|
||||
return false;
|
||||
if (!viewport->GetRect().Contains(window->Rect()))
|
||||
return false;
|
||||
@ -7242,7 +7242,7 @@ static ImGuiViewportP* FindViewportHoveredFromPlatformWindowStack(const ImVec2 m
|
||||
for (int n = 0; n < g.Viewports.Size; n++)
|
||||
{
|
||||
ImGuiViewportP* viewport = g.Viewports[n];
|
||||
if (!(viewport->Flags & ImGuiViewportFlags_NoInputs) && !viewport->PlatformIsMinimized && viewport->GetRect().Contains(mouse_platform_pos))
|
||||
if (!(viewport->Flags & ImGuiViewportFlags_NoInputs) && !viewport->PlatformWindowMinimized && viewport->GetRect().Contains(mouse_platform_pos))
|
||||
if (best_candidate == NULL || best_candidate->LastFrontMostStampCount < viewport->LastFrontMostStampCount)
|
||||
best_candidate = viewport;
|
||||
}
|
||||
@ -7294,12 +7294,12 @@ static void ImGui::UpdateViewports()
|
||||
|
||||
if ((g.ConfigFlagsForFrame & ImGuiConfigFlags_ViewportsEnable))
|
||||
{
|
||||
if (g.PlatformIO.Platform_GetWindowMinimized && (n == 0 || viewport->CreatedPlatformWindow))
|
||||
viewport->PlatformIsMinimized = g.PlatformIO.Platform_GetWindowMinimized(viewport);
|
||||
if (g.PlatformIO.Platform_GetWindowMinimized && (n == 0 || viewport->PlatformWindowCreated))
|
||||
viewport->PlatformWindowMinimized = g.PlatformIO.Platform_GetWindowMinimized(viewport);
|
||||
|
||||
// Apply Position and Size (from Platform Window to ImGui) if requested.
|
||||
// We do it early in the frame instead of waiting for UpdatePlatformWindows() to avoid a frame of lag when moving/resizing using OS facilities.
|
||||
if (!viewport->PlatformIsMinimized)
|
||||
if (!viewport->PlatformWindowMinimized)
|
||||
{
|
||||
if (viewport->PlatformRequestMove)
|
||||
viewport->Pos = viewport->LastPlatformPos = g.PlatformIO.Platform_GetWindowPos(viewport);
|
||||
@ -7387,14 +7387,14 @@ static void ImGui::UpdateViewports()
|
||||
const bool is_mouse_dragging_with_an_expected_destination = g.DragDropActive;
|
||||
if (is_mouse_dragging_with_an_expected_destination && viewport_hovered == NULL)
|
||||
viewport_hovered = g.MouseLastHoveredViewport;
|
||||
if (is_mouse_dragging_with_an_expected_destination || g.ActiveId == 0 || !ImGui::IsAnyMouseDown())
|
||||
if (is_mouse_dragging_with_an_expected_destination || g.ActiveId == 0 || !IsAnyMouseDown())
|
||||
if (viewport_hovered != NULL && viewport_hovered != g.MouseViewport && !(viewport_hovered->Flags & ImGuiViewportFlags_NoInputs))
|
||||
g.MouseViewport = viewport_hovered;
|
||||
|
||||
IM_ASSERT(g.MouseViewport != NULL);
|
||||
}
|
||||
|
||||
// FIXME: We should ideally refactor the system to call this everyframe (we currently don't)
|
||||
// FIXME: We should ideally refactor the system to call this every frame (we currently don't)
|
||||
ImGuiViewportP* ImGui::AddUpdateViewport(ImGuiWindow* window, ImGuiID id, const ImVec2& pos, const ImVec2& size, ImGuiViewportFlags flags)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@ -7601,7 +7601,7 @@ void ImGui::UpdatePlatformWindows()
|
||||
}
|
||||
|
||||
// Create window
|
||||
bool is_new_window = (viewport->CreatedPlatformWindow == false);
|
||||
bool is_new_window = (viewport->PlatformWindowCreated == false);
|
||||
if (is_new_window)
|
||||
{
|
||||
g.PlatformIO.Platform_CreateWindow(viewport);
|
||||
@ -7610,7 +7610,7 @@ void ImGui::UpdatePlatformWindows()
|
||||
viewport->LastNameHash = 0;
|
||||
viewport->LastPlatformPos = viewport->LastPlatformSize = ImVec2(FLT_MAX, FLT_MAX); // By clearing those we'll enforce a call to Platform_SetWindowPos/Platform_SetWindowSize before Platform_ShowWindow
|
||||
viewport->LastRendererSize = viewport->Size;
|
||||
viewport->CreatedPlatformWindow = true;
|
||||
viewport->PlatformWindowCreated = true;
|
||||
}
|
||||
|
||||
// Apply Position and Size (from ImGui to Platform/Renderer back-ends)
|
||||
@ -7757,7 +7757,7 @@ void ImGui::DestroyPlatformWindow(ImGuiViewportP* viewport)
|
||||
IM_ASSERT(viewport->PlatformUserData == NULL);
|
||||
viewport->PlatformHandle = NULL;
|
||||
viewport->RendererUserData = viewport->PlatformHandle = NULL;
|
||||
viewport->CreatedPlatformWindow = false;
|
||||
viewport->PlatformWindowCreated = false;
|
||||
}
|
||||
|
||||
void ImGui::DestroyPlatformWindows()
|
||||
@ -9897,7 +9897,7 @@ static void RenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewp
|
||||
|
||||
ImVec2 scale = bb.GetSize() / viewport->Size;
|
||||
ImVec2 off = bb.Min - viewport->Pos * scale;
|
||||
float alpha_mul = viewport->PlatformIsMinimized ? 0.30f : 1.00f;
|
||||
float alpha_mul = viewport->PlatformWindowMinimized ? 0.30f : 1.00f;
|
||||
window->DrawList->AddRectFilled(bb.Min, bb.Max, ImGui::GetColorU32(ImGuiCol_Border, alpha_mul * 0.40f));
|
||||
for (int i = 0; i != g.Windows.Size; i++)
|
||||
{
|
||||
@ -10104,7 +10104,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
ImGui::BulletText("Flags: 0x%04X =%s%s%s%s%s%s", viewport->Flags,
|
||||
(flags & ImGuiViewportFlags_CanHostOtherWindows) ? " CanHostOtherWindows" : "", (flags & ImGuiViewportFlags_NoDecoration) ? " NoDecoration" : "",
|
||||
(flags & ImGuiViewportFlags_NoFocusOnAppearing) ? " NoFocusOnAppearing" : "", (flags & ImGuiViewportFlags_NoInputs) ? " NoInputs" : "",
|
||||
(flags & ImGuiViewportFlags_NoRendererClear) ? " NoRendererClear" : "", viewport->PlatformIsMinimized ? ", PlatformIsMinimized" : "");
|
||||
(flags & ImGuiViewportFlags_NoRendererClear) ? " NoRendererClear" : "", viewport->PlatformWindowMinimized ? ", PlatformWindowMinimized" : "");
|
||||
for (int layer_i = 0; layer_i < IM_ARRAYSIZE(viewport->DrawDataBuilder.Layers); layer_i++)
|
||||
for (int draw_list_i = 0; draw_list_i < viewport->DrawDataBuilder.Layers[layer_i].Size; draw_list_i++)
|
||||
Funcs::NodeDrawList(NULL, viewport, viewport->DrawDataBuilder.Layers[layer_i][draw_list_i], "DrawList");
|
||||
|
@ -627,11 +627,11 @@ struct ImGuiViewportP : public ImGuiViewport
|
||||
int LastFrontMostStampCount; // Last stamp number from when a window hosted by this viewport was made front-most (by comparing this value between two viewport we have an implicit viewport z-order
|
||||
ImGuiID LastNameHash;
|
||||
ImVec2 LastPos;
|
||||
bool CreatedPlatformWindow;
|
||||
float Alpha; // Window opacity (when dragging dockable windows/viewports we make them transparent)
|
||||
float LastAlpha;
|
||||
int PlatformMonitor;
|
||||
bool PlatformIsMinimized;
|
||||
bool PlatformWindowCreated;
|
||||
bool PlatformWindowMinimized;
|
||||
ImGuiWindow* Window;
|
||||
ImDrawList* OverlayDrawList; // For convenience, a draw list we can render to that's always rendered last (we use it to draw software mouse cursor when io.MouseDrawCursor is set)
|
||||
ImDrawData DrawDataP;
|
||||
@ -640,7 +640,7 @@ struct ImGuiViewportP : public ImGuiViewport
|
||||
ImVec2 LastPlatformSize;
|
||||
ImVec2 LastRendererSize;
|
||||
|
||||
ImGuiViewportP() { Idx = -1; LastFrameActive = LastFrameOverlayDrawList = LastFrontMostStampCount = -1; LastNameHash = 0; CreatedPlatformWindow = false; Alpha = LastAlpha = 1.0f; PlatformMonitor = INT_MIN; PlatformIsMinimized = false; Window = NULL; OverlayDrawList = NULL; LastPlatformPos = LastPlatformSize = LastRendererSize = ImVec2(FLT_MAX, FLT_MAX); }
|
||||
ImGuiViewportP() { Idx = -1; LastFrameActive = LastFrameOverlayDrawList = LastFrontMostStampCount = -1; LastNameHash = 0; Alpha = LastAlpha = 1.0f; PlatformMonitor = INT_MIN; PlatformWindowCreated = PlatformWindowMinimized = false; Window = NULL; OverlayDrawList = NULL; LastPlatformPos = LastPlatformSize = LastRendererSize = ImVec2(FLT_MAX, FLT_MAX); }
|
||||
~ImGuiViewportP() { if (OverlayDrawList) IM_DELETE(OverlayDrawList); }
|
||||
ImRect GetRect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
||||
ImVec2 GetCenter() const{ return ImVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); }
|
||||
|
Loading…
Reference in New Issue
Block a user