mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-18 13:57:43 +01:00
Always show focus indicator if focused
This commit is contained in:
parent
6b875bbcb5
commit
16022ea46a
1 changed files with 11 additions and 4 deletions
|
|
@ -75,14 +75,21 @@ internal sealed partial class ActiveNotification
|
||||||
ImGuiWindowFlags.NoFocusOnAppearing |
|
ImGuiWindowFlags.NoFocusOnAppearing |
|
||||||
ImGuiWindowFlags.NoDocking);
|
ImGuiWindowFlags.NoDocking);
|
||||||
|
|
||||||
var isTakingKeyboardInput = ImGui.IsWindowFocused() && ImGui.GetIO().WantTextInput;
|
var isFocused = ImGui.IsWindowFocused();
|
||||||
var isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.AllowWhenBlockedByActiveItem);
|
var isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.AllowWhenBlockedByActiveItem);
|
||||||
|
var isTakingKeyboardInput = isFocused && ImGui.GetIO().WantTextInput;
|
||||||
var warrantsExtension =
|
var warrantsExtension =
|
||||||
this.ExtensionDurationSinceLastInterest > TimeSpan.Zero
|
this.ExtensionDurationSinceLastInterest > TimeSpan.Zero
|
||||||
&& (isHovered || isTakingKeyboardInput);
|
&& (isHovered || isTakingKeyboardInput);
|
||||||
|
|
||||||
this.EffectiveExpiry = this.CalculateEffectiveExpiry(ref warrantsExtension);
|
this.EffectiveExpiry = this.CalculateEffectiveExpiry(ref warrantsExtension);
|
||||||
|
|
||||||
|
if (!isTakingKeyboardInput && !isHovered && isFocused)
|
||||||
|
{
|
||||||
|
ImGui.SetWindowFocus(null);
|
||||||
|
isFocused = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (DateTime.Now > this.EffectiveExpiry)
|
if (DateTime.Now > this.EffectiveExpiry)
|
||||||
this.DismissNow(NotificationDismissReason.Timeout);
|
this.DismissNow(NotificationDismissReason.Timeout);
|
||||||
|
|
||||||
|
|
@ -105,8 +112,8 @@ internal sealed partial class ActiveNotification
|
||||||
ImGui.PopStyleVar();
|
ImGui.PopStyleVar();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTakingKeyboardInput)
|
if (isFocused)
|
||||||
this.DrawKeyboardInputIndicator();
|
this.DrawFocusIndicator();
|
||||||
this.DrawExpiryBar(this.EffectiveExpiry, warrantsExtension);
|
this.DrawExpiryBar(this.EffectiveExpiry, warrantsExtension);
|
||||||
|
|
||||||
if (ImGui.IsWindowHovered())
|
if (ImGui.IsWindowHovered())
|
||||||
|
|
@ -218,7 +225,7 @@ internal sealed partial class ActiveNotification
|
||||||
ImGui.PopClipRect();
|
ImGui.PopClipRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawKeyboardInputIndicator()
|
private void DrawFocusIndicator()
|
||||||
{
|
{
|
||||||
var windowPos = ImGui.GetWindowPos();
|
var windowPos = ImGui.GetWindowPos();
|
||||||
var windowSize = ImGui.GetWindowSize();
|
var windowSize = ImGui.GetWindowSize();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue