Skip to content

Commit 1dc7d0e

Browse files
committed
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_glfw.cpp # backends/imgui_impl_osx.mm # backends/imgui_impl_sdl.cpp # backends/imgui_impl_win32.cpp # imgui.cpp
2 parents 3af9ac3 + 83a0030 commit 1dc7d0e

File tree

36 files changed

+355
-251
lines changed

36 files changed

+355
-251
lines changed

backends/imgui_impl_allegro5.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
// CHANGELOG
1919
// (minor and older changes stripped away, please see git history for details)
20-
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago)with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
20+
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
21+
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
2122
// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
2223
// 2022-01-17: Inputs: always calling io.AddKeyModsEvent() next and before key event (not in NewFrame) to fix input queue with very low framerates.
2324
// 2022-01-10: Inputs: calling new io.AddKeyEvent(), io.AddKeyModsEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.
@@ -450,10 +451,10 @@ static void ImGui_ImplAllegro5_UpdateKeyModifiers()
450451
ImGuiIO& io = ImGui::GetIO();
451452
ALLEGRO_KEYBOARD_STATE keys;
452453
al_get_keyboard_state(&keys);
453-
io.AddKeyEvent(ImGuiKey_ModCtrl, al_key_down(&keys, ALLEGRO_KEY_LCTRL) || al_key_down(&keys, ALLEGRO_KEY_RCTRL));
454-
io.AddKeyEvent(ImGuiKey_ModShift, al_key_down(&keys, ALLEGRO_KEY_LSHIFT) || al_key_down(&keys, ALLEGRO_KEY_RSHIFT));
455-
io.AddKeyEvent(ImGuiKey_ModAlt, al_key_down(&keys, ALLEGRO_KEY_ALT) || al_key_down(&keys, ALLEGRO_KEY_ALTGR));
456-
io.AddKeyEvent(ImGuiKey_ModSuper, al_key_down(&keys, ALLEGRO_KEY_LWIN) || al_key_down(&keys, ALLEGRO_KEY_RWIN));
454+
io.AddKeyEvent(ImGuiMod_Ctrl, al_key_down(&keys, ALLEGRO_KEY_LCTRL) || al_key_down(&keys, ALLEGRO_KEY_RCTRL));
455+
io.AddKeyEvent(ImGuiMod_Shift, al_key_down(&keys, ALLEGRO_KEY_LSHIFT) || al_key_down(&keys, ALLEGRO_KEY_RSHIFT));
456+
io.AddKeyEvent(ImGuiMod_Alt, al_key_down(&keys, ALLEGRO_KEY_ALT) || al_key_down(&keys, ALLEGRO_KEY_ALTGR));
457+
io.AddKeyEvent(ImGuiMod_Super, al_key_down(&keys, ALLEGRO_KEY_LWIN) || al_key_down(&keys, ALLEGRO_KEY_RWIN));
457458
}
458459

459460
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.

backends/imgui_impl_android.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
// CHANGELOG
2121
// (minor and older changes stripped away, please see git history for details)
22-
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago)with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
22+
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
23+
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
2324
// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
2425
// 2022-01-10: Inputs: calling new io.AddKeyEvent(), io.AddKeyModsEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.
2526
// 2021-03-04: Initial version.
@@ -163,10 +164,10 @@ int32_t ImGui_ImplAndroid_HandleInputEvent(AInputEvent* input_event)
163164
int32_t event_action = AKeyEvent_getAction(input_event);
164165
int32_t event_meta_state = AKeyEvent_getMetaState(input_event);
165166

166-
io.AddKeyEvent(ImGuiKey_ModCtrl, (event_meta_state & AMETA_CTRL_ON) != 0);
167-
io.AddKeyEvent(ImGuiKey_ModShift, (event_meta_state & AMETA_SHIFT_ON) != 0);
168-
io.AddKeyEvent(ImGuiKey_ModAlt, (event_meta_state & AMETA_ALT_ON) != 0);
169-
io.AddKeyEvent(ImGuiKey_ModSuper, (event_meta_state & AMETA_META_ON) != 0);
167+
io.AddKeyEvent(ImGuiMod_Ctrl, (event_meta_state & AMETA_CTRL_ON) != 0);
168+
io.AddKeyEvent(ImGuiMod_Shift, (event_meta_state & AMETA_SHIFT_ON) != 0);
169+
io.AddKeyEvent(ImGuiMod_Alt, (event_meta_state & AMETA_ALT_ON) != 0);
170+
io.AddKeyEvent(ImGuiMod_Super, (event_meta_state & AMETA_META_ON) != 0);
170171

171172
switch (event_action)
172173
{

backends/imgui_impl_glfw.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
// CHANGELOG
2222
// (minor and older changes stripped away, please see git history for details)
2323
// 2022-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
24+
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
2425
// 2022-09-01: Inputs: Honor GLFW_CURSOR_DISABLED by not setting mouse position.
2526
// 2022-04-30: Inputs: Fixed ImGui_ImplGlfw_TranslateUntranslatedKey() for lower case letters on OSX.
2627
// 2022-03-23: Inputs: Fixed a regression in 1.87 which resulted in keyboard modifiers events being reported incorrectly on Linux/X11.
2728
// 2022-02-07: Added ImGui_ImplGlfw_InstallCallbacks()/ImGui_ImplGlfw_RestoreCallbacks() helpers to facilitate user installing callbacks after initializing backend.
28-
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago)with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
29+
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
2930
// 2021-01-20: Inputs: calling new io.AddKeyAnalogEvent() for gamepad support, instead of writing directly to io.NavInputs[].
3031
// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
3132
// 2022-01-17: Inputs: always update key mods next and before key event (not in NewFrame) to fix input queue with very low framerates.
@@ -298,10 +299,10 @@ static int ImGui_ImplGlfw_KeyToModifier(int key)
298299
static void ImGui_ImplGlfw_UpdateKeyModifiers(int mods)
299300
{
300301
ImGuiIO& io = ImGui::GetIO();
301-
io.AddKeyEvent(ImGuiKey_ModCtrl, (mods & GLFW_MOD_CONTROL) != 0);
302-
io.AddKeyEvent(ImGuiKey_ModShift, (mods & GLFW_MOD_SHIFT) != 0);
303-
io.AddKeyEvent(ImGuiKey_ModAlt, (mods & GLFW_MOD_ALT) != 0);
304-
io.AddKeyEvent(ImGuiKey_ModSuper, (mods & GLFW_MOD_SUPER) != 0);
302+
io.AddKeyEvent(ImGuiMod_Ctrl, (mods & GLFW_MOD_CONTROL) != 0);
303+
io.AddKeyEvent(ImGuiMod_Shift, (mods & GLFW_MOD_SHIFT) != 0);
304+
io.AddKeyEvent(ImGuiMod_Alt, (mods & GLFW_MOD_ALT) != 0);
305+
io.AddKeyEvent(ImGuiMod_Super, (mods & GLFW_MOD_SUPER) != 0);
305306
}
306307

307308
void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods)

backends/imgui_impl_glut.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
// CHANGELOG
2222
// (minor and older changes stripped away, please see git history for details)
23+
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
2324
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
2425
// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
2526
// 2022-01-10: Inputs: calling new io.AddKeyEvent(), io.AddKeyModsEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.
@@ -208,9 +209,9 @@ static void ImGui_ImplGLUT_UpdateKeyModifiers()
208209
{
209210
ImGuiIO& io = ImGui::GetIO();
210211
int glut_key_mods = glutGetModifiers();
211-
io.AddKeyEvent(ImGuiKey_ModCtrl, (glut_key_mods & GLUT_ACTIVE_CTRL) != 0);
212-
io.AddKeyEvent(ImGuiKey_ModShift, (glut_key_mods & GLUT_ACTIVE_SHIFT) != 0);
213-
io.AddKeyEvent(ImGuiKey_ModAlt, (glut_key_mods & GLUT_ACTIVE_ALT) != 0);
212+
io.AddKeyEvent(ImGuiMod_Ctrl, (glut_key_mods & GLUT_ACTIVE_CTRL) != 0);
213+
io.AddKeyEvent(ImGuiMod_Shift, (glut_key_mods & GLUT_ACTIVE_SHIFT) != 0);
214+
io.AddKeyEvent(ImGuiMod_Alt, (glut_key_mods & GLUT_ACTIVE_ALT) != 0);
214215
}
215216

216217
static void ImGui_ImplGLUT_AddKeyEvent(ImGuiKey key, bool down, int native_keycode)

backends/imgui_impl_osx.mm

+6-5
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
// CHANGELOG
2626
// (minor and older changes stripped away, please see git history for details)
2727
// 2022-XX-XX: Added support for multiple windows via the ImGuiPlatformIO interface.
28+
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
2829
// 2022-05-03: Inputs: Removed ImGui_ImplOSX_HandleEvent() from backend API in favor of backend automatically handling event capture.
2930
// 2022-04-27: Misc: Store backend data in a per-context struct, allowing to use this backend with multiple contexts.
3031
// 2022-03-22: Inputs: Monitor NSKeyUp events to catch missing keyUp for key when user press Cmd + key
3132
// 2022-02-07: Inputs: Forward keyDown/keyUp events to OS when unused by dear imgui.
3233
// 2022-01-31: Fix building with old Xcode versions that are missing gamepad features.
33-
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago)with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
34+
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
3435
// 2021-01-20: Inputs: calling new io.AddKeyAnalogEvent() for gamepad support, instead of writing directly to io.NavInputs[].
3536
// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
3637
// 2022-01-12: Inputs: Added basic Platform IME support, hooking the io.SetPlatformImeDataFn() function.
@@ -718,10 +719,10 @@ static bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
718719
unsigned short key_code = [event keyCode];
719720
NSEventModifierFlags modifier_flags = [event modifierFlags];
720721

721-
io.AddKeyEvent(ImGuiKey_ModShift, (modifier_flags & NSEventModifierFlagShift) != 0);
722-
io.AddKeyEvent(ImGuiKey_ModCtrl, (modifier_flags & NSEventModifierFlagControl) != 0);
723-
io.AddKeyEvent(ImGuiKey_ModAlt, (modifier_flags & NSEventModifierFlagOption) != 0);
724-
io.AddKeyEvent(ImGuiKey_ModSuper, (modifier_flags & NSEventModifierFlagCommand) != 0);
722+
io.AddKeyEvent(ImGuiMod_Shift, (modifier_flags & NSEventModifierFlagShift) != 0);
723+
io.AddKeyEvent(ImGuiMod_Ctrl, (modifier_flags & NSEventModifierFlagControl) != 0);
724+
io.AddKeyEvent(ImGuiMod_Alt, (modifier_flags & NSEventModifierFlagOption) != 0);
725+
io.AddKeyEvent(ImGuiMod_Super, (modifier_flags & NSEventModifierFlagCommand) != 0);
725726

726727
ImGuiKey key = ImGui_ImplOSX_KeyCodeToImGuiKey(key_code);
727728
if (key != ImGuiKey_None)

backends/imgui_impl_sdl.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// CHANGELOG
2222
// (minor and older changes stripped away, please see git history for details)
2323
// 2022-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
24+
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
2425
// 2022-03-22: Inputs: Fix mouse position issues when dragging outside of boundaries. SDL_CaptureMouse() erroneously still gives out LEAVE events when hovering OS decorations.
2526
// 2022-03-22: Inputs: Added support for extra mouse buttons (SDL_BUTTON_X1/SDL_BUTTON_X2).
2627
// 2022-02-04: Added SDL_Renderer* parameter to ImGui_ImplSDL2_InitForSDLRenderer(), so we can use SDL_GetRendererOutputSize() instead of SDL_GL_GetDrawableSize() when bound to a SDL_Renderer.
@@ -251,10 +252,10 @@ static ImGuiKey ImGui_ImplSDL2_KeycodeToImGuiKey(int keycode)
251252
static void ImGui_ImplSDL2_UpdateKeyModifiers(SDL_Keymod sdl_key_mods)
252253
{
253254
ImGuiIO& io = ImGui::GetIO();
254-
io.AddKeyEvent(ImGuiKey_ModCtrl, (sdl_key_mods & KMOD_CTRL) != 0);
255-
io.AddKeyEvent(ImGuiKey_ModShift, (sdl_key_mods & KMOD_SHIFT) != 0);
256-
io.AddKeyEvent(ImGuiKey_ModAlt, (sdl_key_mods & KMOD_ALT) != 0);
257-
io.AddKeyEvent(ImGuiKey_ModSuper, (sdl_key_mods & KMOD_GUI) != 0);
255+
io.AddKeyEvent(ImGuiMod_Ctrl, (sdl_key_mods & KMOD_CTRL) != 0);
256+
io.AddKeyEvent(ImGuiMod_Shift, (sdl_key_mods & KMOD_SHIFT) != 0);
257+
io.AddKeyEvent(ImGuiMod_Alt, (sdl_key_mods & KMOD_ALT) != 0);
258+
io.AddKeyEvent(ImGuiMod_Super, (sdl_key_mods & KMOD_GUI) != 0);
258259
}
259260

260261
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.

backends/imgui_impl_win32.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ typedef DWORD (WINAPI *PFN_XInputGetState)(DWORD, XINPUT_STATE*);
3636
// CHANGELOG
3737
// (minor and older changes stripped away, please see git history for details)
3838
// 2022-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
39-
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago)with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
39+
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
40+
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
4041
// 2021-01-20: Inputs: calling new io.AddKeyAnalogEvent() for gamepad support, instead of writing directly to io.NavInputs[].
4142
// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
4243
// 2022-01-17: Inputs: always update key mods next and before a key event (not in NewFrame) to fix input queue with very low framerates.
@@ -254,10 +255,10 @@ static void ImGui_ImplWin32_ProcessKeyEventsWorkarounds()
254255
static void ImGui_ImplWin32_UpdateKeyModifiers()
255256
{
256257
ImGuiIO& io = ImGui::GetIO();
257-
io.AddKeyEvent(ImGuiKey_ModCtrl, IsVkDown(VK_CONTROL));
258-
io.AddKeyEvent(ImGuiKey_ModShift, IsVkDown(VK_SHIFT));
259-
io.AddKeyEvent(ImGuiKey_ModAlt, IsVkDown(VK_MENU));
260-
io.AddKeyEvent(ImGuiKey_ModSuper, IsVkDown(VK_APPS));
258+
io.AddKeyEvent(ImGuiMod_Ctrl, IsVkDown(VK_CONTROL));
259+
io.AddKeyEvent(ImGuiMod_Shift, IsVkDown(VK_SHIFT));
260+
io.AddKeyEvent(ImGuiMod_Alt, IsVkDown(VK_MENU));
261+
io.AddKeyEvent(ImGuiMod_Super, IsVkDown(VK_APPS));
261262
}
262263

263264
// This code supports multi-viewports (multiple OS Windows mapped into different Dear ImGui viewports)

docs/CHANGELOG.txt

+19
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,20 @@ Other changes:
104104

105105
Breaking changes:
106106

107+
- Renamed and merged keyboard modifiers key enums and flags into a same set: (#4921, #456)
108+
- ImGuiKey_ModCtrl and ImGuiModFlags_Ctrl -> ImGuiMod_Ctrl
109+
- ImGuiKey_ModShift and ImGuiModFlags_Shift -> ImGuiMod_Shift
110+
- ImGuiKey_ModAlt and ImGuiModFlags_Alt -> ImGuiMod_Alt
111+
- ImGuiKey_ModSuper and ImGuiModFlags_Super -> ImGuiMod_Super
112+
Kept inline redirection enums (will obsolete).
113+
This change simplifies a few things, reduces confusion, and will facilitate upcoming
114+
shortcut/input ownership apis.
115+
- The ImGuiKey_ModXXX were introduced in 1.87 and mostly used by backends.
116+
- The ImGuiModFlags_XXX have been exposed in imgui.h but not really used by any public api,
117+
only by third-party extensions. They were however subject to a recent rename
118+
(ImGuiKeyModFlags_XXX -> ImGuiModFlags_XXX) and we are exceptionally commenting out
119+
the older ImGuiKeyModFlags_XXX names ahead of obsolescence schedule to reduce confusion
120+
and because they were not meant to be used anyway.
107121
- Removed io.NavInputs[] and ImGuiNavInput enum that were used to feed gamepad inputs.
108122
Basically 1.87 already obsoleted them from the backend's point of view, but internally
109123
our navigation code still used this array and enum, so they were still present.
@@ -158,8 +172,11 @@ Other Changes:
158172
Enter keep the input active and select all text.
159173
- InputText: numerical fields automatically accept full-width characters (U+FF01..U+FF5E)
160174
by converting them to half-width (U+0021..U+007E).
175+
- InputText: added ImGuiInputTextFlags_EscapeClearsAll flag: first press on Escape clears
176+
text if any, second press deactivate the InputText(). (#5688)
161177
- InputText: added support for shift+click style selection. (#5619) [@procedural]
162178
- InputText: clarified that callbacks cannot modify buffer when using the ReadOnly flag.
179+
- InputText: fixed minor one-frame selection glitch when reverting with Escape.
163180
- IsItemHovered: Added ImGuiHoveredFlags_DelayNormal and ImGuiHoveredFlags_DelayShort flags,
164181
allowing to introduce a shared delay for tooltip idioms. The delays are respectively
165182
io.HoverDelayNormal (default to 0.30f) and io.HoverDelayFast (default to 0.10f). (#1485)
@@ -174,6 +191,7 @@ Other Changes:
174191
bar boundaries (bug in 1.88). (#5652).
175192
- Tabs: Enforcing minimum size of 1.0f, fixed asserting on zero-tab widths. (#5572)
176193
- Window: Fixed a potential crash when appending to a child window. (#5515, #3496, #4797) [@rokups]
194+
- IO: Added ImGuiMod_Shortcut which is ImGuiMod_Super on Mac and ImGuiMod_Ctrl otherwise. (#456)
177195
- IO: Added ImGuiKey_MouseXXX aliases for mouse buttons/wheel so all operations done on ImGuiKey
178196
can apply to mouse data as well. (#4921)
179197
- Menus: Fixed incorrect sub-menu parent association when opening a menu by closing another.
@@ -186,6 +204,7 @@ Other Changes:
186204
- Nav: Fixed an issue opening a menu with Right key from a non-menu window.
187205
- Platform IME: [Windows] Removed call to ImmAssociateContextEx() leading to freeze on some setups.
188206
(#2589, #5535, #5264, #4972)
207+
- Misc: ImGuiKey is now a typed enum, allowing ImGuiKey_XXX symbols to be named in debuggers. (#4921)
189208
- Misc: better error reporting for PopStyleColor()/PopStyleVar() + easier to recover. (#1651)
190209
- Misc: io.Framerate moving average now converge in 60 frames instead of 120. (#5236, #4138)
191210
- Debug Tools: Debug Log: Added 'IO' and 'Clipper' events logging.

0 commit comments

Comments
 (0)