From 8342e5b91a26a5def2db8bcb3c5e601adb1aec8e Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 5 Dec 2019 15:43:05 +0100 Subject: [PATCH] Amend previous commits (added ImGuiMouseCursor_NotAllowed enum + new cursors in GLFW 3.4) Amend b5cad20d79330c1d73636fb6beb4a1f55f2f0743, 945a5097734265baf4db188fb9dfa2093733bb91 + unrelated minor typos --- docs/CHANGELOG.txt | 5 +++++ docs/TODO.txt | 1 - examples/imgui_impl_allegro5.cpp | 1 + examples/imgui_impl_glfw.cpp | 5 +++-- examples/imgui_impl_osx.mm | 1 + examples/imgui_impl_sdl.cpp | 1 + examples/imgui_impl_win32.cpp | 1 + imgui.cpp | 2 +- imgui_demo.cpp | 2 +- imgui_draw.cpp | 2 +- 10 files changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 451ad93fc..7ba017bf9 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -33,6 +33,11 @@ HOW TO UPDATE? VERSION 1.75 WIP (In Progress) ----------------------------------------------------------------------- +Other Changes: +- Misc: Added ImGuiMouseCursor_NotAllowed enum so it can be used by more shared widgets. [@rokups] +- Backends: GLFW, SDL, Win32, OSX, Allegro: Added support for ImGuiMouseCursor_NotAllowed. [@rokups] +- Backends: GLFW: Added support for the missing mouse cursors newly added in GLFW 3.4+. [@rokups] + ----------------------------------------------------------------------- VERSION 1.74 (Released 2019-11-25) diff --git a/docs/TODO.txt b/docs/TODO.txt index 94fc2ec8a..e37af88a9 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -340,7 +340,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - inputs: support track pad style scrolling & slider edit. - inputs/io: backspace and arrows in the context of a text input could use system repeat rate. - inputs/io: clarify/standardize/expose repeat rate and repeat delays (#1808) - - inputs: add mouse cursor for unavailable/no? IDC_NO/SDL_SYSTEM_CURSOR_NO. - inputs/scrolling: support for smooth scrolling (#2462, #2569) - misc: idle: expose "woken up" boolean (set by inputs) and/or animation time (for cursor blink) for back-end to be able stop refreshing easily. diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp index d856d28bd..76f74a3fa 100644 --- a/examples/imgui_impl_allegro5.cpp +++ b/examples/imgui_impl_allegro5.cpp @@ -15,6 +15,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor. // 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter. // 2019-05-11: Inputs: Don't filter character value from ALLEGRO_EVENT_KEY_CHAR before calling AddInputCharacter(). // 2019-04-30: Renderer: Added support for special ImDrawCallback_ResetRenderState callback to reset render state. diff --git a/examples/imgui_impl_glfw.cpp b/examples/imgui_impl_glfw.cpp index 8918440a4..fd70bad59 100644 --- a/examples/imgui_impl_glfw.cpp +++ b/examples/imgui_impl_glfw.cpp @@ -6,7 +6,7 @@ // Implemented features: // [X] Platform: Clipboard support. // [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. -// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW. +// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange' (note: the resizing cursors requires GLFW 3.4+). // [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE). // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. @@ -15,6 +15,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2019-12-05: Inputs: Added support for new mouse cursors added in GLFW 3.4+ (resizing cursors, not allowed cursor). // 2019-10-18: Misc: Previously installed user callbacks are now restored on shutdown. // 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter. // 2019-05-11: Inputs: Don't filter value from character callback before calling AddInputCharacter(). @@ -50,7 +51,7 @@ #define GLFW_HAS_WINDOW_ALPHA (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwSetWindowOpacity #define GLFW_HAS_PER_MONITOR_DPI (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwGetMonitorContentScale #define GLFW_HAS_VULKAN (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ glfwCreateWindowSurface -#define GLFW_HAS_NEW_CURSORS (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3400) // 3.4+ GLFW_RESIZE_ALL_CURSOR, GLFW_RESIZE_NESW_CURSOR, GLFW_RESIZE +#define GLFW_HAS_NEW_CURSORS (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3400) // 3.4+ GLFW_RESIZE_ALL_CURSOR, GLFW_RESIZE_NESW_CURSOR, GLFW_RESIZE_NWSE_CURSOR, GLFW_NOT_ALLOWED_CURSOR // Data enum GlfwClientApi diff --git a/examples/imgui_impl_osx.mm b/examples/imgui_impl_osx.mm index 3fbebacdb..54b23d070 100644 --- a/examples/imgui_impl_osx.mm +++ b/examples/imgui_impl_osx.mm @@ -14,6 +14,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor. // 2019-10-11: Inputs: Fix using Backspace key. // 2019-07-21: Re-added clipboard handlers as they are not enabled by default in core imgui.cpp (reverted 2019-05-18 change). // 2019-05-28: Inputs: Added mouse cursor shape and visibility support. diff --git a/examples/imgui_impl_sdl.cpp b/examples/imgui_impl_sdl.cpp index fcbe9a7f6..05498c092 100644 --- a/examples/imgui_impl_sdl.cpp +++ b/examples/imgui_impl_sdl.cpp @@ -17,6 +17,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor. // 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter. // 2019-04-23: Inputs: Added support for SDL_GameController (if ImGuiConfigFlags_NavEnableGamepad is set by user application). // 2019-03-12: Misc: Preserve DisplayFramebufferScale when main window is minimized. diff --git a/examples/imgui_impl_win32.cpp b/examples/imgui_impl_win32.cpp index 2c2034bb7..ffe1e8bf7 100644 --- a/examples/imgui_impl_win32.cpp +++ b/examples/imgui_impl_win32.cpp @@ -18,6 +18,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor. // 2019-05-11: Inputs: Don't filter value from WM_CHAR before calling AddInputCharacter(). // 2019-01-17: Misc: Using GetForegroundWindow()+IsChild() instead of GetActiveWindow() to be compatible with windows created in a different thread or parent. // 2019-01-17: Inputs: Added support for mouse buttons 4 and 5 via WM_XBUTTON* messages. diff --git a/imgui.cpp b/imgui.cpp index 375768cd1..7cc445855 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -45,7 +45,7 @@ CODE // [SECTION] FORWARD DECLARATIONS // [SECTION] CONTEXT AND MEMORY ALLOCATORS // [SECTION] MAIN USER FACING STRUCTURES (ImGuiStyle, ImGuiIO) -// [SECTION] MISC HELPERS/UTILITIES (Geomtry, String, Format, Hash, File functions) +// [SECTION] MISC HELPERS/UTILITIES (Geometry, String, Format, Hash, File functions) // [SECTION] MISC HELPERS/UTILITIES (File functions) // [SECTION] MISC HELPERS/UTILITIES (ImText* functions) // [SECTION] MISC HELPERS/UTILITIES (Color functions) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index ca8eb262c..10171d8f1 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -3051,7 +3051,7 @@ static void ShowDemoWindowMisc() if (ImGui::TreeNode("Mouse cursors")) { - const char* mouse_cursors_names[] = { "Arrow", "TextInput", "Move", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand" }; + const char* mouse_cursors_names[] = { "Arrow", "TextInput", "ResizeAll", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand", "NotAllowed" }; IM_ASSERT(IM_ARRAYSIZE(mouse_cursors_names) == ImGuiMouseCursor_COUNT); ImGui::Text("Current mouse cursor = %d: %s", ImGui::GetMouseCursor(), mouse_cursors_names[ImGui::GetMouseCursor()]); diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 0e1b3465c..91305a2e3 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1673,7 +1673,7 @@ ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, void* data = ImFileLoadToMemory(filename, "rb", &data_size, 0); if (!data) { - IM_ASSERT_USER_ERROR(0, "Could not font load file."); + IM_ASSERT_USER_ERROR(0, "Could not load font file!"); return NULL; } ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();