mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 14:23:40 +01:00
feat: release ImGui focus when clicking into game
This commit is contained in:
parent
8bc4598a3c
commit
eb11857bac
1 changed files with 13 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ using Dalamud.Plugin.Internal;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using ImGuiScene.ManagedAsserts;
|
using ImGuiScene.ManagedAsserts;
|
||||||
|
using PInvoke;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal
|
namespace Dalamud.Interface.Internal
|
||||||
|
|
@ -316,6 +317,13 @@ namespace Dalamud.Interface.Internal
|
||||||
|
|
||||||
if (this.isImGuiDrawDemoWindow)
|
if (this.isImGuiDrawDemoWindow)
|
||||||
ImGui.ShowDemoWindow();
|
ImGui.ShowDemoWindow();
|
||||||
|
|
||||||
|
// Release focus of any ImGui window if we click into the game.
|
||||||
|
var io = ImGui.GetIO();
|
||||||
|
if (!io.WantCaptureMouse && (User32.GetKeyState((int)User32.VirtualKey.VK_LBUTTON) & 0x8000) != 0)
|
||||||
|
{
|
||||||
|
ImGui.SetWindowFocus(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -479,6 +487,11 @@ namespace Dalamud.Interface.Internal
|
||||||
|
|
||||||
ImGui.MenuItem("Enable Asserts", string.Empty, ref ImGuiManagedAsserts.EnableAsserts);
|
ImGui.MenuItem("Enable Asserts", string.Empty, ref ImGuiManagedAsserts.EnableAsserts);
|
||||||
|
|
||||||
|
if (ImGui.MenuItem("Clear focus"))
|
||||||
|
{
|
||||||
|
ImGui.SetWindowFocus(null);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.EndMenu();
|
ImGui.EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue