Skip to content

Commit

Permalink
update to dear imgui 1.90.9
Browse files Browse the repository at this point in the history
• Add Col_Tab{SelectedOverline,DimmedSelectedOverline} and TabBarFlags_DrawSelectedOverline
• Add ConfigFlags_NoKeyboard
• Add SliderFlags_WrapAround
• Add TableGetHoveredColumn
• Rename Col_TabActive to _TabSelected, _TabUnfocused to _TabDimmed and TabUnfocusedActive to _TabDimmedSelected
• Rename DragDropFlags_SourceAutoExpirePayload to _PayloadAutoExpire
• Replace WindowFlags_NavFlattened with ChildFlags_NavFlattened
  • Loading branch information
cfillion committed Jul 4, 2024
1 parent c0438a5 commit 369071e
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 46 deletions.
5 changes: 4 additions & 1 deletion api/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,13 @@ API_ENUM(0_8, ImGui, ConfigFlags_NavNoCaptureKeyboard,
R"(Instruct navigation to not capture global keyboard input when
ConfigFlags_NavEnableKeyboard is set (see SetNextFrameWantCaptureKeyboard).)");
API_ENUM(0_1, ImGui, ConfigFlags_NoMouse,
"Instruct imgui to ignore mouse position/buttons.");
"Instruct dear imgui to disable mouse inputs and interactions");
API_ENUM(0_1, ImGui, ConfigFlags_NoMouseCursorChange,
"Instruct backend to not alter mouse cursor shape and visibility.");
API_ENUM(0_5, ImGui, ConfigFlags_DockingEnable, "Enable docking functionality.");
API_ENUM(0_9_2, ImGui, ConfigFlags_NoKeyboard,
R"(Instruct dear imgui to disable keyboard inputs and interactions.
This is done by ignoring keyboard events and clearing existing states.)");

API_ENUM(0_4, ReaImGui, ConfigFlags_NoSavedSettings,
"Disable state restoration and persistence for the whole context.");
2 changes: 1 addition & 1 deletion api/dragndrop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ API_ENUM(0_1, ImGui, DragDropFlags_SourceExtern,
R"(External source (from outside of dear imgui), won't attempt to read current
item/window info. Will always return true.
Only one Extern source can be active simultaneously.)");
API_ENUM(0_1, ImGui, DragDropFlags_SourceAutoExpirePayload,
API_ENUM(0_9_2, ImGui, DragDropFlags_PayloadAutoExpire,
R"(Automatically expire the payload if the source cease to be submitted
(otherwise payloads are persisting while being dragged).)");
API_SECTION_P(flags, "Payload", "For AcceptDragDropPayload");
Expand Down
8 changes: 5 additions & 3 deletions api/drawlist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@
#include "../src/context.hpp"

struct DrawListProxy : ResourceProxy<DrawListProxy, Context, ImDrawList> {
using GetterFuncType = ImDrawList*(*)();
template<Key KeyValue, GetterFuncType GetterFunc>
template<Key KeyValue, auto GetterFunc>
struct Getter {
static constexpr Key key { KeyValue };
static auto get(Context *ctx)
{
assertFrame(ctx);
return GetterFunc();
if constexpr(std::is_same_v<decltype(GetterFunc), ImDrawList*(*)(ImGuiViewport *)>)
return GetterFunc(nullptr);
else
return GetterFunc();
}
};

Expand Down
5 changes: 5 additions & 0 deletions api/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ API_FUNC(0_5_5, void, BeginDisabled, (Context*,ctx)
R"(Disable all user interactions and dim items visuals
(applying StyleVar_DisabledAlpha over current colors).

Those can be nested but it cannot be used to enable an already disabled section
(a single BeginDisabled(true) in the stack is enough to keep everything disabled).

Tooltips windows by exception are opted out of disabling.

BeginDisabled(false) essentially does nothing useful but is provided to
facilitate use of boolean expressions.
If you can avoid calling BeginDisabled(false)/EndDisabled() best to avoid it.)")
Expand Down
3 changes: 3 additions & 0 deletions api/slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,3 +485,6 @@ R"(Disable rounding underlying value to match precision of the display format
string (e.g. %.3f values are rounded to those 3 digits).)");
API_ENUM(0_1, ImGui, SliderFlags_NoInput,
"Disable CTRL+Click or Enter key allowing to input text directly into the widget.");
API_ENUM(0_9_2, ImGui, SliderFlags_WrapAround,
R"(Enable wrapping around from max to min and from min to max
(only supported by DragXXX() functions for now).)");
17 changes: 12 additions & 5 deletions api/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,19 @@ API_ENUM(0_1, ImGui, Col_ResizeGrip,
"Resize grip in lower-right and lower-left corners of windows.");
API_ENUM(0_1, ImGui, Col_ResizeGripHovered, "");
API_ENUM(0_1, ImGui, Col_ResizeGripActive, "");
API_ENUM(0_1, ImGui, Col_TabHovered, "Tab background, when hovered");
API_ENUM(0_1, ImGui, Col_Tab,
"TabItem in a TabBar");
API_ENUM(0_1, ImGui, Col_TabHovered, "");
API_ENUM(0_1, ImGui, Col_TabActive, "");
API_ENUM(0_1, ImGui, Col_TabUnfocused, "");
API_ENUM(0_1, ImGui, Col_TabUnfocusedActive, "");
"Tab background, when tab-bar is focused & tab is unselected");
API_ENUM(0_9_2, ImGui, Col_TabSelected,
"Tab background, when tab-bar is focused & tab is selected");
API_ENUM(0_9_2, ImGui, Col_TabSelectedOverline,
"Tab horizontal overline, when tab-bar is focused & tab is selected");
API_ENUM(0_9_2, ImGui, Col_TabDimmed,
"Tab background, when tab-bar is unfocused & tab is unselected");
API_ENUM(0_9_2, ImGui, Col_TabDimmedSelected,
"Tab background, when tab-bar is unfocused & tab is selected");
API_ENUM(0_9_2, ImGui, Col_TabDimmedSelectedOverline,
"Horizontal overline, when tab-bar is unfocused & tab is selected");
API_ENUM(0_5, ImGui, Col_DockingPreview,
"Preview overlay color when about to docking something.");
API_ENUM(0_5, ImGui, Col_DockingEmptyBg,
Expand Down
2 changes: 2 additions & 0 deletions api/tabbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ R"(Disable scrolling buttons (apply when fitting policy is
TabBarFlags_FittingPolicyScroll).)");
API_ENUM(0_1, ImGui, TabBarFlags_NoTooltip,
"Disable tooltips when hovering a tab.");
API_ENUM(0_9_2, ImGui, TabBarFlags_DrawSelectedOverline,
"Draw selected overline markers over selected tab");
API_ENUM(0_1, ImGui, TabBarFlags_FittingPolicyResizeDown,
"Resize tabs when they don't fit.");
API_ENUM(0_1, ImGui, TabBarFlags_FittingPolicyScroll,
Expand Down
14 changes: 12 additions & 2 deletions api/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ The typical call flow is:
)");

