mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #648 from daemitus/windowfix
This commit is contained in:
commit
dc88cec7d3
5 changed files with 32 additions and 38 deletions
|
|
@ -13,9 +13,6 @@ namespace Dalamud.CorePlugin
|
|||
/// </summary>
|
||||
internal class PluginWindow : Window, IDisposable
|
||||
{
|
||||
private Vector4 bgCol = ImGuiColors.HealerGreen;
|
||||
private Vector4 textCol = ImGuiColors.DalamudWhite;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginWindow"/> class.
|
||||
/// </summary>
|
||||
|
|
@ -41,21 +38,6 @@ namespace Dalamud.CorePlugin
|
|||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
ImGui.ColorPicker4("bg", ref this.bgCol);
|
||||
ImGui.ColorPicker4("text", ref this.textCol);
|
||||
|
||||
ImGui.PushStyleColor(ImGuiCol.ChildBg, this.bgCol);
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, this.textCol);
|
||||
|
||||
if (ImGui.BeginChild("##changelog", new Vector2(-1, 100), true, ImGuiWindowFlags.NoNavFocus | ImGuiWindowFlags.NoNavInputs | ImGuiWindowFlags.AlwaysAutoResize))
|
||||
{
|
||||
ImGui.Text("Changelog:");
|
||||
ImGuiHelpers.ScaledDummy(2);
|
||||
ImGui.TextWrapped("* ASIhif ai fdh adhsfuoadf\n* IUHoiaudsfh adsof hioaudshfuio husiodfh\n* A iiaojfdpasd ijopadfnklafwjenalkfjensgdlkjnasasdfbhnj");
|
||||
}
|
||||
|
||||
ImGui.EndChild();
|
||||
ImGui.PopStyleColor(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,11 +104,6 @@ namespace Dalamud
|
|||
|
||||
Service<ServiceContainer>.Set();
|
||||
|
||||
#if DEBUG
|
||||
Service<TaskTracker>.Set();
|
||||
Log.Information("[T1] TaskTracker OK!");
|
||||
#endif
|
||||
|
||||
// Initialize the process information.
|
||||
Service<SigScanner>.Set(new SigScanner(true));
|
||||
Service<HookManager>.Set();
|
||||
|
|
@ -121,6 +116,10 @@ namespace Dalamud
|
|||
var framework = Service<Framework>.Set();
|
||||
Log.Information("[T1] Framework OK!");
|
||||
|
||||
#if DEBUG
|
||||
Service<TaskTracker>.Set();
|
||||
Log.Information("[T1] TaskTracker OK!");
|
||||
#endif
|
||||
Service<GameNetwork>.Set();
|
||||
Service<GameGui>.Set();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ namespace Dalamud.Interface.Internal.Windows.StyleEditor
|
|||
/// <summary>
|
||||
/// Class representing a serializable ImGui style.
|
||||
/// </summary>
|
||||
public class StyleModel
|
||||
internal class StyleModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StyleModel"/> class.
|
||||
|
|
|
|||
|
|
@ -193,24 +193,37 @@ namespace Dalamud.Interface.Windowing
|
|||
this.OnOpen();
|
||||
}
|
||||
|
||||
var wasFocused = this.IsFocused;
|
||||
if (wasFocused)
|
||||
{
|
||||
var style = ImGui.GetStyle();
|
||||
var focusedHeaderColor = style.Colors[(int)ImGuiCol.TitleBgActive];
|
||||
ImGui.PushStyleColor(ImGuiCol.TitleBgCollapsed, focusedHeaderColor);
|
||||
}
|
||||
|
||||
if (ImGui.Begin(this.WindowName, ref this.internalIsOpen, this.Flags))
|
||||
{
|
||||
// Draw the actual window contents
|
||||
this.Draw();
|
||||
}
|
||||
|
||||
this.IsFocused = ImGui.IsWindowFocused(ImGuiFocusedFlags.RootAndChildWindows);
|
||||
if (wasFocused)
|
||||
{
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
|
||||
var escapeDown = Service<KeyState>.Get()[VirtualKey.ESCAPE];
|
||||
var isAllowed = Service<DalamudConfiguration>.Get().IsFocusManagementEnabled;
|
||||
if (escapeDown && this.IsFocused && isAllowed && !wasEscPressedLastFrame && this.RespectCloseHotkey)
|
||||
{
|
||||
this.IsOpen = false;
|
||||
wasEscPressedLastFrame = true;
|
||||
}
|
||||
else if (!escapeDown && wasEscPressedLastFrame)
|
||||
{
|
||||
wasEscPressedLastFrame = false;
|
||||
}
|
||||
this.IsFocused = ImGui.IsWindowFocused(ImGuiFocusedFlags.RootAndChildWindows);
|
||||
|
||||
var escapeDown = Service<KeyState>.Get()[VirtualKey.ESCAPE];
|
||||
var isAllowed = Service<DalamudConfiguration>.Get().IsFocusManagementEnabled;
|
||||
if (escapeDown && this.IsFocused && isAllowed && !wasEscPressedLastFrame && this.RespectCloseHotkey)
|
||||
{
|
||||
this.IsOpen = false;
|
||||
wasEscPressedLastFrame = true;
|
||||
}
|
||||
else if (!escapeDown && wasEscPressedLastFrame)
|
||||
{
|
||||
wasEscPressedLastFrame = false;
|
||||
}
|
||||
|
||||
ImGui.End();
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace Dalamud.Interface.Windowing
|
|||
ImGuiManagedAsserts.ReportProblems(source, snapshot);
|
||||
}
|
||||
|
||||
var focusedWindow = this.windows.FirstOrDefault(x => x.IsFocused && x.RespectCloseHotkey);
|
||||
var focusedWindow = this.windows.FirstOrDefault(window => window.IsFocused && window.RespectCloseHotkey);
|
||||
this.HasAnyFocus = focusedWindow != default;
|
||||
|
||||
if (this.HasAnyFocus)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue