From 2c7324da56fc4ceec73eeb603c4222c9ff66ade7 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 25 Jan 2018 12:38:15 +0100 Subject: [PATCH 1/8] TODO list, added uSynergy README --- TODO.txt | 4 ++++ examples/libs/usynergy/README.txt | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 examples/libs/usynergy/README.txt diff --git a/TODO.txt b/TODO.txt index a9bc641e..3a6535a0 100644 --- a/TODO.txt +++ b/TODO.txt @@ -162,6 +162,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - shortcuts,menus: global-style shortcut api e.g. "Save (CTRL+S)" -> explicit flag for recursing into closed menu - shortcuts: programmatically access shortcuts "Focus("&Save")) - menus: menubars: main menu-bar could affect clamping of windows position (~ akin to modifying DisplayMin) + - menus: hovering from menu to menu on a menu-bar has 1 frame without any menu, which is a little annoying. ideally either 0 either longer. - text: selectable text (for copy) as a generic feature (ItemFlags?) - text: proper alignment options in imgui_internal.h @@ -175,6 +176,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - tree node: try to apply scrolling at time of TreePop() if node was just opened and end of node is past scrolling limits? - tree node / selectable render mismatch which is visible if you use them both next to each other (e.g. cf. property viewer) - tree node: tweak color scheme to distinguish headers from selected tree node (#581) + - tree node: leaf/non-leaf highlight mismatch. !- settings: expose enough to save/load .ini from RAM instead of fopen - settings: write more decent code to allow saving/loading new fields: columns, selected tree nodes? @@ -246,6 +248,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - misc: fix for compilation settings where stdcall isn't the default (e.g. vectorcall) (#1230) - remote: make a system like RemoteImGui first-class citizen/project (#75) + - natvis: more the imgui.natvis file in a better location. perhaps reorganize extra_fonts/? (#1569) + - demo: add vertical separator demo - demo: add virtual scrolling example? - examples: directx9: save/restore device state more thoroughly. diff --git a/examples/libs/usynergy/README.txt b/examples/libs/usynergy/README.txt new file mode 100644 index 00000000..c86b9096 --- /dev/null +++ b/examples/libs/usynergy/README.txt @@ -0,0 +1,8 @@ + +uSynergy client -- Implementation for the embedded Synergy client library +version 1.0.0, July 7th, 2012 +Copyright (c) 2012 Alex Evans + +This is a copy of the files once found at: + https://github.com/symless/synergy-core/tree/790d108a56ada9caad8e56ff777d444485a69da9/src/micro + From c226e02ca02dd42ba4ccfc0650cabba484c7366e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Pasquier?= Date: Thu, 25 Jan 2018 13:27:57 +0100 Subject: [PATCH 2/8] Fix sdl_opengl2_example filename in README.md's build instructions --- examples/sdl_opengl2_example/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/sdl_opengl2_example/README.md b/examples/sdl_opengl2_example/README.md index deae3239..a1a44a58 100644 --- a/examples/sdl_opengl2_example/README.md +++ b/examples/sdl_opengl2_example/README.md @@ -5,18 +5,18 @@ ``` set SDL2DIR=path_to_your_sdl2_folder -cl /Zi /MD /I %SDL2DIR%\include /I ..\.. main.cpp imgui_impl_sdl.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console +cl /Zi /MD /I %SDL2DIR%\include /I ..\.. main.cpp imgui_impl_sdl_gl2.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console ``` - On Linux and similar Unixes ``` -c++ `sdl2-config --cflags` -I ../.. main.cpp imgui_impl_sdl.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL -o sdl2example +c++ `sdl2-config --cflags` -I ../.. main.cpp imgui_impl_sdl_gl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL -o sdl2example ``` - On Mac OS X ``` brew install sdl2 -c++ `sdl2-config --cflags` -I ../.. main.cpp imgui_impl_sdl.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl -o sdl2example +c++ `sdl2-config --cflags` -I ../.. main.cpp imgui_impl_sdl_gl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl -o sdl2example ``` From 94ed44b5cbdeec85c3d4961c0382b7393b7b509c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Pasquier?= Date: Thu, 25 Jan 2018 13:33:35 +0100 Subject: [PATCH 3/8] Fix allegro5_example build instructions --- examples/allegro5_example/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/allegro5_example/README.md b/examples/allegro5_example/README.md index d891982b..dcd83b8a 100644 --- a/examples/allegro5_example/README.md +++ b/examples/allegro5_example/README.md @@ -4,7 +4,7 @@ - On Ubuntu 14.04+ ```bash -g++ -I ../imgui main.cpp imgui_impl_a5.cpp ../imgui/imgui*.cpp -lallegro -lallegro_primitives +g++ -I ../.. main.cpp imgui_impl_a5.cpp ../../imgui*.cpp -lallegro -lallegro_primitives -o allegro5_example ``` - On Windows with Visual Studio's CLI From 8bf0c89c0daa1189faccb7ff1c77d32180bf7bd7 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 25 Jan 2018 14:24:57 +0100 Subject: [PATCH 4/8] Internals: ImRect::Contains(ImRect&) include boundaries (whereas Contains(ImVec2) should not). --- imgui_internal.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imgui_internal.h b/imgui_internal.h index b30dde60..a00a88a0 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -273,9 +273,9 @@ struct IMGUI_API ImRect ImVec2 GetTR() const { return ImVec2(Max.x, Min.y); } // Top-right ImVec2 GetBL() const { return ImVec2(Min.x, Max.y); } // Bottom-left ImVec2 GetBR() const { return Max; } // Bottom-right - bool Contains(const ImVec2& p) const { return p.x >= Min.x && p.y >= Min.y && p.x < Max.x && p.y < Max.y; } - bool Contains(const ImRect& r) const { return r.Min.x >= Min.x && r.Min.y >= Min.y && r.Max.x < Max.x && r.Max.y < Max.y; } - bool Overlaps(const ImRect& r) const { return r.Min.y < Max.y && r.Max.y > Min.y && r.Min.x < Max.x && r.Max.x > Min.x; } + bool Contains(const ImVec2& p) const { return p.x >= Min.x && p.y >= Min.y && p.x < Max.x && p.y < Max.y; } + bool Contains(const ImRect& r) const { return r.Min.x >= Min.x && r.Min.y >= Min.y && r.Max.x <= Max.x && r.Max.y <= Max.y; } + bool Overlaps(const ImRect& r) const { return r.Min.y < Max.y && r.Max.y > Min.y && r.Min.x < Max.x && r.Max.x > Min.x; } void Add(const ImVec2& p) { if (Min.x > p.x) Min.x = p.x; if (Min.y > p.y) Min.y = p.y; if (Max.x < p.x) Max.x = p.x; if (Max.y < p.y) Max.y = p.y; } void Add(const ImRect& r) { if (Min.x > r.Min.x) Min.x = r.Min.x; if (Min.y > r.Min.y) Min.y = r.Min.y; if (Max.x < r.Max.x) Max.x = r.Max.x; if (Max.y < r.Max.y) Max.y = r.Max.y; } void Expand(const float amount) { Min.x -= amount; Min.y -= amount; Max.x += amount; Max.y += amount; } From 5d31e1696f83601ae1b323dc4e51d532c4eb238a Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 25 Jan 2018 15:37:24 +0100 Subject: [PATCH 5/8] Fix SetNextWindowContentSize() with 0.0f on Y axis (or SetNextWindowContentWidth()) overwriting the contents size. Broken in eab6333a0b96bd30413bb17408303a5df438ffde. (#1363) --- imgui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index b5aa30e1..076eb4b5 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4544,7 +4544,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) { // Adjust passed "client size" to become a "window size" window->SizeContentsExplicit = g.NextWindowData.ContentSizeVal; - window->SizeContentsExplicit.y += window->TitleBarHeight() + window->MenuBarHeight(); + if (window->SizeContentsExplicit.y != 0.0f) + window->SizeContentsExplicit.y += window->TitleBarHeight() + window->MenuBarHeight(); g.NextWindowData.ContentSizeCond = 0; } else if (first_begin_of_the_frame) From 486f0a8ba0eda020d912b2058f13c30e74a77aa2 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 25 Jan 2018 19:07:35 +0100 Subject: [PATCH 6/8] Fixed potential warning (forward declaration and definition didn't match signature. forward declaration only here for consistency) --- imgui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 076eb4b5..c8944d68 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2838,9 +2838,9 @@ static int ChildWindowComparer(const void* lhs, const void* rhs) return (a->BeginOrderWithinParent - b->BeginOrderWithinParent); } -static void AddWindowToSortedBuffer(ImVector& out_sorted_windows, ImGuiWindow* window) +static void AddWindowToSortedBuffer(ImVector* out_sorted_windows, ImGuiWindow* window) { - out_sorted_windows.push_back(window); + out_sorted_windows->push_back(window); if (window->Active) { int count = window->DC.ChildWindows.Size; @@ -3031,7 +3031,7 @@ void ImGui::EndFrame() ImGuiWindow* window = g.Windows[i]; if (window->Active && (window->Flags & ImGuiWindowFlags_ChildWindow)) // if a child is active its parent will add it continue; - AddWindowToSortedBuffer(g.WindowsSortBuffer, window); + AddWindowToSortedBuffer(&g.WindowsSortBuffer, window); } IM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size); // we done something wrong From 1f3b66b10a96beca79603400bd9b80b0ae40c13c Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 26 Jan 2018 11:38:25 +0100 Subject: [PATCH 7/8] Scrollbar: Fix ScrollbarX enable test subtracting WindowPadding.x. This has been here since 65a191c0050ca2a8360a25ca23403843cd3bdba2 (#246) tho at the time it is possible that SizeContents wasn't calculated as evenly. Test: auto-resize with: ImGui::Begin("Test", NULL, ImGuiWindowFlags_HorizontalScrollbar); ImGui::Button("##xxx", ImVec2(500,500)); ImGui::End(); --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index c8944d68..c14bcdba 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4670,7 +4670,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) float size_x_for_scrollbars = size_full_modified.x != FLT_MAX ? window->SizeFull.x : window->SizeFullAtLastBegin.x; float size_y_for_scrollbars = size_full_modified.y != FLT_MAX ? window->SizeFull.y : window->SizeFullAtLastBegin.y; window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((window->SizeContents.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar)); - window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > size_x_for_scrollbars - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar)); + window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > size_x_for_scrollbars - (window->ScrollbarY ? style.ScrollbarSize : 0.0f)) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar)); if (window->ScrollbarX && !window->ScrollbarY) window->ScrollbarY = (window->SizeContents.y > size_y_for_scrollbars + style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar); window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f); From 2d9d7a10caa6d043e880ff9041152fcd44cd6c92 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 26 Jan 2018 11:42:18 +0100 Subject: [PATCH 8/8] Scrollbar: Fix for ScrollbarY enable check after ScrollbarX has been enabled. (#1574) Looks like a bug introduced in c36e586cce1279b419ab4b443ca6ce63b03ce7cc. --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index c14bcdba..8a08918b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4672,7 +4672,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((window->SizeContents.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar)); window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > size_x_for_scrollbars - (window->ScrollbarY ? style.ScrollbarSize : 0.0f)) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar)); if (window->ScrollbarX && !window->ScrollbarY) - window->ScrollbarY = (window->SizeContents.y > size_y_for_scrollbars + style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar); + window->ScrollbarY = (window->SizeContents.y > size_y_for_scrollbars - style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar); window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f); }