1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-17 01:04:19 +00:00

Merge branch 'master' into docking (wanted for #4468, #3381, #2981, #4825, #4832, #5127)

# Conflicts:
#	backends/imgui_impl_opengl3.cpp
This commit is contained in:
ocornut 2022-05-30 15:26:12 +02:00
commit 7b5a8e4f2b
12 changed files with 233 additions and 84 deletions

View file

@ -408,7 +408,7 @@ CODE
- 2022/01/10 (1.87) - inputs: reworked keyboard IO. Removed io.KeyMap[], io.KeysDown[] in favor of calling io.AddKeyEvent(). Removed GetKeyIndex(), now unecessary. All IsKeyXXX() functions now take ImGuiKey values. All features are still functional until IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Read Changelog and Release Notes for details.
- IsKeyPressed(MY_NATIVE_KEY_XXX) -> use IsKeyPressed(ImGuiKey_XXX)
- IsKeyPressed(GetKeyIndex(ImGuiKey_XXX)) -> use IsKeyPressed(ImGuiKey_XXX)
- Backend writing to io.KeyMap[],io.KeysDown[] -> backend should call io.AddKeyEvent()
- Backend writing to io.KeyMap[],io.KeysDown[] -> backend should call io.AddKeyEvent() (+ call io.SetKeyEventNativeData() if you want legacy user code to stil function with legacy key codes).
- Backend writing to io.KeyCtrl, io.KeyShift.. -> backend should call io.AddKeyEvent() with ImGuiKey_ModXXX values. *IF YOU PULLED CODE BETWEEN 2021/01/10 and 2021/01/27: We used to have a io.AddKeyModsEvent() function which was now replaced by io.AddKeyEvent() with ImGuiKey_ModXXX values.*
- one case won't work with backward compatibility: if your custom backend used ImGuiKey as mock native indices (e.g. "io.KeyMap[ImGuiKey_A] = ImGuiKey_A") because those values are now larger than the legacy KeyDown[] array. Will assert.
- inputs: added ImGuiKey_ModCtrl/ImGuiKey_ModShift/ImGuiKey_ModAlt/ImGuiKey_ModSuper values to submit keyboard modifiers using io.AddKeyEvent(), instead of writing directly to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper.
@ -8035,7 +8035,6 @@ void ImGui::PushOverrideID(ImGuiID id)
ImGuiID ImGui::GetIDWithSeed(const char* str, const char* str_end, ImGuiID seed)
{
ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
KeepAliveID(id);
ImGuiContext& g = *GImGui;
if (g.DebugHookIdInfo == id)
DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
@ -8366,16 +8365,16 @@ void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type)
g.MouseCursor = cursor_type;
}
void ImGui::CaptureKeyboardFromApp(bool capture)
void ImGui::SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard)
{
ImGuiContext& g = *GImGui;
g.WantCaptureKeyboardNextFrame = capture ? 1 : 0;
g.WantCaptureKeyboardNextFrame = want_capture_keyboard ? 1 : 0;
}
void ImGui::CaptureMouseFromApp(bool capture)
void ImGui::SetNextFrameWantCaptureMouse(bool want_capture_mouse)
{
ImGuiContext& g = *GImGui;
g.WantCaptureMouseNextFrame = capture ? 1 : 0;
g.WantCaptureMouseNextFrame = want_capture_mouse ? 1 : 0;
}
static const char* GetInputSourceName(ImGuiInputSource source)
@ -8449,7 +8448,7 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs)
if (e->MouseWheel.WheelX != 0.0f || e->MouseWheel.WheelY != 0.0f)
{
// Trickling Rule: Stop processing queued events if we got multiple action on the event
if (trickle_fast_inputs && (mouse_wheeled || mouse_button_changed != 0))
if (trickle_fast_inputs && (mouse_moved || mouse_button_changed != 0))
break;
io.MouseWheelH += e->MouseWheel.WheelX;
io.MouseWheel += e->MouseWheel.WheelY;
@ -12318,7 +12317,8 @@ void ImGui::LoadIniSettingsFromDisk(const char* ini_filename)
char* file_data = (char*)ImFileLoadToMemory(ini_filename, "rb", &file_data_size);
if (!file_data)
return;
LoadIniSettingsFromMemory(file_data, (size_t)file_data_size);
if (file_data_size > 0)
LoadIniSettingsFromMemory(file_data, (size_t)file_data_size);
IM_FREE(file_data);
}