Skip to content

Commit 001f102

Browse files
committed
IO, Backends: added ImGuiKey_AppBack, ImGuiKey_AppForward. (ocornut#6891, ocornut#4921)
1 parent 7bbd758 commit 001f102

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

backends/imgui_impl_sdl2.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
// CHANGELOG
2323
// (minor and older changes stripped away, please see git history for details)
24-
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys.
24+
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys, app back/forward keys.
2525
// 2023-04-06: Inputs: Avoid calling SDL_StartTextInput()/SDL_StopTextInput() as they don't only pertain to IME. It's unclear exactly what their relation is to IME. (#6306)
2626
// 2023-04-04: Inputs: Added support for io.AddMouseSourceEvent() to discriminate ImGuiMouseSource_Mouse/ImGuiMouseSource_TouchScreen. (#2702)
2727
// 2023-02-23: Accept SDL_GetPerformanceCounter() not returning a monotonically increasing value. (#6189, #6114, #3644)
@@ -276,6 +276,8 @@ static ImGuiKey ImGui_ImplSDL2_KeycodeToImGuiKey(int keycode)
276276
case SDLK_F22: return ImGuiKey_F22;
277277
case SDLK_F23: return ImGuiKey_F23;
278278
case SDLK_F24: return ImGuiKey_F24;
279+
case SDLK_AC_BACK: return ImGuiKey_AppBack;
280+
case SDLK_AC_FORWARD: return ImGuiKey_AppForward;
279281
}
280282
return ImGuiKey_None;
281283
}

backends/imgui_impl_sdl3.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
// CHANGELOG
2424
// (minor and older changes stripped away, please see git history for details)
25-
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys.
25+
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys, app back/forward keys.
2626
// 2023-05-04: Fixed build on Emscripten/iOS/Android. (#6391)
2727
// 2023-04-06: Inputs: Avoid calling SDL_StartTextInput()/SDL_StopTextInput() as they don't only pertain to IME. It's unclear exactly what their relation is to IME. (#6306)
2828
// 2023-04-04: Inputs: Added support for io.AddMouseSourceEvent() to discriminate ImGuiMouseSource_Mouse/ImGuiMouseSource_TouchScreen. (#2702)
@@ -227,6 +227,8 @@ static ImGuiKey ImGui_ImplSDL3_KeycodeToImGuiKey(int keycode)
227227
case SDLK_F22: return ImGuiKey_F22;
228228
case SDLK_F23: return ImGuiKey_F23;
229229
case SDLK_F24: return ImGuiKey_F24;
230+
case SDLK_AC_BACK: return ImGuiKey_AppBack;
231+
case SDLK_AC_FORWARD: return ImGuiKey_AppForward;
230232
}
231233
return ImGuiKey_None;
232234
}

backends/imgui_impl_win32.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ typedef DWORD (WINAPI *PFN_XInputGetState)(DWORD, XINPUT_STATE*);
3939

4040
// CHANGELOG
4141
// (minor and older changes stripped away, please see git history for details)
42-
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys.
42+
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys, app back/forward keys.
4343
// 2023-09-25: Inputs: Synthesize key-down event on key-up for VK_SNAPSHOT / ImGuiKey_PrintScreen as Windows doesn't emit it (same behavior as GLFW/SDL).
4444
// 2023-09-07: Inputs: Added support for keyboard codepage conversion for when application is compiled in MBCS mode and using a non-Unicode window.
4545
// 2023-04-19: Added ImGui_ImplWin32_InitForOpenGL() to facilitate combining raw Win32/Winapi with OpenGL. (#3218)
@@ -529,6 +529,8 @@ static ImGuiKey ImGui_ImplWin32_VirtualKeyToImGuiKey(WPARAM wParam)
529529
case VK_F22: return ImGuiKey_F22;
530530
case VK_F23: return ImGuiKey_F23;
531531
case VK_F24: return ImGuiKey_F24;
532+
case VK_BROWSER_BACK: return ImGuiKey_AppBack;
533+
case VK_BROWSER_FORWARD: return ImGuiKey_AppForward;
532534
default: return ImGuiKey_None;
533535
}
534536
}

docs/CHANGELOG.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ Other changes:
126126
Was most often noticable when using an horizontal scrollbar. (#6789)
127127
- Misc: Most text functions also treat "%.*s" (along with "%s") specially to avoid formatting. (#3466, #6846)
128128
- IO: Add extra keys to ImGuiKey enum: ImGuiKey_F13 to ImGuiKey_F24. (#6891, #4921)
129+
- IO: Add extra keys to ImGuiKey enum: ImGuiKey_AppBack, ImGuiKey_AppForward. (#4921)
129130
- IO: Setting io.WantSetMousePos ignores incoming MousePos events. (#6837, #228) [@bertaye]
130131
- Debug Tools: Metrics: Added log of recent alloc/free calls.
131132
- Debug Tools: Metrics: Added "Show groups rectangles" in tools.
@@ -134,8 +135,8 @@ Other changes:
134135
- Demo: Added "Drag and Drop -> Tooltip at target location" demo.
135136
- Backends: GLFW: Clear emscripten's MouseWheel callback before shutdown. (#6790, #6096, #4019) [@halx99]
136137
- Backends: GLFW: Added support for F13 to F24 function keys. (#6891)
137-
- Backends: SDL2, SDL3: Added support for F13 to F24 function keys. (#6891)
138-
- Backends: Win32: Added support for F13 to F24 function keys. (#6891)
138+
- Backends: SDL2, SDL3: Added support for F13 to F24 function keys, AppBack, AppForward. (#6891)
139+
- Backends: Win32: Added support for F13 to F24 function keys, AppBack, AppForward. (#6891)
139140
- Backends: Win32: Added support for keyboard codepage conversion for when application
140141
is compiled in MBCS mode and using a non-Unicode window. (#6785, #6782, #5725, #5961) [@sneakyevil]
141142
- Backends: Win32: Synthesize key-down event on key-up for VK_SNAPSHOT / ImGuiKey_PrintScreen as Windows

imgui.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7989,6 +7989,7 @@ static const char* const GKeyNames[] =
79897989
"Pause", "Keypad0", "Keypad1", "Keypad2", "Keypad3", "Keypad4", "Keypad5", "Keypad6",
79907990
"Keypad7", "Keypad8", "Keypad9", "KeypadDecimal", "KeypadDivide", "KeypadMultiply",
79917991
"KeypadSubtract", "KeypadAdd", "KeypadEnter", "KeypadEqual",
7992+
"AppBack", "AppForward",
79927993
"GamepadStart", "GamepadBack",
79937994
"GamepadFaceLeft", "GamepadFaceRight", "GamepadFaceUp", "GamepadFaceDown",
79947995
"GamepadDpadLeft", "GamepadDpadRight", "GamepadDpadUp", "GamepadDpadDown",

imgui.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,8 @@ enum ImGuiKey : int
14501450
ImGuiKey_KeypadAdd,
14511451
ImGuiKey_KeypadEnter,
14521452
ImGuiKey_KeypadEqual,
1453+
ImGuiKey_AppBack, // Available on some keyboard/mouses. Often referred as "Browser Back"
1454+
ImGuiKey_AppForward,
14531455

14541456
// Gamepad (some of those are analog values, 0.0f to 1.0f) // NAVIGATION ACTION
14551457
// (download controller mapping PNG/PSD at http://dearimgui.com/controls_sheets)

0 commit comments

Comments
 (0)