Detachable windows (Dear ImGui multi-viewports)
Settings > Display > Detachable Windows (on by default): any window can be dragged outside the main window into its own OS window; the backend leaves it off on Wayland. Detached windows are rendered after the main one, the main window's close button still quits, window backgrounds are opaque, and toasts anchor to the main window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d53d176125
commit
4856d9ba27
7 files changed
+29
-2
No files matched your search
+3
-2
@@ -23,12 +23,13 @@ namespace anm2ed::imgui
|
||||
|
||||
void Toasts::update()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
auto borderColor = ImGui::GetStyleColorVec4(ImGuiCol_Border);
|
||||
auto textColor = ImGui::GetStyleColorVec4(ImGuiCol_Text);
|
||||
|
||||
auto position = to_vec2(io.DisplaySize) - to_vec2(ImGui::GetStyle().ItemSpacing);
|
||||
// The main window's bottom right corner (coordinates are the desktop's once windows can be detached).
|
||||
auto viewport = ImGui::GetMainViewport();
|
||||
auto position = to_vec2(viewport->Pos) + to_vec2(viewport->Size) - to_vec2(ImGui::GetStyle().ItemSpacing);
|
||||
|
||||
for (int i = (int)toasts.size() - 1; i >= 0; --i)
|
||||
{
|
||||
|
||||
@@ -32,6 +32,9 @@ namespace anm2ed::imgui::wizard
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_UI_SCALE));
|
||||
ImGui::Checkbox(localize.get(LABEL_VSYNC), &temporary.isVsync);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_VSYNC));
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox(localize.get(LABEL_DETACHABLE_WINDOWS), &temporary.isDetachableWindows);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_DETACHABLE_WINDOWS));
|
||||
|
||||
ImGui::SeparatorText(localize.get(LABEL_PLAYBACK_MENU));
|
||||
ImGui::RadioButton("30 Hz", &temporary.playbackTickRate, 30);
|
||||
@@ -194,6 +197,10 @@ namespace anm2ed::imgui::wizard
|
||||
ImGui::GetIO().KeyRepeatDelay = settings.keyboardRepeatDelay;
|
||||
ImGui::GetIO().KeyRepeatRate = settings.keyboardRepeatRate;
|
||||
ImGui::GetStyle().FontScaleMain = math::percent_to_unit(settings.uiScale);
|
||||
if (settings.isDetachableWindows)
|
||||
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||
else
|
||||
ImGui::GetIO().ConfigFlags &= ~ImGuiConfigFlags_ViewportsEnable;
|
||||
SnapshotStack::max_size_set(settings.fileSnapshotStackSize);
|
||||
imgui::theme_set((theme::Type)settings.theme);
|
||||
localize.language = (Language)settings.language;
|
||||
|
||||
Reference in new issue
Block a user