mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 20:54:16 +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>
|
/// </summary>
|
||||||
internal class PluginWindow : Window, IDisposable
|
internal class PluginWindow : Window, IDisposable
|
||||||
{
|
{
|
||||||
private Vector4 bgCol = ImGuiColors.HealerGreen;
|
|
||||||
private Vector4 textCol = ImGuiColors.DalamudWhite;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="PluginWindow"/> class.
|
/// Initializes a new instance of the <see cref="PluginWindow"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -41,21 +38,6 @@ namespace Dalamud.CorePlugin
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Draw()
|
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();
|
Service<ServiceContainer>.Set();
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
Service<TaskTracker>.Set();
|
|
||||||
Log.Information("[T1] TaskTracker OK!");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Initialize the process information.
|
// Initialize the process information.
|
||||||
Service<SigScanner>.Set(new SigScanner(true));
|
Service<SigScanner>.Set(new SigScanner(true));
|
||||||
Service<HookManager>.Set();
|
Service<HookManager>.Set();
|
||||||
|
|
@ -121,6 +116,10 @@ namespace Dalamud
|
||||||
var framework = Service<Framework>.Set();
|
var framework = Service<Framework>.Set();
|
||||||
Log.Information("[T1] Framework OK!");
|
Log.Information("[T1] Framework OK!");
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
Service<TaskTracker>.Set();
|
||||||
|
Log.Information("[T1] TaskTracker OK!");
|
||||||
|
#endif
|
||||||
Service<GameNetwork>.Set();
|
Service<GameNetwork>.Set();
|
||||||
Service<GameGui>.Set();
|
Service<GameGui>.Set();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Dalamud.Interface.Internal.Windows.StyleEditor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class representing a serializable ImGui style.
|
/// Class representing a serializable ImGui style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StyleModel
|
internal class StyleModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="StyleModel"/> class.
|
/// Initializes a new instance of the <see cref="StyleModel"/> class.
|
||||||
|
|
|
||||||
|
|
@ -193,24 +193,37 @@ namespace Dalamud.Interface.Windowing
|
||||||
this.OnOpen();
|
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))
|
if (ImGui.Begin(this.WindowName, ref this.internalIsOpen, this.Flags))
|
||||||
{
|
{
|
||||||
// Draw the actual window contents
|
// Draw the actual window contents
|
||||||
this.Draw();
|
this.Draw();
|
||||||
|
}
|
||||||
|
|
||||||
this.IsFocused = ImGui.IsWindowFocused(ImGuiFocusedFlags.RootAndChildWindows);
|
if (wasFocused)
|
||||||
|
{
|
||||||
|
ImGui.PopStyleColor();
|
||||||
|
}
|
||||||
|
|
||||||
var escapeDown = Service<KeyState>.Get()[VirtualKey.ESCAPE];
|
this.IsFocused = ImGui.IsWindowFocused(ImGuiFocusedFlags.RootAndChildWindows);
|
||||||
var isAllowed = Service<DalamudConfiguration>.Get().IsFocusManagementEnabled;
|
|
||||||
if (escapeDown && this.IsFocused && isAllowed && !wasEscPressedLastFrame && this.RespectCloseHotkey)
|
var escapeDown = Service<KeyState>.Get()[VirtualKey.ESCAPE];
|
||||||
{
|
var isAllowed = Service<DalamudConfiguration>.Get().IsFocusManagementEnabled;
|
||||||
this.IsOpen = false;
|
if (escapeDown && this.IsFocused && isAllowed && !wasEscPressedLastFrame && this.RespectCloseHotkey)
|
||||||
wasEscPressedLastFrame = true;
|
{
|
||||||
}
|
this.IsOpen = false;
|
||||||
else if (!escapeDown && wasEscPressedLastFrame)
|
wasEscPressedLastFrame = true;
|
||||||
{
|
}
|
||||||
wasEscPressedLastFrame = false;
|
else if (!escapeDown && wasEscPressedLastFrame)
|
||||||
}
|
{
|
||||||
|
wasEscPressedLastFrame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ namespace Dalamud.Interface.Windowing
|
||||||
ImGuiManagedAsserts.ReportProblems(source, snapshot);
|
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;
|
this.HasAnyFocus = focusedWindow != default;
|
||||||
|
|
||||||
if (this.HasAnyFocus)
|
if (this.HasAnyFocus)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue