2
0
Эх сурвалжийг харах

Revert "Added ImGuiKey_AbntC1, ImGuiKey_AbntC2 + Backends: GLFW, Win32: added support. (#8468)"

This reverts commit 557c77e4556a776058c099881f4b32d5416b27c6.
ocornut 4 сар өмнө
parent
commit
79bba34c5f

+ 3 - 9
backends/imgui_impl_glfw.cpp

@@ -28,7 +28,7 @@
 
 
 // CHANGELOG
 // CHANGELOG
 // (minor and older changes stripped away, please see git history for details)
 // (minor and older changes stripped away, please see git history for details)
-//  2025-03-11: Added support for ImGuiKey_Oem102, ImGuiKey_AbntC1, ImGuiKey_AbntC2.
+//  2025-03-10: Map GLFW_KEY_WORLD_1 and GLFW_KEY_WORLD_2 into ImGuiKey_Oem102.
 //  2025-03-03: Fixed clipboard handler assertion when using GLFW <= 3.2.1 compiled with asserts enabled.
 //  2025-03-03: Fixed clipboard handler assertion when using GLFW <= 3.2.1 compiled with asserts enabled.
 //  2024-08-22: Moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
 //  2024-08-22: Moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
 //               - io.GetClipboardTextFn    -> platform_io.Platform_GetClipboardTextFn
 //               - io.GetClipboardTextFn    -> platform_io.Platform_GetClipboardTextFn
@@ -195,6 +195,7 @@ static ImGui_ImplGlfw_Data* ImGui_ImplGlfw_GetBackendData()
 ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int keycode, int scancode);
 ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int keycode, int scancode);
 ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int keycode, int scancode)
 ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int keycode, int scancode)
 {
 {
+    IM_UNUSED(scancode);
     switch (keycode)
     switch (keycode)
     {
     {
         case GLFW_KEY_TAB: return ImGuiKey_Tab;
         case GLFW_KEY_TAB: return ImGuiKey_Tab;
@@ -316,15 +317,8 @@ ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int keycode, int scancode)
         case GLFW_KEY_F22: return ImGuiKey_F22;
         case GLFW_KEY_F22: return ImGuiKey_F22;
         case GLFW_KEY_F23: return ImGuiKey_F23;
         case GLFW_KEY_F23: return ImGuiKey_F23;
         case GLFW_KEY_F24: return ImGuiKey_F24;
         case GLFW_KEY_F24: return ImGuiKey_F24;
-        default: break;
-    }
-    switch (scancode)
-    {
-        case 115: return ImGuiKey_AbntC1;
-        case 126: return ImGuiKey_AbntC2;
-        default: break;
+        default: return ImGuiKey_None;
     }
     }
-    return ImGuiKey_None;
 }
 }
 
 
 // X11 does not include current pressed/released modifier key in 'mods' flags submitted by GLFW
 // X11 does not include current pressed/released modifier key in 'mods' flags submitted by GLFW

+ 2 - 4
backends/imgui_impl_win32.cpp

@@ -21,7 +21,7 @@
 
 
 // CHANGELOG
 // CHANGELOG
 // (minor and older changes stripped away, please see git history for details)
 // (minor and older changes stripped away, please see git history for details)
-//  2025-03-10: When dealing with OEM keys, use scancodes instead of translated keycodes to choose ImGuiKey values. (#7136, #7201, #7206, #7306, #7670, #7672, #8468) + Added support for ImGuiKey_Oem102, ImGuiKey_AbntC1, ImGuiKey_AbntC2.
+//  2025-03-10: When dealing with OEM keys, use scancodes instead of translated keycodes to choose ImGuiKey values. (#7136, #7201, #7206, #7306, #7670, #7672, #8468)
 //  2025-02-18: Added ImGuiMouseCursor_Wait and ImGuiMouseCursor_Progress mouse cursor support.
 //  2025-02-18: Added ImGuiMouseCursor_Wait and ImGuiMouseCursor_Progress mouse cursor support.
 //  2024-07-08: Inputs: Fixed ImGuiMod_Super being mapped to VK_APPS instead of VK_LWIN||VK_RWIN. (#7768)
 //  2024-07-08: Inputs: Fixed ImGuiMod_Super being mapped to VK_APPS instead of VK_LWIN||VK_RWIN. (#7768)
 //  2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys, app back/forward keys.
 //  2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys, app back/forward keys.
@@ -565,15 +565,13 @@ ImGuiKey ImGui_ImplWin32_KeyEventToImGuiKey(WPARAM wParam, LPARAM lParam)
     case 13: return ImGuiKey_Equal;
     case 13: return ImGuiKey_Equal;
     case 26: return ImGuiKey_LeftBracket;
     case 26: return ImGuiKey_LeftBracket;
     case 27: return ImGuiKey_RightBracket;
     case 27: return ImGuiKey_RightBracket;
+    case 86: return ImGuiKey_Oem102;
     case 43: return ImGuiKey_Backslash;
     case 43: return ImGuiKey_Backslash;
     case 39: return ImGuiKey_Semicolon;
     case 39: return ImGuiKey_Semicolon;
     case 40: return ImGuiKey_Apostrophe;
     case 40: return ImGuiKey_Apostrophe;
     case 51: return ImGuiKey_Comma;
     case 51: return ImGuiKey_Comma;
     case 52: return ImGuiKey_Period;
     case 52: return ImGuiKey_Period;
     case 53: return ImGuiKey_Slash;
     case 53: return ImGuiKey_Slash;
-    case 86: return ImGuiKey_Oem102;
-    case 115: return ImGuiKey_AbntC1;
-    case 126: return ImGuiKey_AbntC2;
     }
     }
 
 
     return ImGuiKey_None;
     return ImGuiKey_None;

+ 1 - 3
docs/CHANGELOG.txt

@@ -130,7 +130,6 @@ Other changes:
 - Examples: SDL3: Added comments to clarify setup for users of the unfortunate
 - Examples: SDL3: Added comments to clarify setup for users of the unfortunate
   SDL_MAIN_USE_CALLBACKS feature. (#8455)
   SDL_MAIN_USE_CALLBACKS feature. (#8455)
 - IO: Added ImGuiKey_Oem102 to ImGuiKey enum. (#7136, #7201, #7206, #7306, #8468)
 - IO: Added ImGuiKey_Oem102 to ImGuiKey enum. (#7136, #7201, #7206, #7306, #8468)
-- IO: Added ImGuiKey_AbntC1, ImGuiKey_AbntC2 to ImGuiKey enum. (#8468)
 - Backends: reworked key handlers to use/prioritize untranslated scancodes instead of
 - Backends: reworked key handlers to use/prioritize untranslated scancodes instead of
   translated keycodes when dealing with OEM keys which are too difficult to find a reliable
   translated keycodes when dealing with OEM keys which are too difficult to find a reliable
   translated mapping on all systems, backends and keyboard layout.
   translated mapping on all systems, backends and keyboard layout.
@@ -142,8 +141,7 @@ Other changes:
   - Fixes many cases of keys not emitting a ImGuiKey value with certain keyboad layouts.
   - Fixes many cases of keys not emitting a ImGuiKey value with certain keyboad layouts.
   - Makes emitted ImGuiKey values more consistent regardless of keyboard mapping,
   - Makes emitted ImGuiKey values more consistent regardless of keyboard mapping,
     but you may be getting different values as before.
     but you may be getting different values as before.
-  - Win32: Use scancodes for OEM keys. Added support for the 3 new keys.
-  - SDL2, SDL3: Use scancodes for OEM keys. Added support for the Oem102 new key.
+  - Win32, SDL2, SDL3: Use scancodes for OEM keys.
   - GLFW: GLFW_KEY_WORLD_1 and GLFW_KEY_WORLD_2 are emitting ImGuiKey_Oem102.
   - GLFW: GLFW_KEY_WORLD_1 and GLFW_KEY_WORLD_2 are emitting ImGuiKey_Oem102.
 - Backends: GLFW: Fixed clipboard handler assertion when using GLFW <= 3.2.1 compiled
 - Backends: GLFW: Fixed clipboard handler assertion when using GLFW <= 3.2.1 compiled
   with asserts enabled. (#8452)
   with asserts enabled. (#8452)

+ 1 - 1
imgui.cpp

@@ -8801,7 +8801,7 @@ static const char* const GKeyNames[] =
     "Pause", "Keypad0", "Keypad1", "Keypad2", "Keypad3", "Keypad4", "Keypad5", "Keypad6",
     "Pause", "Keypad0", "Keypad1", "Keypad2", "Keypad3", "Keypad4", "Keypad5", "Keypad6",
     "Keypad7", "Keypad8", "Keypad9", "KeypadDecimal", "KeypadDivide", "KeypadMultiply",
     "Keypad7", "Keypad8", "Keypad9", "KeypadDecimal", "KeypadDivide", "KeypadMultiply",
     "KeypadSubtract", "KeypadAdd", "KeypadEnter", "KeypadEqual",
     "KeypadSubtract", "KeypadAdd", "KeypadEnter", "KeypadEqual",
-    "AppBack", "AppForward", "Oem102", "AbntC1", "AbntC2",
+    "AppBack", "AppForward", "Oem102",
     "GamepadStart", "GamepadBack",
     "GamepadStart", "GamepadBack",
     "GamepadFaceLeft", "GamepadFaceRight", "GamepadFaceUp", "GamepadFaceDown",
     "GamepadFaceLeft", "GamepadFaceRight", "GamepadFaceUp", "GamepadFaceDown",
     "GamepadDpadLeft", "GamepadDpadRight", "GamepadDpadUp", "GamepadDpadDown",
     "GamepadDpadLeft", "GamepadDpadRight", "GamepadDpadUp", "GamepadDpadDown",

+ 0 - 2
imgui.h

@@ -1494,8 +1494,6 @@ enum ImGuiKey : int
     ImGuiKey_AppBack,               // Available on some keyboard/mouses. Often referred as "Browser Back"
     ImGuiKey_AppBack,               // Available on some keyboard/mouses. Often referred as "Browser Back"
     ImGuiKey_AppForward,
     ImGuiKey_AppForward,
     ImGuiKey_Oem102,                // Non-US backslash.
     ImGuiKey_Oem102,                // Non-US backslash.
-    ImGuiKey_AbntC1,                // Brazil ABNT extra keys
-    ImGuiKey_AbntC2,
 
 
     // Gamepad (some of those are analog values, 0.0f to 1.0f)                          // NAVIGATION ACTION
     // Gamepad (some of those are analog values, 0.0f to 1.0f)                          // NAVIGATION ACTION
     // (download controller mapping PNG/PSD at http://dearimgui.com/controls_sheets)
     // (download controller mapping PNG/PSD at http://dearimgui.com/controls_sheets)