mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-28 01:20:55 +01:00
Amend 7747106
.
This commit is contained in:
parent
7747106647
commit
8bd5d1d42f
15
imgui.cpp
15
imgui.cpp
@ -1497,9 +1497,9 @@ void ImGuiIO::AddKeyAnalogEvent(ImGuiKey key, bool down, float analog_value)
|
|||||||
if (key == ImGuiMod_Super) { key = ImGuiMod_Ctrl; }
|
if (key == ImGuiMod_Super) { key = ImGuiMod_Ctrl; }
|
||||||
else if (key == ImGuiMod_Ctrl) { key = ImGuiMod_Super; }
|
else if (key == ImGuiMod_Ctrl) { key = ImGuiMod_Super; }
|
||||||
else if (key == ImGuiKey_LeftSuper) { key = ImGuiKey_LeftCtrl; }
|
else if (key == ImGuiKey_LeftSuper) { key = ImGuiKey_LeftCtrl; }
|
||||||
else if (key == ImGuiKey_LeftSuper) { key = ImGuiKey_RightCtrl; }
|
else if (key == ImGuiKey_RightSuper){ key = ImGuiKey_RightCtrl; }
|
||||||
else if (key == ImGuiKey_LeftCtrl) { key = ImGuiKey_LeftSuper; }
|
else if (key == ImGuiKey_LeftCtrl) { key = ImGuiKey_LeftSuper; }
|
||||||
else if (key == ImGuiKey_LeftCtrl) { key = ImGuiKey_RightSuper; }
|
else if (key == ImGuiKey_RightCtrl) { key = ImGuiKey_RightSuper; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify that backend isn't mixing up using new io.AddKeyEvent() api and old io.KeysDown[] + io.KeyMap[] data.
|
// Verify that backend isn't mixing up using new io.AddKeyEvent() api and old io.KeysDown[] + io.KeyMap[] data.
|
||||||
@ -8284,7 +8284,7 @@ ImGuiID ImGui::GetID(const void* ptr_id)
|
|||||||
// - Shortcut() [Internal]
|
// - Shortcut() [Internal]
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImGuiKeyChord ImGui::FixupKeyChord(ImGuiContext* ctx, ImGuiKeyChord key_chord)
|
ImGuiKeyChord ImGui::FixupKeyChord(ImGuiKeyChord key_chord)
|
||||||
{
|
{
|
||||||
// Add ImGuiMod_XXXX when a corresponding ImGuiKey_LeftXXX/ImGuiKey_RightXXX is specified.
|
// Add ImGuiMod_XXXX when a corresponding ImGuiKey_LeftXXX/ImGuiKey_RightXXX is specified.
|
||||||
ImGuiKey key = (ImGuiKey)(key_chord & ~ImGuiMod_Mask_);
|
ImGuiKey key = (ImGuiKey)(key_chord & ~ImGuiMod_Mask_);
|
||||||
@ -8384,7 +8384,7 @@ const char* ImGui::GetKeyName(ImGuiKey key)
|
|||||||
const char* ImGui::GetKeyChordName(ImGuiKeyChord key_chord)
|
const char* ImGui::GetKeyChordName(ImGuiKeyChord key_chord)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
key_chord = FixupKeyChord(&g, key_chord);
|
key_chord = FixupKeyChord(key_chord);
|
||||||
ImFormatString(g.TempKeychordName, IM_ARRAYSIZE(g.TempKeychordName), "%s%s%s%s%s",
|
ImFormatString(g.TempKeychordName, IM_ARRAYSIZE(g.TempKeychordName), "%s%s%s%s%s",
|
||||||
(key_chord & ImGuiMod_Ctrl) ? "Ctrl+" : "",
|
(key_chord & ImGuiMod_Ctrl) ? "Ctrl+" : "",
|
||||||
(key_chord & ImGuiMod_Shift) ? "Shift+" : "",
|
(key_chord & ImGuiMod_Shift) ? "Shift+" : "",
|
||||||
@ -8606,7 +8606,7 @@ bool ImGui::SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiI
|
|||||||
IM_ASSERT(owner_id != ImGuiKeyOwner_Any && owner_id != ImGuiKeyOwner_None);
|
IM_ASSERT(owner_id != ImGuiKeyOwner_Any && owner_id != ImGuiKeyOwner_None);
|
||||||
|
|
||||||
// Add ImGuiMod_XXXX when a corresponding ImGuiKey_LeftXXX/ImGuiKey_RightXXX is specified.
|
// Add ImGuiMod_XXXX when a corresponding ImGuiKey_LeftXXX/ImGuiKey_RightXXX is specified.
|
||||||
key_chord = FixupKeyChord(&g, key_chord);
|
key_chord = FixupKeyChord(key_chord);
|
||||||
|
|
||||||
// [DEBUG] Debug break requested by user
|
// [DEBUG] Debug break requested by user
|
||||||
if (g.DebugBreakInShortcutRouting == key_chord)
|
if (g.DebugBreakInShortcutRouting == key_chord)
|
||||||
@ -8674,9 +8674,8 @@ bool ImGui::SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiI
|
|||||||
// Note: this cannot be turned into GetShortcutRouting() because we do the owner_id->routing_id translation, name would be more misleading.
|
// Note: this cannot be turned into GetShortcutRouting() because we do the owner_id->routing_id translation, name would be more misleading.
|
||||||
bool ImGui::TestShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id)
|
bool ImGui::TestShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
|
||||||
const ImGuiID routing_id = GetRoutingIdFromOwnerId(owner_id);
|
const ImGuiID routing_id = GetRoutingIdFromOwnerId(owner_id);
|
||||||
key_chord = FixupKeyChord(&g, key_chord);
|
key_chord = FixupKeyChord(key_chord);
|
||||||
ImGuiKeyRoutingData* routing_data = GetShortcutRoutingData(key_chord); // FIXME: Could avoid creating entry.
|
ImGuiKeyRoutingData* routing_data = GetShortcutRoutingData(key_chord); // FIXME: Could avoid creating entry.
|
||||||
return routing_data->RoutingCurr == routing_id;
|
return routing_data->RoutingCurr == routing_id;
|
||||||
}
|
}
|
||||||
@ -9606,7 +9605,7 @@ bool ImGui::IsKeyChordPressed(ImGuiKeyChord key_chord)
|
|||||||
bool ImGui::IsKeyChordPressed(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags)
|
bool ImGui::IsKeyChordPressed(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
key_chord = FixupKeyChord(&g, key_chord);
|
key_chord = FixupKeyChord(key_chord);
|
||||||
ImGuiKey mods = (ImGuiKey)(key_chord & ImGuiMod_Mask_);
|
ImGuiKey mods = (ImGuiKey)(key_chord & ImGuiMod_Mask_);
|
||||||
if (g.IO.KeyMods != mods)
|
if (g.IO.KeyMods != mods)
|
||||||
return false;
|
return false;
|
||||||
|
@ -3216,7 +3216,7 @@ namespace ImGui
|
|||||||
inline bool IsMouseKey(ImGuiKey key) { return key >= ImGuiKey_Mouse_BEGIN && key < ImGuiKey_Mouse_END; }
|
inline bool IsMouseKey(ImGuiKey key) { return key >= ImGuiKey_Mouse_BEGIN && key < ImGuiKey_Mouse_END; }
|
||||||
inline bool IsAliasKey(ImGuiKey key) { return key >= ImGuiKey_Aliases_BEGIN && key < ImGuiKey_Aliases_END; }
|
inline bool IsAliasKey(ImGuiKey key) { return key >= ImGuiKey_Aliases_BEGIN && key < ImGuiKey_Aliases_END; }
|
||||||
inline bool IsModKey(ImGuiKey key) { return key >= ImGuiKey_LeftCtrl && key <= ImGuiKey_RightSuper; }
|
inline bool IsModKey(ImGuiKey key) { return key >= ImGuiKey_LeftCtrl && key <= ImGuiKey_RightSuper; }
|
||||||
ImGuiKeyChord FixupKeyChord(ImGuiContext* ctx, ImGuiKeyChord key_chord);
|
ImGuiKeyChord FixupKeyChord(ImGuiKeyChord key_chord);
|
||||||
inline ImGuiKey ConvertSingleModFlagToKey(ImGuiKey key)
|
inline ImGuiKey ConvertSingleModFlagToKey(ImGuiKey key)
|
||||||
{
|
{
|
||||||
if (key == ImGuiMod_Ctrl) return ImGuiKey_ReservedForModCtrl;
|
if (key == ImGuiMod_Ctrl) return ImGuiKey_ReservedForModCtrl;
|
||||||
|
Loading…
Reference in New Issue
Block a user