API_FUNC(0_9, bool, BeginTable, (Context*,ctx)
(const char*,str_id) (int,column) (RO<int*>,flags,ImGuiTableFlags_None)
(const char*,str_id) (int,columns) (RO<int*>,flags,ImGuiTableFlags_None)
(RO<double*>,outer_size_w,0.0) (RO<double*>,outer_size_h,0.0)
(RO<double*>,inner_width,0.0),
"")
{
FRAME_GUARD;

return ImGui::BeginTable(str_id, column, API_GET(flags),
return ImGui::BeginTable(str_id, columns, API_GET(flags),
ImVec2(API_GET(outer_size_w), API_GET(outer_size_h)),
API_GET(inner_width));
}
Expand Down Expand Up @@ -214,6 +214,16 @@ TableFlags_ContextMenuInBody).
ImGui::TableSetColumnEnabled(column_n, v);
}
API_FUNC(0_9_2, int, TableGetHoveredColumn, (Context*,ctx),
R"(Returns hovered column or -1 when table is not hovered. Returns columns_count
if the unused space at the right of visible columns is hovered.
Can also use (TableGetColumnFlags() & TableColumnFlags_IsHovered) instead.)")
{
FRAME_GUARD;
return ImGui::TableGetHoveredColumn();
}
API_SECTION_DEF(columnFlags, columns, "Column Flags", "For TableSetupColumn.");
API_ENUM(0_1, ImGui, TableColumnFlags_None, "");
API_SECTION_P(columnFlags, "Input Configuration");
Expand Down
12 changes: 6 additions & 6 deletions api/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,12 @@ R"(Combined with AutoResizeX/AutoResizeY. Always measure size even when child
is hidden, always return true, always disable clipping optimization! NOT RECOMMENDED.)");
API_ENUM(0_9, ImGui, ChildFlags_FrameStyle,
R"(Style the child window like a framed item: use Col_FrameBg,
StyleVar_FrameRounding, StyleVar_FrameBorderSize, StyleVar_FramePadding instead
of Col_ChildBg, StyleVar_ChildRounding, StyleVar_ChildBorderSize,
StyleVar_WindowPadding.)");
StyleVar_FrameRounding, StyleVar_FrameBorderSize, StyleVar_FramePadding
instead of Col_ChildBg, StyleVar_ChildRounding, StyleVar_ChildBorderSize,
StyleVar_WindowPadding.)");
API_ENUM(0_9_2, ImGui, ChildFlags_NavFlattened,
R"(Share focus scope, allow gamepad/keyboard navigation to cross over parent
border to this child or between sibling child windows.)");

API_SECTION_DEF(properties, ROOT_SECTION, "Properties",
R"(Prefer using SetNextWindow* functions (before Begin) rather that SetWindow* functions
Expand Down Expand Up @@ -732,9 +735,6 @@ R"(WindowFlags_NoTitleBar | WindowFlags_NoResize | WindowFlags_NoScrollbar |
WindowFlags_NoCollapse)");
API_ENUM(0_1, ImGui, WindowFlags_NoInputs,
"WindowFlags_NoMouseInputs | WindowFlags_NoNavInputs | WindowFlags_NoNavFocus");
API_ENUM(0_9_2, ImGui, WindowFlags_NavFlattened,
R"(On child window: share focus scope, allow gamepad/keyboard navigation to
cross over parent border to this child or between sibling child windows.)");

API_ENUM(0_5_5, ReaImGui, WindowFlags_TopMost,
"Show the window above all non-topmost windows.");
51 changes: 32 additions & 19 deletions examples/demo.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Lua/ReaImGui port of Dear ImGui's C++ demo code (v1.90.8)
-- Lua/ReaImGui port of Dear ImGui's C++ demo code (v1.90.9)

--[[
This file can be imported in other scripts to help during development:
Expand Down Expand Up @@ -56,6 +56,7 @@ local ImGui = require 'imgui' '0.9.2'

local ctx, clipper
local FLT_MIN, FLT_MAX = ImGui.NumericLimits_Float()
local DBL_MIN, DBL_MAX = ImGui.NumericLimits_Double()
local IMGUI_VERSION, IMGUI_VERSION_NUM, REAIMGUI_VERSION = ImGui.GetVersion()

local demo = {
Expand Down Expand Up @@ -419,18 +420,23 @@ function demo.ShowDemoWindow(open)
rv,config.flags = ImGui.CheckboxFlags(ctx, 'ConfigFlags_NavEnableSetMousePos', config.flags, ImGui.ConfigFlags_NavEnableSetMousePos)
ImGui.SameLine(ctx); demo.HelpMarker('Instruct navigation to move the mouse cursor.')
rv,config.flags = ImGui.CheckboxFlags(ctx, 'ConfigFlags_NoMouse', config.flags, ImGui.ConfigFlags_NoMouse)
ImGui.SameLine(ctx); demo.HelpMarker('Instruct dear imgui to disable mouse inputs and interactions.')

-- The "NoMouse" option can get us stuck with a disabled mouse! Let's provide an alternative way to fix it:
if (config.flags & ImGui.ConfigFlags_NoMouse) ~= 0 then
-- The "NoMouse" option can get us stuck with a disabled mouse! Let's provide an alternative way to fix it:
if ImGui.GetTime(ctx) % 0.40 < 0.20 then
ImGui.SameLine(ctx)
ImGui.Text(ctx, '<<PRESS SPACE TO DISABLE>>')
end
if ImGui.IsKeyPressed(ctx, ImGui.Key_Space) then
-- Prevent both being checked
if ImGui.IsKeyPressed(ctx, ImGui.Key_Space) or (config.flags & ImGui.ConfigFlags_NoKeyboard) ~= 0 then
config.flags = config.flags & ~ImGui.ConfigFlags_NoMouse
end
end
rv,config.flags = ImGui.CheckboxFlags(ctx, 'ConfigFlags_NoMouseCursorChange', config.flags, ImGui.ConfigFlags_NoMouseCursorChange)
ImGui.SameLine(ctx); demo.HelpMarker('Instruct backend to not alter mouse cursor shape and visibility.')
rv,config.flags = ImGui.CheckboxFlags(ctx, 'ConfigFlags_NoKeyboard', config.flags, ImGui.ConfigFlags_NoKeyboard)
ImGui.SameLine(ctx); demo.HelpMarker('Instruct dear imgui to disable keyboard inputs and interactions.')

configVarCheckbox('ConfigVar_InputTrickleEventQueue')
ImGui.SameLine(ctx); demo.HelpMarker('Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates.')
Expand Down Expand Up @@ -682,7 +688,8 @@ function demo.ShowDemoWindowWidgets()
i0 = 123,
i1 = 50,
i2 = 42,
i3 = 0,
i3 = 128,
i4 = 0,
d0 = 999999.00000001,
d1 = 1e10,
d2 = 1.00,
Expand Down Expand Up @@ -788,15 +795,17 @@ function demo.ShowDemoWindowWidgets()
Double-click or CTRL+click to input value.')

rv,widgets.basic.i2 = ImGui.DragInt(ctx, 'drag int 0..100', widgets.basic.i2, 1, 0, 100, '%d%%', ImGui.SliderFlags_AlwaysClamp)
rv,widgets.basic.i3 = ImGui.DragInt(ctx, 'drag int wrap 100..200', widgets.basic.i3, 1, 100, 200, '%d', ImGui.SliderFlags_WrapAround)

rv,widgets.basic.d2 = ImGui.DragDouble(ctx, 'drag double', widgets.basic.d2, 0.005)
rv,widgets.basic.d3 = ImGui.DragDouble(ctx, 'drag small double', widgets.basic.d3, 0.0001, 0.0, 0.0, '%.06f ns')
-- rv,widgets.basic.d4 = ImGui.DragDouble(ctx, 'drag wrap -1..1', widgets.basic.d4, 0.005, -1.0, 1.0, nil, ImGui.SliderFlags_WrapAround)
end

ImGui.SeparatorText(ctx, 'Sliders')

do
rv,widgets.basic.i3 = ImGui.SliderInt(ctx, 'slider int', widgets.basic.i3, -1, 3)
rv,widgets.basic.i4 = ImGui.SliderInt(ctx, 'slider int', widgets.basic.i4, -1, 3)
ImGui.SameLine(ctx); demo.HelpMarker('CTRL+click to input value.')

rv,widgets.basic.d4 = ImGui.SliderDouble(ctx, 'slider double', widgets.basic.d4, 0.0, 1.0, 'ratio = %.3f')
Expand Down Expand Up @@ -944,10 +953,10 @@ function demo.ShowDemoWindowWidgets()
-- which default value include the HoveredFlags_AllowWhenDisabled flag.
ImGui.BeginDisabled(ctx)
ImGui.Button(ctx, 'Disabled item', sz_w, sz_h)
ImGui.EndDisabled(ctx)
if ImGui.IsItemHovered(ctx, ImGui.HoveredFlags_ForTooltip) then
ImGui.SetTooltip(ctx, 'I am a a tooltip for a disabled item.')
end
ImGui.EndDisabled(ctx)

ImGui.TreePop(ctx)
end
Expand Down Expand Up @@ -1858,6 +1867,7 @@ label:
rv,widgets.tabs.flags1 = ImGui.CheckboxFlags(ctx, 'TabBarFlags_AutoSelectNewTabs', widgets.tabs.flags1, ImGui.TabBarFlags_AutoSelectNewTabs)
rv,widgets.tabs.flags1 = ImGui.CheckboxFlags(ctx, 'TabBarFlags_TabListPopupButton', widgets.tabs.flags1, ImGui.TabBarFlags_TabListPopupButton)
rv,widgets.tabs.flags1 = ImGui.CheckboxFlags(ctx, 'TabBarFlags_NoCloseWithMiddleMouseButton', widgets.tabs.flags1, ImGui.TabBarFlags_NoCloseWithMiddleMouseButton)
rv,widgets.tabs.flags1 = ImGui.CheckboxFlags(ctx, 'TabBarFlags_DrawSelectedOverline', widgets.tabs.flags1, ImGui.TabBarFlags_DrawSelectedOverline)

if widgets.tabs.flags1 & fitting_policy_mask == 0 then
widgets.tabs.flags1 = widgets.tabs.flags1 | ImGui.TabBarFlags_FittingPolicyResizeDown -- was FittingPolicyDefault_
Expand All @@ -1870,9 +1880,11 @@ label:
end

-- Tab Bar
ImGui.AlignTextToFramePadding(ctx)
ImGui.Text(ctx, 'Opened:')
local names = { 'Artichoke', 'Beetroot', 'Celery', 'Daikon' }
for n,opened in ipairs(widgets.tabs.opened) do
if n > 1 then ImGui.SameLine(ctx); end
for n, opened in ipairs(widgets.tabs.opened) do
ImGui.SameLine(ctx)
rv,widgets.tabs.opened[n] = ImGui.Checkbox(ctx, names[n], opened)
end

Expand Down Expand Up @@ -2333,8 +2345,8 @@ label:
ImGui.SameLine(ctx); demo.HelpMarker('Disable rounding underlying value to match precision of the format string (e.g. %.3f values are rounded to those 3 digits).')
rv,widgets.sliders.flags = ImGui.CheckboxFlags(ctx, 'SliderFlags_NoInput', widgets.sliders.flags, ImGui.SliderFlags_NoInput)
ImGui.SameLine(ctx); demo.HelpMarker('Disable CTRL+Click or Enter key allowing to input text directly into the widget.')

local DBL_MIN, DBL_MAX = 2.22507e-308, 1.79769e+308
rv,widgets.sliders.flags = ImGui.CheckboxFlags(ctx, 'SliderFlags_WrapAround', widgets.sliders.flags, ImGui.SliderFlags_WrapAround)
ImGui.SameLine(ctx); demo.HelpMarker('Enable wrapping around from max to min and from min to max (only supported by DragXXX() functions)')

-- Drags
ImGui.Text(ctx, ('Underlying double value: %f'):format(widgets.sliders.drag_d))
Expand All @@ -2345,9 +2357,10 @@ label:
rv,widgets.sliders.drag_i = ImGui.DragInt(ctx, 'DragInt (0 -> 100)', widgets.sliders.drag_i, 0.5, 0, 100, '%d', widgets.sliders.flags)

-- Sliders
local flags_for_sliders = widgets.sliders.flags & ~ImGui.SliderFlags_WrapAround
ImGui.Text(ctx, ('Underlying float value: %f'):format(widgets.sliders.slider_d))
rv,widgets.sliders.slider_d = ImGui.SliderDouble(ctx, 'SliderDouble (0 -> 1)', widgets.sliders.slider_d, 0.0, 1.0, '%.3f', widgets.sliders.flags)
rv,widgets.sliders.slider_i = ImGui.SliderInt(ctx, 'SliderInt (0 -> 100)', widgets.sliders.slider_i, 0, 100, '%d', widgets.sliders.flags)
rv,widgets.sliders.slider_d = ImGui.SliderDouble(ctx, 'SliderDouble (0 -> 1)', widgets.sliders.slider_d, 0.0, 1.0, '%.3f', flags_for_sliders)
rv,widgets.sliders.slider_i = ImGui.SliderInt(ctx, 'SliderInt (0 -> 100)', widgets.sliders.slider_i, 0, 100, '%d', flags_for_sliders)

ImGui.TreePop(ctx)
end
Expand Down Expand Up @@ -7181,10 +7194,8 @@ function demo.ShowStyleEditor()
Right-click to open edit options menu.')

ImGui.SetNextWindowSizeConstraints(ctx, 0.0, ImGui.GetTextLineHeightWithSpacing(ctx) * 10, FLT_MAX, FLT_MAX)
if ImGui.BeginChild(ctx, '##colors', 0, 0, ImGui.ChildFlags_Border,
ImGui.WindowFlags_AlwaysVerticalScrollbar |
ImGui.WindowFlags_AlwaysHorizontalScrollbar |
ImGui.WindowFlags_NavFlattened) then
if ImGui.BeginChild(ctx, '##colors', 0, 0, ImGui.ChildFlags_Border | ImGui.ChildFlags_NavFlattened,
ImGui.WindowFlags_AlwaysVerticalScrollbar | ImGui.WindowFlags_AlwaysHorizontalScrollbar) then
ImGui.PushItemWidth(ctx, ImGui.GetFontSize(ctx) * -12)
local inner_spacing = ImGui.GetStyleVar(ctx, ImGui.StyleVar_ItemInnerSpacing)
for i, name in demo.EachEnum('Col') do
Expand Down Expand Up @@ -7268,10 +7279,10 @@ function demo.ShowStyleEditor()
-- ImGui.SetNextWindowPos(ImGui.GetCursorScreenPos());
-- if (show_samples && ImGui::BeginTooltip())
-- {
-- ImGui.TextUnformatted("(R = radius, N = number of segments)");
-- ImGui.TextUnformatted("(R = radius, N = approx number of segments)");
-- ImGui.Spacing();
-- ImDrawList* draw_list = ImGui.GetWindowDrawList();
-- const float min_widget_width = ImGui.CalcTextSize("N: MMM\nR: MMM").x;
-- const float min_widget_width = ImGui.CalcTextSize("R: MMM\nN: MMM").x;
-- for (int n = 0; n < 8; n++)
-- {
-- const float RAD_MIN = 5.0f;
Expand All @@ -7280,6 +7291,7 @@ function demo.ShowStyleEditor()
--
-- ImGui.BeginGroup();
--
-- // N is not always exact here due to how PathArcTo() function work internally
-- ImGui.Text("R: %.f\nN: %d", rad, draw_list->_CalcCircleAutoSegmentCount(rad));
--
-- const float canvas_width = IM_MAX(min_widget_width, rad * 2.0f);
Expand Down Expand Up @@ -7654,7 +7666,7 @@ function ExampleAppConsole:Draw(title)

-- Reserve enough left-over height for 1 separator + 1 input text
local footer_height_to_reserve = select(2, ImGui.GetStyleVar(self.ctx, ImGui.StyleVar_ItemSpacing)) + ImGui.GetFrameHeightWithSpacing(self.ctx)
if ImGui.BeginChild(self.ctx, 'ScrollingRegion', 0, -footer_height_to_reserve, ImGui.ChildFlags_None, ImGui.WindowFlags_HorizontalScrollbar | ImGui.WindowFlags_NavFlattened) then
if ImGui.BeginChild(self.ctx, 'ScrollingRegion', 0, -footer_height_to_reserve, ImGui.ChildFlags_NavFlattened, ImGui.WindowFlags_HorizontalScrollbar) then
if ImGui.BeginPopupContextWindow(self.ctx) then
if ImGui.Selectable(self.ctx, 'Clear') then self:ClearLog() end
ImGui.EndPopup(self.ctx)
Expand Down Expand Up @@ -9162,6 +9174,7 @@ end
-- if (opt_target == Target_Tab)
-- {
-- ImGuiTabBarFlags tab_bar_flags = (opt_fitting_flags) | (opt_reorderable ? ImGuiTabBarFlags_Reorderable : 0);
-- tab_bar_flags |= ImGuiTabBarFlags_DrawSelectedOverline;
-- if (ImGui::BeginTabBar("##tabs", tab_bar_flags))
-- {
-- if (opt_reorderable)
Expand Down
13 changes: 12 additions & 1 deletion shims/0.9.2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
SHIM("0.9.2",
(int, Mod_Ctrl)
(int, Mod_Super)
(int, DragDropFlags_PayloadAutoExpire)
(int, Col_TabSelected)
(int, Col_TabDimmed)
(int, Col_TabDimmedSelected)
);

// dear imgui v1.90.7 swaps Ctrl<>Super on macOS
Expand All @@ -29,5 +33,12 @@ SHIM_ALIAS(0_8, Mod_Ctrl, Mod_Super)
SHIM_ALIAS(0_8, Mod_Super, Mod_Ctrl)
#else
SHIM_ALIAS(0_8, Mod_Ctrl, Mod_Ctrl)
SHIM_ALIAS(0_8, Mod_Super, Mod_Ctrl)
SHIM_ALIAS(0_8, Mod_Super, Mod_Super)
#endif

// dear imgui v1.90.9
SHIM_ALIAS(0_1, DragDropFlags_SourceAutoExpirePayload,
DragDropFlags_PayloadAutoExpire)
SHIM_ALIAS(0_1, Col_TabActive, Col_TabSelected)
SHIM_ALIAS(0_1, Col_TabUnfocused, Col_TabDimmed)
SHIM_ALIAS(0_1, Col_TabUnfocusedActive, Col_TabDimmedSelected)
11 changes: 5 additions & 6 deletions src/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,8 @@ void Context::updateDragDrop()

void Context::dragSources()
{
constexpr ImGuiDragDropFlags flags {
ImGuiDragDropFlags_SourceExtern |
ImGuiDragDropFlags_SourceAutoExpirePayload
};
constexpr ImGuiDragDropFlags flags
{ ImGuiDragDropFlags_SourceExtern | ImGuiDragDropFlags_PayloadAutoExpire };

if(m_draggedFiles.empty())
return;
Expand Down Expand Up @@ -632,10 +630,11 @@ void Context::clearFocus()
else
ImGui::FocusWindow(nullptr); // also calls ClearActiveID

// ClearInputKeys resets MousePos to -FLT_MAX
// ClearInputMouse resets MousePos to -FLT_MAX
// Restoring it to gain focus on first click on Linux
const ImVec2 mousePos { m_imgui->IO.MousePos };
m_imgui->IO.ClearInputKeys(); // clears keyboard and mouse
m_imgui->IO.ClearInputKeys();
m_imgui->IO.ClearInputMouse();
m_imgui->IO.MousePos = mousePos;

HWND capture { Platform::getCapture() };
Expand Down
Loading

0 comments on commit 369071e

Please sign in to comment.