mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-20 06:46:36 +00:00
Viewport: Refactored ViewportFlagsOverrideMask+ViewportFlagsOverrideValue into ViewportFlagsOverrideSet+ViewportFlagsOverrideClear which appears easier to grasp. (#1542)
(cherry picked from commit 9437630872e7ca19065bee78fcafaab54a0d5bf2)
This commit is contained in:
parent
7c183dc6a1
commit
e5b905481d
@ -6162,8 +6162,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
window->Viewport->ParentViewportId = parent_window_in_stack->Viewport->ID;
|
window->Viewport->ParentViewportId = parent_window_in_stack->Viewport->ID;
|
||||||
else
|
else
|
||||||
window->Viewport->ParentViewportId = g.IO.ConfigViewportsNoDefaultParent ? 0 : IMGUI_VIEWPORT_DEFAULT_ID;
|
window->Viewport->ParentViewportId = g.IO.ConfigViewportsNoDefaultParent ? 0 : IMGUI_VIEWPORT_DEFAULT_ID;
|
||||||
if (window->WindowClass.ViewportFlagsOverrideMask)
|
if (window->WindowClass.ViewportFlagsOverrideSet)
|
||||||
viewport_flags = (viewport_flags & ~window->WindowClass.ViewportFlagsOverrideMask) | (window->WindowClass.ViewportFlagsOverrideValue & window->WindowClass.ViewportFlagsOverrideMask);
|
viewport_flags |= window->WindowClass.ViewportFlagsOverrideSet;
|
||||||
|
if (window->WindowClass.ViewportFlagsOverrideClear)
|
||||||
|
viewport_flags &= ~window->WindowClass.ViewportFlagsOverrideClear;
|
||||||
|
|
||||||
// We also tell the back-end that clearing the platform window won't be necessary, as our window is filling the viewport and we have disabled BgAlpha
|
// We also tell the back-end that clearing the platform window won't be necessary, as our window is filling the viewport and we have disabled BgAlpha
|
||||||
viewport_flags |= ImGuiViewportFlags_NoRendererClear;
|
viewport_flags |= ImGuiViewportFlags_NoRendererClear;
|
||||||
@ -7437,6 +7439,7 @@ void ImGui::SetNextWindowDockID(ImGuiID id, ImGuiCond cond)
|
|||||||
void ImGui::SetNextWindowClass(const ImGuiWindowClass* window_class)
|
void ImGui::SetNextWindowClass(const ImGuiWindowClass* window_class)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
IM_ASSERT((window_class->ViewportFlagsOverrideSet & window_class->ViewportFlagsOverrideClear) == 0); // Cannot set both set and clear for the same bit
|
||||||
g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasWindowClass;
|
g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasWindowClass;
|
||||||
g.NextWindowData.WindowClass = *window_class;
|
g.NextWindowData.WindowClass = *window_class;
|
||||||
}
|
}
|
||||||
@ -10291,7 +10294,7 @@ static bool ImGui::GetWindowAlwaysWantOwnViewport(ImGuiWindow* window)
|
|||||||
{
|
{
|
||||||
// Tooltips and menus are not automatically forced into their own viewport when the NoMerge flag is set, however the multiplication of viewports makes them more likely to protrude and create their own.
|
// Tooltips and menus are not automatically forced into their own viewport when the NoMerge flag is set, however the multiplication of viewports makes them more likely to protrude and create their own.
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.IO.ConfigViewportsNoAutoMerge || ((window->WindowClass.ViewportFlagsOverrideValue & window->WindowClass.ViewportFlagsOverrideMask) & ImGuiViewportFlags_NoAutoMerge))
|
if (g.IO.ConfigViewportsNoAutoMerge || (window->WindowClass.ViewportFlagsOverrideSet & ImGuiViewportFlags_NoAutoMerge))
|
||||||
if (g.ConfigFlagsForFrame & ImGuiConfigFlags_ViewportsEnable)
|
if (g.ConfigFlagsForFrame & ImGuiConfigFlags_ViewportsEnable)
|
||||||
if (!window->DockIsActive)
|
if (!window->DockIsActive)
|
||||||
if ((window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup)) == 0)
|
if ((window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup)) == 0)
|
||||||
|
6
imgui.h
6
imgui.h
@ -1588,12 +1588,12 @@ struct ImGuiWindowClass
|
|||||||
{
|
{
|
||||||
ImGuiID ClassId; // User data. 0 = Default class (unclassed)
|
ImGuiID ClassId; // User data. 0 = Default class (unclassed)
|
||||||
ImGuiID ParentViewportId; // Hint for the platform back-end. If non-zero, the platform back-end can create a parent<>child relationship between the platform windows. Not conforming back-ends are free to e.g. parent every viewport to the main viewport or not.
|
ImGuiID ParentViewportId; // Hint for the platform back-end. If non-zero, the platform back-end can create a parent<>child relationship between the platform windows. Not conforming back-ends are free to e.g. parent every viewport to the main viewport or not.
|
||||||
ImGuiViewportFlags ViewportFlagsOverrideMask; // Viewport flags to override when a window of this class owns a viewport. This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis.
|
ImGuiViewportFlags ViewportFlagsOverrideSet; // Viewport flags to set when a window of this class owns a viewport. This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis.
|
||||||
ImGuiViewportFlags ViewportFlagsOverrideValue; // Viewport flags values to override when a window of this class owns a viewport.
|
ImGuiViewportFlags ViewportFlagsOverrideClear; // Viewport flags to clear when a window of this class owns a viewport. This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis.
|
||||||
bool DockingAlwaysTabBar; // Set to true to enforce windows of this class always having their own tab (equivalent of setting the global io.ConfigDockingAlwaysTabBar)
|
bool DockingAlwaysTabBar; // Set to true to enforce windows of this class always having their own tab (equivalent of setting the global io.ConfigDockingAlwaysTabBar)
|
||||||
bool DockingAllowUnclassed; // Set to true to allow windows of this class to be docked/merged with an unclassed window.
|
bool DockingAllowUnclassed; // Set to true to allow windows of this class to be docked/merged with an unclassed window.
|
||||||
|
|
||||||
ImGuiWindowClass() { ClassId = 0; ParentViewportId = 0; ViewportFlagsOverrideMask = ViewportFlagsOverrideValue = 0x00; DockingAlwaysTabBar = false; DockingAllowUnclassed = true; }
|
ImGuiWindowClass() { ClassId = 0; ParentViewportId = 0; ViewportFlagsOverrideSet = ViewportFlagsOverrideClear = 0x00; DockingAlwaysTabBar = false; DockingAllowUnclassed = true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Data payload for Drag and Drop operations: AcceptDragDropPayload(), GetDragDropPayload()
|
// Data payload for Drag and Drop operations: AcceptDragDropPayload(), GetDragDropPayload()
|
||||||
|
Loading…
Reference in New Issue
Block a user