mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-19 01:34:08 +01:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp
This commit is contained in:
commit
e21f462f6f
@ -693,7 +693,7 @@ static inline float Saturate(float v) { return v < 0.0f ? 0.0f : v > 1.0f ? 1.0
|
|||||||
static void ImGui_ImplGlfw_UpdateGamepads()
|
static void ImGui_ImplGlfw_UpdateGamepads()
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0) // FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
|
io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
|
||||||
|
@ -528,7 +528,7 @@ static void ImGui_ImplOSX_UpdateGamepads()
|
|||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
memset(io.NavInputs, 0, sizeof(io.NavInputs));
|
memset(io.NavInputs, 0, sizeof(io.NavInputs));
|
||||||
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0) // FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if APPLE_HAS_CONTROLLER
|
#if APPLE_HAS_CONTROLLER
|
||||||
|
@ -580,7 +580,7 @@ static void ImGui_ImplSDL2_UpdateMouseCursor()
|
|||||||
static void ImGui_ImplSDL2_UpdateGamepads()
|
static void ImGui_ImplSDL2_UpdateGamepads()
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0) // FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get gamepad
|
// Get gamepad
|
||||||
|
@ -320,8 +320,8 @@ static void ImGui_ImplWin32_UpdateGamepads()
|
|||||||
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
||||||
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
//if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0) // FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
// Calling XInputGetState() every frame on disconnected gamepads is unfortunately too slow.
|
// Calling XInputGetState() every frame on disconnected gamepads is unfortunately too slow.
|
||||||
// Instead we refresh gamepad availability by calling XInputGetCapabilities() _only_ after receiving WM_DEVICECHANGE.
|
// Instead we refresh gamepad availability by calling XInputGetCapabilities() _only_ after receiving WM_DEVICECHANGE.
|
||||||
|
@ -123,7 +123,15 @@ Other Changes:
|
|||||||
|
|
||||||
- InputText: added experimental io.ConfigInputTextEnterKeepActive feature to make pressing
|
- InputText: added experimental io.ConfigInputTextEnterKeepActive feature to make pressing
|
||||||
Enter keep the input active and select all text.
|
Enter keep the input active and select all text.
|
||||||
|
- Tables,Columns: fixed a layout issue where SameLine() prior to a row change would set the
|
||||||
|
next row in such state where subsequent SameLine() would move back to previous row.
|
||||||
|
- Tabs: Fixed a crash when closing multiple windows (possible with docking only) with an
|
||||||
|
appended TabItemButton(). (#5515, #3291) [@rokups]
|
||||||
|
- Window: Fixed a potential crash when appending to a child window. (#5515, #3496, #4797) [@rokups]
|
||||||
|
- IO: Added ImGuiKey_MouseXXX aliases for mouse buttons/wheel so all operations done on ImGuiKey
|
||||||
|
can apply to mouse data as well. (#4921)
|
||||||
- Nav: Fixed moving/resizing window with gamepad or keyboard when running at very high framerate.
|
- Nav: Fixed moving/resizing window with gamepad or keyboard when running at very high framerate.
|
||||||
|
- Nav: Pressing Space/GamepadFaceDown on a repeating button uses the same repeating rate as a mouse hold.
|
||||||
- Misc: io.Framerate moving average now converge in 60 frames instead of 120. (#5236, #4138)
|
- Misc: io.Framerate moving average now converge in 60 frames instead of 120. (#5236, #4138)
|
||||||
- Tools: Item Picker: Mouse button can be changed by holding Ctrl+Shift, making it easier
|
- Tools: Item Picker: Mouse button can be changed by holding Ctrl+Shift, making it easier
|
||||||
to use the Item Picker in e.g. menus. (#2673)
|
to use the Item Picker in e.g. menus. (#2673)
|
||||||
@ -217,8 +225,8 @@ Other Changes:
|
|||||||
merging draw-call of the last column didn't always work (regression since 1.87). (#4843, #4844) [@rokups]
|
merging draw-call of the last column didn't always work (regression since 1.87). (#4843, #4844) [@rokups]
|
||||||
- Inputs: Fixed IsMouseClicked() repeat mode rate being half of keyboard repeat rate.
|
- Inputs: Fixed IsMouseClicked() repeat mode rate being half of keyboard repeat rate.
|
||||||
- ColorEdit: Fixed text baseline alignment after a SameLine() after a ColorEdit() with visible label.
|
- ColorEdit: Fixed text baseline alignment after a SameLine() after a ColorEdit() with visible label.
|
||||||
- TabBar: BeginTabItem() now reacts to SetNextItemWidth(). (#5262)
|
- Tabs: BeginTabItem() now reacts to SetNextItemWidth(). (#5262)
|
||||||
- TabBar: Tweak shrinking policy so that while resizing tabs that don't need shrinking keep their
|
- Tabs: Tweak shrinking policy so that while resizing tabs that don't need shrinking keep their
|
||||||
initial width more precisely (without the occasional +1 worth of width).
|
initial width more precisely (without the occasional +1 worth of width).
|
||||||
- Menus: Adjusted BeginMenu() closing logic so hovering void or non-MenuItem() in parent window
|
- Menus: Adjusted BeginMenu() closing logic so hovering void or non-MenuItem() in parent window
|
||||||
always lead to menu closure. Fixes using items that are not MenuItem() or BeginItem() at the root
|
always lead to menu closure. Fixes using items that are not MenuItem() or BeginItem() at the root
|
||||||
@ -765,7 +773,7 @@ Other Changes:
|
|||||||
Convenient for some small columns. Name will still appear in context menu. (#4206).
|
Convenient for some small columns. Name will still appear in context menu. (#4206).
|
||||||
- Tables: Fixed columns order on TableSetupScrollFreeze() if previous data got frozen columns out of their section.
|
- Tables: Fixed columns order on TableSetupScrollFreeze() if previous data got frozen columns out of their section.
|
||||||
- Tables: Fixed invalid data in TableGetSortSpecs() when SpecsDirty flag is unset. (#4233)
|
- Tables: Fixed invalid data in TableGetSortSpecs() when SpecsDirty flag is unset. (#4233)
|
||||||
- TabBar: Fixed using more than 32 KB-worth of tab names. (#4176)
|
- Tabs: Fixed using more than 32 KB-worth of tab names. (#4176)
|
||||||
- InputInt/InputFloat: When used with Steps values and _ReadOnly flag, the step button look disabled. (#211)
|
- InputInt/InputFloat: When used with Steps values and _ReadOnly flag, the step button look disabled. (#211)
|
||||||
- InputText: Fixed named filtering flags disabling newline or tabs in multiline inputs (#4409, #4410) [@kfsone]
|
- InputText: Fixed named filtering flags disabling newline or tabs in multiline inputs (#4409, #4410) [@kfsone]
|
||||||
- Drag and Drop: drop target highlight doesn't try to bypass host clipping rectangle. (#4281, #3272)
|
- Drag and Drop: drop target highlight doesn't try to bypass host clipping rectangle. (#4281, #3272)
|
||||||
@ -875,7 +883,7 @@ Other Changes:
|
|||||||
- Tables: Expose TableSetColumnEnabled() in public api. (#3935)
|
- Tables: Expose TableSetColumnEnabled() in public api. (#3935)
|
||||||
- Tables: Better preserve widths when columns count changes. (#4046)
|
- Tables: Better preserve widths when columns count changes. (#4046)
|
||||||
- Tables: Sharing more memory buffers between tables, reducing general memory footprints. (#3740)
|
- Tables: Sharing more memory buffers between tables, reducing general memory footprints. (#3740)
|
||||||
- TabBar: Fixed mouse reordering with very fast movements (e.g. crossing multiple tabs in a single
|
- Tabs: Fixed mouse reordering with very fast movements (e.g. crossing multiple tabs in a single
|
||||||
frame and then immediately standing still (would only affect automation/bots). [@rokups]
|
frame and then immediately standing still (would only affect automation/bots). [@rokups]
|
||||||
- Menus: made MenuItem() in a menu bar reflect the 'selected' argument with a highlight. (#4128) [@mattelegende]
|
- Menus: made MenuItem() in a menu bar reflect the 'selected' argument with a highlight. (#4128) [@mattelegende]
|
||||||
- Drags, Sliders, Inputs: Specifying a NULL format to Float functions default them to "%.3f" to be
|
- Drags, Sliders, Inputs: Specifying a NULL format to Float functions default them to "%.3f" to be
|
||||||
@ -1192,11 +1200,11 @@ Other Changes:
|
|||||||
- Added 2 enums: ImGuiSortDirection, ImGuiTableBgTarget
|
- Added 2 enums: ImGuiSortDirection, ImGuiTableBgTarget
|
||||||
- Added 1 style variable: ImGuiStyleVar_CellPadding
|
- Added 1 style variable: ImGuiStyleVar_CellPadding
|
||||||
- Added 5 style colors: ImGuiCol_TableHeaderBg, ImGuiCol_TableBorderStrong, ImGuiCol_TableBorderLight, ImGuiCol_TableRowBg, ImGuiCol_TableRowBgAlt.
|
- Added 5 style colors: ImGuiCol_TableHeaderBg, ImGuiCol_TableBorderStrong, ImGuiCol_TableBorderLight, ImGuiCol_TableRowBg, ImGuiCol_TableRowBgAlt.
|
||||||
- Tab Bar: Made it possible to append to an existing tab bar by calling BeginTabBar()/EndTabBar() again.
|
- Tabs: Made it possible to append to an existing tab bar by calling BeginTabBar()/EndTabBar() again.
|
||||||
- Tab Bar: Fixed using more than 128 tabs in a tab bar (scrolling policy recommended).
|
- Tabs: Fixed using more than 128 tabs in a tab bar (scrolling policy recommended).
|
||||||
- Tab Bar: Do not display a tooltip if the name already fits over a given tab. (#3521)
|
- Tabs: Do not display a tooltip if the name already fits over a given tab. (#3521)
|
||||||
- Tab Bar: Fixed minor/unlikely bug skipping over a button when scrolling left with arrows.
|
- Tabs: Fixed minor/unlikely bug skipping over a button when scrolling left with arrows.
|
||||||
- Tab Bar: Requested ideal content size (for auto-fit) doesn't affect horizontal scrolling. (#3414)
|
- Tabs: Requested ideal content size (for auto-fit) doesn't affect horizontal scrolling. (#3414)
|
||||||
- Drag and Drop: Fix losing drop source ActiveID (and often source tooltip) when opening a TreeNode()
|
- Drag and Drop: Fix losing drop source ActiveID (and often source tooltip) when opening a TreeNode()
|
||||||
or CollapsingHeader() while dragging. (#1738)
|
or CollapsingHeader() while dragging. (#1738)
|
||||||
- Drag and Drop: Fix drag and drop to tie same-size drop targets by chosen the later one. Fixes dragging
|
- Drag and Drop: Fix drag and drop to tie same-size drop targets by chosen the later one. Fixes dragging
|
||||||
@ -1325,16 +1333,16 @@ Other Changes:
|
|||||||
rather than the Mouse Down+Up sequence, even if the _OpenOnArrow flag isn't set. This is standard behavior
|
rather than the Mouse Down+Up sequence, even if the _OpenOnArrow flag isn't set. This is standard behavior
|
||||||
and amends the change done in 1.76 which only affected cases were _OpenOnArrow flag was set.
|
and amends the change done in 1.76 which only affected cases were _OpenOnArrow flag was set.
|
||||||
(This is also necessary to support full multi/range-select/drag and drop operations.)
|
(This is also necessary to support full multi/range-select/drag and drop operations.)
|
||||||
- Tab Bar: Added TabItemButton() to submit tab that behave like a button. (#3291) [@Xipiryon]
|
- Tabs: Added TabItemButton() to submit tab that behave like a button. (#3291) [@Xipiryon]
|
||||||
- Tab Bar: Added ImGuiTabItemFlags_Leading and ImGuiTabItemFlags_Trailing flags to position tabs or button
|
- Tabs: Added ImGuiTabItemFlags_Leading and ImGuiTabItemFlags_Trailing flags to position tabs or button
|
||||||
at either end of the tab bar. Those tabs won't be part of the scrolling region, and when reordering cannot
|
at either end of the tab bar. Those tabs won't be part of the scrolling region, and when reordering cannot
|
||||||
be moving outside of their section. Most often used with TabItemButton(). (#3291) [@Xipiryon]
|
be moving outside of their section. Most often used with TabItemButton(). (#3291) [@Xipiryon]
|
||||||
- Tab Bar: Added ImGuiTabItemFlags_NoReorder flag to disable reordering a given tab.
|
- Tabs: Added ImGuiTabItemFlags_NoReorder flag to disable reordering a given tab.
|
||||||
- Tab Bar: Keep tab item close button visible while dragging a tab (independent of hovering state).
|
- Tabs: Keep tab item close button visible while dragging a tab (independent of hovering state).
|
||||||
- Tab Bar: Fixed a small bug where closing a tab that is not selected would leave a tab hole for a frame.
|
- Tabs: Fixed a small bug where closing a tab that is not selected would leave a tab hole for a frame.
|
||||||
- Tab Bar: Fixed a small bug where scrolling buttons (with ImGuiTabBarFlags_FittingPolicyScroll) would
|
- Tabs: Fixed a small bug where scrolling buttons (with ImGuiTabBarFlags_FittingPolicyScroll) would
|
||||||
generate an unnecessary extra draw call.
|
generate an unnecessary extra draw call.
|
||||||
- Tab Bar: Fixed a small bug where toggling a tab bar from Reorderable to not Reorderable would leave
|
- Tabs: Fixed a small bug where toggling a tab bar from Reorderable to not Reorderable would leave
|
||||||
tabs reordered in the tab list popup. [@Xipiryon]
|
tabs reordered in the tab list popup. [@Xipiryon]
|
||||||
- Columns: Fix inverted ClipRect being passed to renderer when using certain primitives inside of
|
- Columns: Fix inverted ClipRect being passed to renderer when using certain primitives inside of
|
||||||
a fully clipped column. (#3475) [@szreder]
|
a fully clipped column. (#3475) [@szreder]
|
||||||
@ -1443,7 +1451,7 @@ Other Changes:
|
|||||||
limits when close-enough by (WindowPadding - ItemPadding), which was a tweak with too many
|
limits when close-enough by (WindowPadding - ItemPadding), which was a tweak with too many
|
||||||
side-effects. The behavior is still present in SetScrollHere functions as they are more explicitly
|
side-effects. The behavior is still present in SetScrollHere functions as they are more explicitly
|
||||||
aiming at making widgets visible. May later be moved to a flag.
|
aiming at making widgets visible. May later be moved to a flag.
|
||||||
- Tab Bar: Allow calling SetTabItemClosed() after a tab has been submitted (will process next frame).
|
- Tabs: Allow calling SetTabItemClosed() after a tab has been submitted (will process next frame).
|
||||||
- InvisibleButton: Made public a small selection of ImGuiButtonFlags (previously in imgui_internal.h)
|
- InvisibleButton: Made public a small selection of ImGuiButtonFlags (previously in imgui_internal.h)
|
||||||
and allowed to pass them to InvisibleButton(): ImGuiButtonFlags_MouseButtonLeft/Right/Middle.
|
and allowed to pass them to InvisibleButton(): ImGuiButtonFlags_MouseButtonLeft/Right/Middle.
|
||||||
This is a small but rather important change because lots of multi-button behaviors could previously
|
This is a small but rather important change because lots of multi-button behaviors could previously
|
||||||
@ -1895,11 +1903,11 @@ Other Changes:
|
|||||||
- ColorPicker: Made rendering aware of global style alpha of the picker can be faded out. (#2711)
|
- ColorPicker: Made rendering aware of global style alpha of the picker can be faded out. (#2711)
|
||||||
Note that some elements won't accurately fade down with the same intensity, and the color wheel
|
Note that some elements won't accurately fade down with the same intensity, and the color wheel
|
||||||
when enabled will have small overlap glitches with (style.Alpha < 1.0).
|
when enabled will have small overlap glitches with (style.Alpha < 1.0).
|
||||||
- TabBar: Fixed single-tab not shrinking their width down.
|
- Tabs: Fixed single-tab not shrinking their width down.
|
||||||
- TabBar: Fixed clicking on a tab larger than tab-bar width creating a bouncing feedback loop.
|
- Tabs: Fixed clicking on a tab larger than tab-bar width creating a bouncing feedback loop.
|
||||||
- TabBar: Feed desired width (sum of unclipped tabs width) into layout system to allow for auto-resize. (#2768)
|
- Tabs: Feed desired width (sum of unclipped tabs width) into layout system to allow for auto-resize. (#2768)
|
||||||
(before 1.71 tab bars fed the sum of current width which created feedback loops in certain situations).
|
(before 1.71 tab bars fed the sum of current width which created feedback loops in certain situations).
|
||||||
- TabBar: Improved shrinking for large number of tabs to avoid leaving extraneous space on the right side.
|
- Tabs: Improved shrinking for large number of tabs to avoid leaving extraneous space on the right side.
|
||||||
Individuals tabs are given integer-rounded width and remainder is spread between tabs left-to-right.
|
Individuals tabs are given integer-rounded width and remainder is spread between tabs left-to-right.
|
||||||
- Columns, Separator: Fixed a bug where non-visible separators within columns would alter the next row position
|
- Columns, Separator: Fixed a bug where non-visible separators within columns would alter the next row position
|
||||||
differently than visible ones.
|
differently than visible ones.
|
||||||
@ -2021,7 +2029,7 @@ Other Changes:
|
|||||||
- Scrollbar: Avoid overlapping the opposite side when window (often a child window) is forcibly too small.
|
- Scrollbar: Avoid overlapping the opposite side when window (often a child window) is forcibly too small.
|
||||||
- Combo: Hide arrow when there's not enough space even for the square button.
|
- Combo: Hide arrow when there's not enough space even for the square button.
|
||||||
- InputText: Testing for newly added ImGuiKey_KeyPadEnter key. (#2677, #2005) [@amc522]
|
- InputText: Testing for newly added ImGuiKey_KeyPadEnter key. (#2677, #2005) [@amc522]
|
||||||
- TabBar: Fixed unfocused tab bar separator color (was using ImGuiCol_Tab, should use ImGuiCol_TabUnfocusedActive).
|
- Tabs: Fixed unfocused tab bar separator color (was using ImGuiCol_Tab, should use ImGuiCol_TabUnfocusedActive).
|
||||||
- Columns: Fixed a regression from 1.71 where the right-side of the contents rectangle within each column
|
- Columns: Fixed a regression from 1.71 where the right-side of the contents rectangle within each column
|
||||||
would wrongly use a WindowPadding.x instead of ItemSpacing.x like it always did. (#125, #2666)
|
would wrongly use a WindowPadding.x instead of ItemSpacing.x like it always did. (#125, #2666)
|
||||||
- Columns: Made the right-most edge reaches up to the clipping rectangle (removing half of WindowPadding.x
|
- Columns: Made the right-most edge reaches up to the clipping rectangle (removing half of WindowPadding.x
|
||||||
@ -2135,7 +2143,7 @@ Other Changes:
|
|||||||
viewport triggering the issue. (#2609)
|
viewport triggering the issue. (#2609)
|
||||||
- TreeNode, CollapsingHeader: Fixed highlight frame not covering horizontal area fully when using
|
- TreeNode, CollapsingHeader: Fixed highlight frame not covering horizontal area fully when using
|
||||||
horizontal scrolling. (#2211, #2579)
|
horizontal scrolling. (#2211, #2579)
|
||||||
- TabBar: Fixed BeginTabBar() within a window with horizontal scrolling from creating a feedback
|
- Tabs: Fixed BeginTabBar() within a window with horizontal scrolling from creating a feedback
|
||||||
loop with the horizontal contents size.
|
loop with the horizontal contents size.
|
||||||
- Columns: Fixed Columns() within a window with horizontal scrolling from not covering the full
|
- Columns: Fixed Columns() within a window with horizontal scrolling from not covering the full
|
||||||
horizontal area (previously only worked with an explicit contents size). (#125)
|
horizontal area (previously only worked with an explicit contents size). (#125)
|
||||||
@ -2304,14 +2312,14 @@ Other Changes:
|
|||||||
- ColorEdit: Fixed tooltip not honoring the ImGuiColorEditFlags_NoAlpha contract of never
|
- ColorEdit: Fixed tooltip not honoring the ImGuiColorEditFlags_NoAlpha contract of never
|
||||||
reading the 4th float in the array (value was read and discarded). (#2384) [@haldean]
|
reading the 4th float in the array (value was read and discarded). (#2384) [@haldean]
|
||||||
- MenuItem, Selectable: Fixed disabled widget interfering with navigation (fix c2db7f63 in 1.67).
|
- MenuItem, Selectable: Fixed disabled widget interfering with navigation (fix c2db7f63 in 1.67).
|
||||||
- TabBar: Fixed a crash when using many BeginTabBar() recursively (didn't affect docking). (#2371)
|
- Tabs: Fixed a crash when using many BeginTabBar() recursively (didn't affect docking). (#2371)
|
||||||
- TabBar: Added extra mis-usage error recovery. Past the assert, common mis-usage don't lead to
|
- Tabs: Added extra mis-usage error recovery. Past the assert, common mis-usage don't lead to
|
||||||
hard crashes any more, facilitating integration with scripting languages. (#1651)
|
hard crashes any more, facilitating integration with scripting languages. (#1651)
|
||||||
- TabBar: Fixed ImGuiTabItemFlags_SetSelected being ignored if the tab is not visible (with
|
- Tabs: Fixed ImGuiTabItemFlags_SetSelected being ignored if the tab is not visible (with
|
||||||
scrolling policy enabled) or if is currently appearing.
|
scrolling policy enabled) or if is currently appearing.
|
||||||
- TabBar: Fixed Tab tooltip code making drag and drop tooltip disappear during the frame where
|
- Tabs: Fixed Tab tooltip code making drag and drop tooltip disappear during the frame where
|
||||||
the drag payload activate a tab.
|
the drag payload activate a tab.
|
||||||
- TabBar: Reworked scrolling policy (when ImGuiTabBarFlags_FittingPolicyScroll is set) to
|
- Tabs: Reworked scrolling policy (when ImGuiTabBarFlags_FittingPolicyScroll is set) to
|
||||||
teleport the view when aiming at a tab far away the visible section, and otherwise accelerate
|
teleport the view when aiming at a tab far away the visible section, and otherwise accelerate
|
||||||
the scrolling speed to cap the scrolling time to 0.3 seconds.
|
the scrolling speed to cap the scrolling time to 0.3 seconds.
|
||||||
- Text: Fixed large Text/TextUnformatted calls not feeding their size into layout when starting
|
- Text: Fixed large Text/TextUnformatted calls not feeding their size into layout when starting
|
||||||
|
@ -10,6 +10,7 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||||||
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
|
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES")
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES")
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES")
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES")
|
||||||
|
|
||||||
|
149
imgui.cpp
149
imgui.cpp
@ -1314,6 +1314,7 @@ void ImGuiIO::AddKeyAnalogEvent(ImGuiKey key, bool down, float analog_value)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
IM_ASSERT(&g.IO == this && "Can only add events to current context.");
|
IM_ASSERT(&g.IO == this && "Can only add events to current context.");
|
||||||
IM_ASSERT(ImGui::IsNamedKey(key)); // Backend needs to pass a valid ImGuiKey_ constant. 0..511 values are legacy native key codes which are not accepted by this API.
|
IM_ASSERT(ImGui::IsNamedKey(key)); // Backend needs to pass a valid ImGuiKey_ constant. 0..511 values are legacy native key codes which are not accepted by this API.
|
||||||
|
IM_ASSERT(!ImGui::IsAliasKey(key)); // Backend cannot submit ImGuiKey_MouseXXX values they are automatically inferred from AddMouseXXX() events.
|
||||||
|
|
||||||
// Verify that backend isn't mixing up using new io.AddKeyEvent() api and old io.KeysDown[] + io.KeyMap[] data.
|
// Verify that backend isn't mixing up using new io.AddKeyEvent() api and old io.KeysDown[] + io.KeyMap[] data.
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
@ -3487,7 +3488,6 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
|||||||
|
|
||||||
// Clear declaration of inputs claimed by the widget
|
// Clear declaration of inputs claimed by the widget
|
||||||
// (Please note that this is WIP and not all keys/inputs are thoroughly declared by all widgets yet)
|
// (Please note that this is WIP and not all keys/inputs are thoroughly declared by all widgets yet)
|
||||||
g.ActiveIdUsingMouseWheel = false;
|
|
||||||
g.ActiveIdUsingNavDirMask = 0x00;
|
g.ActiveIdUsingNavDirMask = 0x00;
|
||||||
g.ActiveIdUsingKeyInputMask.ClearAllBits();
|
g.ActiveIdUsingKeyInputMask.ClearAllBits();
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
@ -4118,6 +4118,14 @@ static bool IsWindowActiveAndVisible(ImGuiWindow* window)
|
|||||||
return (window->Active) && (!window->Hidden);
|
return (window->Active) && (!window->Hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void UpdateAliasKey(ImGuiKey key, bool v, float analog_value)
|
||||||
|
{
|
||||||
|
IM_ASSERT(ImGui::IsAliasKey(key));
|
||||||
|
ImGuiKeyData* key_data = ImGui::GetKeyData(key);
|
||||||
|
key_data->Down = v;
|
||||||
|
key_data->AnalogValue = analog_value;
|
||||||
|
}
|
||||||
|
|
||||||
static void ImGui::UpdateKeyboardInputs()
|
static void ImGui::UpdateKeyboardInputs()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -4191,8 +4199,12 @@ static void ImGui::UpdateKeyboardInputs()
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Synchronize io.KeyMods with individual modifiers io.KeyXXX bools
|
// Synchronize io.KeyMods with individual modifiers io.KeyXXX bools, update aliases
|
||||||
io.KeyMods = GetMergedModFlags();
|
io.KeyMods = GetMergedModFlags();
|
||||||
|
for (int n = 0; n < ImGuiMouseButton_COUNT; n++)
|
||||||
|
UpdateAliasKey(MouseButtonToKey(n), io.MouseDown[n], io.MouseDown[n] ? 1.0f : 0.0f);
|
||||||
|
UpdateAliasKey(ImGuiKey_MouseWheelX, io.MouseWheelH != 0.0f, io.MouseWheelH);
|
||||||
|
UpdateAliasKey(ImGuiKey_MouseWheelY, io.MouseWheel != 0.0f, io.MouseWheel);
|
||||||
|
|
||||||
// Clear gamepad data if disabled
|
// Clear gamepad data if disabled
|
||||||
if ((io.BackendFlags & ImGuiBackendFlags_HasGamepad) == 0)
|
if ((io.BackendFlags & ImGuiBackendFlags_HasGamepad) == 0)
|
||||||
@ -4302,12 +4314,13 @@ void ImGui::UpdateMouseWheel()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float wheel_x = g.IO.MouseWheelH;
|
const bool hovered_id_using_mouse_wheel = (g.HoveredIdPreviousFrame != 0 && g.HoveredIdPreviousFrameUsingMouseWheel);
|
||||||
float wheel_y = g.IO.MouseWheel;
|
const bool active_id_using_mouse_wheel_x = g.ActiveIdUsingKeyInputMask.TestBit(ImGuiKey_MouseWheelX);
|
||||||
if (wheel_x == 0.0f && wheel_y == 0.0f)
|
const bool active_id_using_mouse_wheel_y = g.ActiveIdUsingKeyInputMask.TestBit(ImGuiKey_MouseWheelY);
|
||||||
return;
|
|
||||||
|
|
||||||
if ((g.ActiveId != 0 && g.ActiveIdUsingMouseWheel) || (g.HoveredIdPreviousFrame != 0 && g.HoveredIdPreviousFrameUsingMouseWheel))
|
float wheel_x = (!hovered_id_using_mouse_wheel && !active_id_using_mouse_wheel_x) ? g.IO.MouseWheelH : 0.0f;
|
||||||
|
float wheel_y = (!hovered_id_using_mouse_wheel && !active_id_using_mouse_wheel_y) ? g.IO.MouseWheel : 0;
|
||||||
|
if (wheel_x == 0.0f && wheel_y == 0.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ImGuiWindow* window = g.WheelingWindow ? g.WheelingWindow : g.HoveredWindow;
|
ImGuiWindow* window = g.WheelingWindow ? g.WheelingWindow : g.HoveredWindow;
|
||||||
@ -4579,6 +4592,20 @@ void ImGui::NewFrame()
|
|||||||
g.ActiveIdUsingKeyInputMask.ClearAllBits();
|
g.ActiveIdUsingKeyInputMask.ClearAllBits();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
|
if (g.ActiveId == 0)
|
||||||
|
g.ActiveIdUsingNavInputMask = 0;
|
||||||
|
else if (g.ActiveIdUsingNavInputMask != 0)
|
||||||
|
{
|
||||||
|
// If your custom widget code used: { g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel); }
|
||||||
|
// Since IMGUI_VERSION_NUM >= 18804 it should be: { SetActiveIdUsingKey(ImGuiKey_Escape); SetActiveIdUsingKey(ImGuiKey_NavGamepadCancel); }
|
||||||
|
if (g.ActiveIdUsingNavInputMask & (1 << ImGuiNavInput_Cancel))
|
||||||
|
SetActiveIdUsingKey(ImGuiKey_Escape);
|
||||||
|
if (g.ActiveIdUsingNavInputMask & ~(1 << ImGuiNavInput_Cancel))
|
||||||
|
IM_ASSERT(0); // Other values unsupported
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Drag and drop
|
// Drag and drop
|
||||||
g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr;
|
g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr;
|
||||||
g.DragDropAcceptIdCurr = 0;
|
g.DragDropAcceptIdCurr = 0;
|
||||||
@ -5456,7 +5483,10 @@ void ImGui::SetItemUsingMouseWheel()
|
|||||||
if (g.HoveredId == id)
|
if (g.HoveredId == id)
|
||||||
g.HoveredIdUsingMouseWheel = true;
|
g.HoveredIdUsingMouseWheel = true;
|
||||||
if (g.ActiveId == id)
|
if (g.ActiveId == id)
|
||||||
g.ActiveIdUsingMouseWheel = true;
|
{
|
||||||
|
g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_MouseWheelX);
|
||||||
|
g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_MouseWheelY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::SetActiveIdUsingNavAndKeys()
|
void ImGui::SetActiveIdUsingNavAndKeys()
|
||||||
@ -5655,7 +5685,6 @@ static void ApplyWindowSettings(ImGuiWindow* window, ImGuiWindowSettings* settin
|
|||||||
static void UpdateWindowInFocusOrderList(ImGuiWindow* window, bool just_created, ImGuiWindowFlags new_flags)
|
static void UpdateWindowInFocusOrderList(ImGuiWindow* window, bool just_created, ImGuiWindowFlags new_flags)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
|
||||||
const bool new_is_explicit_child = (new_flags & ImGuiWindowFlags_ChildWindow) != 0;
|
const bool new_is_explicit_child = (new_flags & ImGuiWindowFlags_ChildWindow) != 0;
|
||||||
const bool child_flag_changed = new_is_explicit_child != window->IsExplicitChild;
|
const bool child_flag_changed = new_is_explicit_child != window->IsExplicitChild;
|
||||||
if ((just_created || child_flag_changed) && !new_is_explicit_child)
|
if ((just_created || child_flag_changed) && !new_is_explicit_child)
|
||||||
@ -5719,7 +5748,6 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
|
|||||||
g.Windows.push_front(window); // Quite slow but rare and only once
|
g.Windows.push_front(window); // Quite slow but rare and only once
|
||||||
else
|
else
|
||||||
g.Windows.push_back(window);
|
g.Windows.push_back(window);
|
||||||
UpdateWindowInFocusOrderList(window, true, window->Flags);
|
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
@ -6420,8 +6448,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
const bool window_just_created = (window == NULL);
|
const bool window_just_created = (window == NULL);
|
||||||
if (window_just_created)
|
if (window_just_created)
|
||||||
window = CreateNewWindow(name, flags);
|
window = CreateNewWindow(name, flags);
|
||||||
else
|
|
||||||
UpdateWindowInFocusOrderList(window, window_just_created, flags);
|
|
||||||
|
|
||||||
// Automatically disable manual moving/resizing when NoInputs is set
|
// Automatically disable manual moving/resizing when NoInputs is set
|
||||||
if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs)
|
if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs)
|
||||||
@ -6447,10 +6473,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
const bool window_was_appearing = window->Appearing;
|
const bool window_was_appearing = window->Appearing;
|
||||||
if (first_begin_of_the_frame)
|
if (first_begin_of_the_frame)
|
||||||
{
|
{
|
||||||
|
UpdateWindowInFocusOrderList(window, window_just_created, flags);
|
||||||
window->Appearing = window_just_activated_by_user;
|
window->Appearing = window_just_activated_by_user;
|
||||||
if (window->Appearing)
|
if (window->Appearing)
|
||||||
SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, true);
|
SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, true);
|
||||||
|
|
||||||
window->FlagsPreviousFrame = window->Flags;
|
window->FlagsPreviousFrame = window->Flags;
|
||||||
window->Flags = (ImGuiWindowFlags)flags;
|
window->Flags = (ImGuiWindowFlags)flags;
|
||||||
window->LastFrameActive = current_frame;
|
window->LastFrameActive = current_frame;
|
||||||
@ -8250,7 +8276,8 @@ static const char* const GKeyNames[] =
|
|||||||
"GamepadL1", "GamepadR1", "GamepadL2", "GamepadR2", "GamepadL3", "GamepadR3",
|
"GamepadL1", "GamepadR1", "GamepadL2", "GamepadR2", "GamepadL3", "GamepadR3",
|
||||||
"GamepadLStickLeft", "GamepadLStickRight", "GamepadLStickUp", "GamepadLStickDown",
|
"GamepadLStickLeft", "GamepadLStickRight", "GamepadLStickUp", "GamepadLStickDown",
|
||||||
"GamepadRStickLeft", "GamepadRStickRight", "GamepadRStickUp", "GamepadRStickDown",
|
"GamepadRStickLeft", "GamepadRStickRight", "GamepadRStickUp", "GamepadRStickDown",
|
||||||
"ModCtrl", "ModShift", "ModAlt", "ModSuper"
|
"ModCtrl", "ModShift", "ModAlt", "ModSuper",
|
||||||
|
"MouseLeft", "MouseRight", "MouseMiddle", "MouseX1", "MouseX2", "MouseWheelX", "MouseWheelY",
|
||||||
};
|
};
|
||||||
IM_STATIC_ASSERT(ImGuiKey_NamedKey_COUNT == IM_ARRAYSIZE(GKeyNames));
|
IM_STATIC_ASSERT(ImGuiKey_NamedKey_COUNT == IM_ARRAYSIZE(GKeyNames));
|
||||||
|
|
||||||
@ -8276,6 +8303,18 @@ const char* ImGui::GetKeyName(ImGuiKey key)
|
|||||||
return GKeyNames[key - ImGuiKey_NamedKey_BEGIN];
|
return GKeyNames[key - ImGuiKey_NamedKey_BEGIN];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImGui::GetKeyChordName(ImGuiModFlags mods, ImGuiKey key, char* out_buf, int out_buf_size)
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
IM_ASSERT((mods & ~ImGuiModFlags_All) == 0 && "Passing invalid ImGuiModFlags value!"); // A frequent mistake is to pass ImGuiKey_ModXXX instead of ImGuiModFlags_XXX
|
||||||
|
ImFormatString(out_buf, (size_t)out_buf_size, "%s%s%s%s%s",
|
||||||
|
(mods & ImGuiModFlags_Ctrl) ? "Ctrl+" : "",
|
||||||
|
(mods & ImGuiModFlags_Shift) ? "Shift+" : "",
|
||||||
|
(mods & ImGuiModFlags_Alt) ? "Alt+" : "",
|
||||||
|
(mods & ImGuiModFlags_Super) ? (g.IO.ConfigMacOSXBehaviors ? "Cmd+" : "Super+") : "",
|
||||||
|
GetKeyName(key));
|
||||||
|
}
|
||||||
|
|
||||||
// t0 = previous time (e.g.: g.Time - g.IO.DeltaTime)
|
// t0 = previous time (e.g.: g.Time - g.IO.DeltaTime)
|
||||||
// t1 = current time (e.g.: g.Time)
|
// t1 = current time (e.g.: g.Time)
|
||||||
// An event is triggered at:
|
// An event is triggered at:
|
||||||
@ -8294,14 +8333,14 @@ int ImGui::CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, flo
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::GetTypematicRepeatRate(ImGuiInputReadFlags flags, float* repeat_delay, float* repeat_rate)
|
void ImGui::GetTypematicRepeatRate(ImGuiInputFlags flags, float* repeat_delay, float* repeat_rate)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
switch (flags & ImGuiInputReadFlags_RepeatRateMask_)
|
switch (flags & ImGuiInputFlags_RepeatRateMask_)
|
||||||
{
|
{
|
||||||
case ImGuiInputReadFlags_RepeatRateNavMove: *repeat_delay = g.IO.KeyRepeatDelay * 0.72f; *repeat_rate = g.IO.KeyRepeatRate * 0.80f; return;
|
case ImGuiInputFlags_RepeatRateNavMove: *repeat_delay = g.IO.KeyRepeatDelay * 0.72f; *repeat_rate = g.IO.KeyRepeatRate * 0.80f; return;
|
||||||
case ImGuiInputReadFlags_RepeatRateNavTweak: *repeat_delay = g.IO.KeyRepeatDelay * 0.72f; *repeat_rate = g.IO.KeyRepeatRate * 0.30f; return;
|
case ImGuiInputFlags_RepeatRateNavTweak: *repeat_delay = g.IO.KeyRepeatDelay * 0.72f; *repeat_rate = g.IO.KeyRepeatRate * 0.30f; return;
|
||||||
case ImGuiInputReadFlags_RepeatRateDefault: default: *repeat_delay = g.IO.KeyRepeatDelay * 1.00f; *repeat_rate = g.IO.KeyRepeatRate * 1.00f; return;
|
case ImGuiInputFlags_RepeatRateDefault: default: *repeat_delay = g.IO.KeyRepeatDelay * 1.00f; *repeat_rate = g.IO.KeyRepeatRate * 1.00f; return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8335,12 +8374,12 @@ bool ImGui::IsKeyDown(ImGuiKey key)
|
|||||||
|
|
||||||
bool ImGui::IsKeyPressed(ImGuiKey key, bool repeat)
|
bool ImGui::IsKeyPressed(ImGuiKey key, bool repeat)
|
||||||
{
|
{
|
||||||
return IsKeyPressedEx(key, repeat ? ImGuiInputReadFlags_Repeat : ImGuiInputReadFlags_None);
|
return IsKeyPressedEx(key, repeat ? ImGuiInputFlags_Repeat : ImGuiInputFlags_None);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Important: unlike legacy IsKeyPressed(ImGuiKey, bool repeat=true) which DEFAULT to repeat, this requires EXPLICIT repeat.
|
// Important: unlike legacy IsKeyPressed(ImGuiKey, bool repeat=true) which DEFAULT to repeat, this requires EXPLICIT repeat.
|
||||||
// [Internal] 2022/07: Do not call this directly! It is a temporary entry point which we will soon replace with an overload for IsKeyPressed() when we introduce key ownership.
|
// [Internal] 2022/07: Do not call this directly! It is a temporary entry point which we will soon replace with an overload for IsKeyPressed() when we introduce key ownership.
|
||||||
bool ImGui::IsKeyPressedEx(ImGuiKey key, ImGuiInputReadFlags flags)
|
bool ImGui::IsKeyPressedEx(ImGuiKey key, ImGuiInputFlags flags)
|
||||||
{
|
{
|
||||||
const ImGuiKeyData* key_data = GetKeyData(key);
|
const ImGuiKeyData* key_data = GetKeyData(key);
|
||||||
const float t = key_data->DownDuration;
|
const float t = key_data->DownDuration;
|
||||||
@ -8348,7 +8387,7 @@ bool ImGui::IsKeyPressedEx(ImGuiKey key, ImGuiInputReadFlags flags)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool pressed = (t == 0.0f);
|
bool pressed = (t == 0.0f);
|
||||||
if (!pressed && ((flags & ImGuiInputReadFlags_Repeat) != 0))
|
if (!pressed && ((flags & ImGuiInputFlags_Repeat) != 0))
|
||||||
{
|
{
|
||||||
float repeat_delay, repeat_rate;
|
float repeat_delay, repeat_rate;
|
||||||
GetTypematicRepeatRate(flags, &repeat_delay, &repeat_rate);
|
GetTypematicRepeatRate(flags, &repeat_delay, &repeat_rate);
|
||||||
@ -10843,7 +10882,7 @@ float ImGui::GetNavTweakPressedAmount(ImGuiAxis axis)
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
float repeat_delay, repeat_rate;
|
float repeat_delay, repeat_rate;
|
||||||
GetTypematicRepeatRate(ImGuiInputReadFlags_RepeatRateNavTweak, &repeat_delay, &repeat_rate);
|
GetTypematicRepeatRate(ImGuiInputFlags_RepeatRateNavTweak, &repeat_delay, &repeat_rate);
|
||||||
|
|
||||||
ImGuiKey key_less, key_more;
|
ImGuiKey key_less, key_more;
|
||||||
if (g.NavInputSource == ImGuiInputSource_Gamepad)
|
if (g.NavInputSource == ImGuiInputSource_Gamepad)
|
||||||
@ -10884,6 +10923,10 @@ static void ImGui::NavUpdate()
|
|||||||
for (ImGuiKey key : nav_keyboard_keys_to_change_source)
|
for (ImGuiKey key : nav_keyboard_keys_to_change_source)
|
||||||
if (IsKeyDown(key))
|
if (IsKeyDown(key))
|
||||||
g.NavInputSource = ImGuiInputSource_Keyboard;
|
g.NavInputSource = ImGuiInputSource_Keyboard;
|
||||||
|
if (!nav_gamepad_active && g.NavInputSource == ImGuiInputSource_Gamepad)
|
||||||
|
g.NavInputSource = ImGuiInputSource_None;
|
||||||
|
if (!nav_keyboard_active && g.NavInputSource == ImGuiInputSource_Keyboard)
|
||||||
|
g.NavInputSource = ImGuiInputSource_None;
|
||||||
|
|
||||||
// Process navigation init request (select first/default focus)
|
// Process navigation init request (select first/default focus)
|
||||||
if (g.NavInitResultId != 0)
|
if (g.NavInitResultId != 0)
|
||||||
@ -10928,10 +10971,10 @@ static void ImGui::NavUpdate()
|
|||||||
g.NavActivateFlags = ImGuiActivateFlags_None;
|
g.NavActivateFlags = ImGuiActivateFlags_None;
|
||||||
if (g.NavId != 0 && !g.NavDisableHighlight && !g.NavWindowingTarget && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
|
if (g.NavId != 0 && !g.NavDisableHighlight && !g.NavWindowingTarget && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
|
||||||
{
|
{
|
||||||
const bool activate_down = IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_NavGamepadActivate);
|
const bool activate_down = (nav_keyboard_active && IsKeyDown(ImGuiKey_Space)) || (nav_gamepad_active && IsKeyDown(ImGuiKey_NavGamepadActivate));
|
||||||
const bool activate_pressed = activate_down && (IsKeyPressed(ImGuiKey_Space, false) || IsKeyPressed(ImGuiKey_NavGamepadActivate, false));
|
const bool activate_pressed = activate_down && ((nav_keyboard_active && IsKeyPressed(ImGuiKey_Space, false)) || (nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadActivate, false)));
|
||||||
const bool input_down = IsKeyDown(ImGuiKey_Enter) || IsKeyDown(ImGuiKey_NavGamepadInput);
|
const bool input_down = (nav_keyboard_active && IsKeyDown(ImGuiKey_Enter)) || (nav_gamepad_active && IsKeyDown(ImGuiKey_NavGamepadInput));
|
||||||
const bool input_pressed = input_down && (IsKeyPressed(ImGuiKey_Enter, false) || IsKeyPressed(ImGuiKey_NavGamepadInput, false));
|
const bool input_pressed = input_down && ((nav_keyboard_active && IsKeyPressed(ImGuiKey_Enter, false)) || (nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadInput, false)));
|
||||||
if (g.ActiveId == 0 && activate_pressed)
|
if (g.ActiveId == 0 && activate_pressed)
|
||||||
{
|
{
|
||||||
g.NavActivateId = g.NavId;
|
g.NavActivateId = g.NavId;
|
||||||
@ -10986,14 +11029,17 @@ static void ImGui::NavUpdate()
|
|||||||
SetScrollY(window, ImFloor(window->Scroll.y + ((move_dir == ImGuiDir_Up) ? -1.0f : +1.0f) * scroll_speed));
|
SetScrollY(window, ImFloor(window->Scroll.y + ((move_dir == ImGuiDir_Up) ? -1.0f : +1.0f) * scroll_speed));
|
||||||
}
|
}
|
||||||
|
|
||||||
// *Normal* Manual scroll with NavScrollXXX keys
|
// *Normal* Manual scroll with LStick
|
||||||
// Next movement request will clamp the NavId reference rectangle to the visible area, so navigation will resume within those bounds.
|
// Next movement request will clamp the NavId reference rectangle to the visible area, so navigation will resume within those bounds.
|
||||||
const ImVec2 scroll_dir = GetKeyVector2d(ImGuiKey_GamepadLStickLeft, ImGuiKey_GamepadLStickRight, ImGuiKey_GamepadLStickUp, ImGuiKey_GamepadLStickDown);
|
if (nav_gamepad_active)
|
||||||
const float tweak_factor = IsKeyDown(ImGuiKey_NavGamepadTweakSlow) ? 1.0f / 10.0f : IsKeyDown(ImGuiKey_NavGamepadTweakFast) ? 10.0f : 1.0f;
|
{
|
||||||
if (scroll_dir.x != 0.0f && window->ScrollbarX)
|
const ImVec2 scroll_dir = GetKeyVector2d(ImGuiKey_GamepadLStickLeft, ImGuiKey_GamepadLStickRight, ImGuiKey_GamepadLStickUp, ImGuiKey_GamepadLStickDown);
|
||||||
SetScrollX(window, ImFloor(window->Scroll.x + scroll_dir.x * scroll_speed * tweak_factor));
|
const float tweak_factor = IsKeyDown(ImGuiKey_NavGamepadTweakSlow) ? 1.0f / 10.0f : IsKeyDown(ImGuiKey_NavGamepadTweakFast) ? 10.0f : 1.0f;
|
||||||
if (scroll_dir.y != 0.0f)
|
if (scroll_dir.x != 0.0f && window->ScrollbarX)
|
||||||
SetScrollY(window, ImFloor(window->Scroll.y + scroll_dir.y * scroll_speed * tweak_factor));
|
SetScrollX(window, ImFloor(window->Scroll.x + scroll_dir.x * scroll_speed * tweak_factor));
|
||||||
|
if (scroll_dir.y != 0.0f)
|
||||||
|
SetScrollY(window, ImFloor(window->Scroll.y + scroll_dir.y * scroll_speed * tweak_factor));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always prioritize mouse highlight if navigation is disabled
|
// Always prioritize mouse highlight if navigation is disabled
|
||||||
@ -11045,6 +11091,8 @@ void ImGui::NavUpdateCreateMoveRequest()
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiIO& io = g.IO;
|
ImGuiIO& io = g.IO;
|
||||||
ImGuiWindow* window = g.NavWindow;
|
ImGuiWindow* window = g.NavWindow;
|
||||||
|
const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
|
||||||
|
const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||||
|
|
||||||
if (g.NavMoveForwardToNextFrame && window != NULL)
|
if (g.NavMoveForwardToNextFrame && window != NULL)
|
||||||
{
|
{
|
||||||
@ -11062,11 +11110,11 @@ void ImGui::NavUpdateCreateMoveRequest()
|
|||||||
g.NavMoveScrollFlags = ImGuiScrollFlags_None;
|
g.NavMoveScrollFlags = ImGuiScrollFlags_None;
|
||||||
if (window && !g.NavWindowingTarget && !(window->Flags & ImGuiWindowFlags_NoNavInputs))
|
if (window && !g.NavWindowingTarget && !(window->Flags & ImGuiWindowFlags_NoNavInputs))
|
||||||
{
|
{
|
||||||
const ImGuiInputReadFlags repeat_mode = ImGuiInputReadFlags_Repeat | ImGuiInputReadFlags_RepeatRateNavMove;
|
const ImGuiInputFlags repeat_mode = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateNavMove;
|
||||||
if (!IsActiveIdUsingNavDir(ImGuiDir_Left) && (IsKeyPressedEx(ImGuiKey_GamepadDpadLeft, repeat_mode) || IsKeyPressedEx(ImGuiKey_LeftArrow, repeat_mode))) { g.NavMoveDir = ImGuiDir_Left; }
|
if (!IsActiveIdUsingNavDir(ImGuiDir_Left) && ((nav_gamepad_active && IsKeyPressedEx(ImGuiKey_GamepadDpadLeft, repeat_mode)) || (nav_keyboard_active && IsKeyPressedEx(ImGuiKey_LeftArrow, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Left; }
|
||||||
if (!IsActiveIdUsingNavDir(ImGuiDir_Right) && (IsKeyPressedEx(ImGuiKey_GamepadDpadRight, repeat_mode) || IsKeyPressedEx(ImGuiKey_RightArrow, repeat_mode))) { g.NavMoveDir = ImGuiDir_Right; }
|
if (!IsActiveIdUsingNavDir(ImGuiDir_Right) && ((nav_gamepad_active && IsKeyPressedEx(ImGuiKey_GamepadDpadRight, repeat_mode)) || (nav_keyboard_active && IsKeyPressedEx(ImGuiKey_RightArrow, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Right; }
|
||||||
if (!IsActiveIdUsingNavDir(ImGuiDir_Up) && (IsKeyPressedEx(ImGuiKey_GamepadDpadUp, repeat_mode) || IsKeyPressedEx(ImGuiKey_UpArrow, repeat_mode))) { g.NavMoveDir = ImGuiDir_Up; }
|
if (!IsActiveIdUsingNavDir(ImGuiDir_Up) && ((nav_gamepad_active && IsKeyPressedEx(ImGuiKey_GamepadDpadUp, repeat_mode)) || (nav_keyboard_active && IsKeyPressedEx(ImGuiKey_UpArrow, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Up; }
|
||||||
if (!IsActiveIdUsingNavDir(ImGuiDir_Down) && (IsKeyPressedEx(ImGuiKey_GamepadDpadDown, repeat_mode) || IsKeyPressedEx(ImGuiKey_DownArrow, repeat_mode))) { g.NavMoveDir = ImGuiDir_Down; }
|
if (!IsActiveIdUsingNavDir(ImGuiDir_Down) && ((nav_gamepad_active && IsKeyPressedEx(ImGuiKey_GamepadDpadDown, repeat_mode)) || (nav_keyboard_active && IsKeyPressedEx(ImGuiKey_DownArrow, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Down; }
|
||||||
}
|
}
|
||||||
g.NavMoveClipDir = g.NavMoveDir;
|
g.NavMoveClipDir = g.NavMoveDir;
|
||||||
g.NavScoringNoClipRect = ImRect(+FLT_MAX, +FLT_MAX, -FLT_MAX, -FLT_MAX);
|
g.NavScoringNoClipRect = ImRect(+FLT_MAX, +FLT_MAX, -FLT_MAX, -FLT_MAX);
|
||||||
@ -11074,7 +11122,6 @@ void ImGui::NavUpdateCreateMoveRequest()
|
|||||||
|
|
||||||
// Update PageUp/PageDown/Home/End scroll
|
// Update PageUp/PageDown/Home/End scroll
|
||||||
// FIXME-NAV: Consider enabling those keys even without the master ImGuiConfigFlags_NavEnableKeyboard flag?
|
// FIXME-NAV: Consider enabling those keys even without the master ImGuiConfigFlags_NavEnableKeyboard flag?
|
||||||
const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
|
||||||
float scoring_rect_offset_y = 0.0f;
|
float scoring_rect_offset_y = 0.0f;
|
||||||
if (window && g.NavMoveDir == ImGuiDir_None && nav_keyboard_active)
|
if (window && g.NavMoveDir == ImGuiDir_None && nav_keyboard_active)
|
||||||
scoring_rect_offset_y = NavUpdatePageUpPageDown();
|
scoring_rect_offset_y = NavUpdatePageUpPageDown();
|
||||||
@ -11272,18 +11319,11 @@ void ImGui::NavMoveRequestApplyResult()
|
|||||||
static void ImGui::NavUpdateCancelRequest()
|
static void ImGui::NavUpdateCancelRequest()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (!IsKeyPressed(ImGuiKey_Escape, false) && !IsKeyPressed(ImGuiKey_NavGamepadCancel, false))
|
const bool nav_gamepad_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (g.IO.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
|
||||||
|
const bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||||
|
if (!(nav_keyboard_active && IsKeyPressed(ImGuiKey_Escape, false)) && !(nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadCancel, false)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
|
||||||
// If your custom widget code used: { g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel); }
|
|
||||||
// Since IMGUI_VERSION_NUM >= 18804 it should be: { SetActiveIdUsingKey(ImGuiKey_Escape); SetActiveIdUsingKey(ImGuiKey_NavGamepadCancel); }
|
|
||||||
if (g.ActiveIdUsingNavInputMask & (1 << ImGuiNavInput_Cancel))
|
|
||||||
SetActiveIdUsingKey(ImGuiKey_Escape);
|
|
||||||
if (g.ActiveIdUsingNavInputMask & ~(1 << ImGuiNavInput_Cancel))
|
|
||||||
IM_ASSERT(0); // Other values unsupported
|
|
||||||
#endif
|
|
||||||
|
|
||||||
IMGUI_DEBUG_LOG_NAV("[nav] NavUpdateCancelRequest()\n");
|
IMGUI_DEBUG_LOG_NAV("[nav] NavUpdateCancelRequest()\n");
|
||||||
if (g.ActiveId != 0)
|
if (g.ActiveId != 0)
|
||||||
{
|
{
|
||||||
@ -11533,8 +11573,10 @@ static void ImGui::NavUpdateWindowing()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start CTRL+Tab or Square+L/R window selection
|
// Start CTRL+Tab or Square+L/R window selection
|
||||||
const bool start_windowing_with_gamepad = allow_windowing && !g.NavWindowingTarget && IsKeyPressed(ImGuiKey_NavGamepadMenu, false);
|
const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
|
||||||
const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && io.KeyCtrl && IsKeyPressed(ImGuiKey_Tab, false);
|
const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||||
|
const bool start_windowing_with_gamepad = allow_windowing && nav_gamepad_active && !g.NavWindowingTarget && IsKeyPressed(ImGuiKey_NavGamepadMenu, false);
|
||||||
|
const bool start_windowing_with_keyboard = allow_windowing && nav_keyboard_active && !g.NavWindowingTarget && io.KeyCtrl && IsKeyPressed(ImGuiKey_Tab, false);
|
||||||
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
||||||
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
|
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
|
||||||
{
|
{
|
||||||
@ -11586,7 +11628,6 @@ static void ImGui::NavUpdateWindowing()
|
|||||||
// Keyboard: Press and Release ALT to toggle menu layer
|
// Keyboard: Press and Release ALT to toggle menu layer
|
||||||
// - Testing that only Alt is tested prevents Alt+Shift or AltGR from toggling menu layer.
|
// - Testing that only Alt is tested prevents Alt+Shift or AltGR from toggling menu layer.
|
||||||
// - AltGR is normally Alt+Ctrl but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl). But even on keyboards without AltGR we don't want Alt+Ctrl to open menu anyway.
|
// - AltGR is normally Alt+Ctrl but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl). But even on keyboards without AltGR we don't want Alt+Ctrl to open menu anyway.
|
||||||
const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
|
||||||
if (nav_keyboard_active && IsKeyPressed(ImGuiKey_ModAlt))
|
if (nav_keyboard_active && IsKeyPressed(ImGuiKey_ModAlt))
|
||||||
{
|
{
|
||||||
g.NavWindowingToggleLayer = true;
|
g.NavWindowingToggleLayer = true;
|
||||||
@ -18220,7 +18261,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
int active_id_using_key_input_count = 0;
|
int active_id_using_key_input_count = 0;
|
||||||
for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_NamedKey_END; n++)
|
for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_NamedKey_END; n++)
|
||||||
active_id_using_key_input_count += g.ActiveIdUsingKeyInputMask[n] ? 1 : 0;
|
active_id_using_key_input_count += g.ActiveIdUsingKeyInputMask[n] ? 1 : 0;
|
||||||
Text("ActiveIdUsing: Wheel: %d, NavDirMask: %X, KeyInputMask: %d key(s)", g.ActiveIdUsingMouseWheel, g.ActiveIdUsingNavDirMask, active_id_using_key_input_count);
|
Text("ActiveIdUsing: NavDirMask: %X, KeyInputMask: %d key(s)", g.ActiveIdUsingNavDirMask, active_id_using_key_input_count);
|
||||||
Text("HoveredId: 0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Not displaying g.HoveredId as it is update mid-frame
|
Text("HoveredId: 0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Not displaying g.HoveredId as it is update mid-frame
|
||||||
Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);
|
Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);
|
||||||
Unindent();
|
Unindent();
|
||||||
|
9
imgui.h
9
imgui.h
@ -65,7 +65,7 @@ Index of this file:
|
|||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.89 WIP"
|
#define IMGUI_VERSION "1.89 WIP"
|
||||||
#define IMGUI_VERSION_NUM 18804
|
#define IMGUI_VERSION_NUM 18806
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
||||||
@ -1492,6 +1492,10 @@ enum ImGuiKey_
|
|||||||
// backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
|
// backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
|
||||||
ImGuiKey_ModCtrl, ImGuiKey_ModShift, ImGuiKey_ModAlt, ImGuiKey_ModSuper,
|
ImGuiKey_ModCtrl, ImGuiKey_ModShift, ImGuiKey_ModAlt, ImGuiKey_ModSuper,
|
||||||
|
|
||||||
|
// Mouse Buttons (auto-submitted from AddMouseButtonEvent() calls)
|
||||||
|
// - This is mirroring the data also written to io.MouseDown[], io.MouseWheel, in a format allowing them to be accessed via standard key API.
|
||||||
|
ImGuiKey_MouseLeft, ImGuiKey_MouseRight, ImGuiKey_MouseMiddle, ImGuiKey_MouseX1, ImGuiKey_MouseX2, ImGuiKey_MouseWheelX, ImGuiKey_MouseWheelY,
|
||||||
|
|
||||||
// End of list
|
// End of list
|
||||||
ImGuiKey_COUNT, // No valid ImGuiKey is ever greater than this value
|
ImGuiKey_COUNT, // No valid ImGuiKey is ever greater than this value
|
||||||
|
|
||||||
@ -1519,8 +1523,9 @@ enum ImGuiModFlags_
|
|||||||
ImGuiModFlags_None = 0,
|
ImGuiModFlags_None = 0,
|
||||||
ImGuiModFlags_Ctrl = 1 << 0,
|
ImGuiModFlags_Ctrl = 1 << 0,
|
||||||
ImGuiModFlags_Shift = 1 << 1,
|
ImGuiModFlags_Shift = 1 << 1,
|
||||||
ImGuiModFlags_Alt = 1 << 2, // Menu
|
ImGuiModFlags_Alt = 1 << 2, // Option/Menu key
|
||||||
ImGuiModFlags_Super = 1 << 3, // Cmd/Super/Windows key
|
ImGuiModFlags_Super = 1 << 3, // Cmd/Super/Windows key
|
||||||
|
ImGuiModFlags_All = 0x0F
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
|
@ -153,7 +153,7 @@ typedef int ImGuiDataAuthority; // -> enum ImGuiDataAuthority_ // E
|
|||||||
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
||||||
typedef int ImGuiActivateFlags; // -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later)
|
typedef int ImGuiActivateFlags; // -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later)
|
||||||
typedef int ImGuiDebugLogFlags; // -> enum ImGuiDebugLogFlags_ // Flags: for ShowDebugLogWindow(), g.DebugLogFlags
|
typedef int ImGuiDebugLogFlags; // -> enum ImGuiDebugLogFlags_ // Flags: for ShowDebugLogWindow(), g.DebugLogFlags
|
||||||
typedef int ImGuiInputReadFlags; // -> enum ImGuiInputReadFlags_ // Flags: for IsKeyPressedEx()
|
typedef int ImGuiInputFlags; // -> enum ImGuiInputFlags_ // Flags: for IsKeyPressedEx()
|
||||||
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag()
|
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag()
|
||||||
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags
|
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags
|
||||||
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
||||||
@ -1195,6 +1195,8 @@ enum ImGuiKeyPrivate_
|
|||||||
ImGuiKey_LegacyNativeKey_END = 512,
|
ImGuiKey_LegacyNativeKey_END = 512,
|
||||||
ImGuiKey_Gamepad_BEGIN = ImGuiKey_GamepadStart,
|
ImGuiKey_Gamepad_BEGIN = ImGuiKey_GamepadStart,
|
||||||
ImGuiKey_Gamepad_END = ImGuiKey_GamepadRStickDown + 1,
|
ImGuiKey_Gamepad_END = ImGuiKey_GamepadRStickDown + 1,
|
||||||
|
ImGuiKey_Aliases_BEGIN = ImGuiKey_MouseLeft,
|
||||||
|
ImGuiKey_Aliases_END = ImGuiKey_COUNT,
|
||||||
|
|
||||||
// [Internal] Named shortcuts for Navigation
|
// [Internal] Named shortcuts for Navigation
|
||||||
ImGuiKey_NavKeyboardTweakSlow = ImGuiKey_ModCtrl,
|
ImGuiKey_NavKeyboardTweakSlow = ImGuiKey_ModCtrl,
|
||||||
@ -1262,17 +1264,15 @@ struct ImGuiInputEvent
|
|||||||
|
|
||||||
// Flags for IsKeyPressedEx(). In upcoming feature this will be used more (and IsKeyPressedEx() renamed)
|
// Flags for IsKeyPressedEx(). In upcoming feature this will be used more (and IsKeyPressedEx() renamed)
|
||||||
// Don't mistake with ImGuiInputTextFlags! (for ImGui::InputText() function)
|
// Don't mistake with ImGuiInputTextFlags! (for ImGui::InputText() function)
|
||||||
enum ImGuiInputReadFlags_
|
enum ImGuiInputFlags_
|
||||||
{
|
{
|
||||||
// Flags for IsKeyPressedEx()
|
// Flags for IsKeyPressedEx()
|
||||||
ImGuiInputReadFlags_None = 0,
|
ImGuiInputFlags_None = 0,
|
||||||
ImGuiInputReadFlags_Repeat = 1 << 0, // Return true on successive repeats. Default for legacy IsKeyPressed(). NOT Default for legacy IsMouseClicked(). MUST BE == 1.
|
ImGuiInputFlags_Repeat = 1 << 0, // Return true on successive repeats. Default for legacy IsKeyPressed(). NOT Default for legacy IsMouseClicked(). MUST BE == 1.
|
||||||
|
ImGuiInputFlags_RepeatRateDefault = 1 << 1, // Repeat rate: Regular (default)
|
||||||
// Repeat rate
|
ImGuiInputFlags_RepeatRateNavMove = 1 << 2, // Repeat rate: Fast
|
||||||
ImGuiInputReadFlags_RepeatRateDefault = 1 << 1, // Regular
|
ImGuiInputFlags_RepeatRateNavTweak = 1 << 3, // Repeat rate: Faster
|
||||||
ImGuiInputReadFlags_RepeatRateNavMove = 1 << 2, // Fast
|
ImGuiInputFlags_RepeatRateMask_ = ImGuiInputFlags_RepeatRateDefault | ImGuiInputFlags_RepeatRateNavMove | ImGuiInputFlags_RepeatRateNavTweak,
|
||||||
ImGuiInputReadFlags_RepeatRateNavTweak = 1 << 3, // Faster
|
|
||||||
ImGuiInputReadFlags_RepeatRateMask_ = ImGuiInputReadFlags_RepeatRateDefault | ImGuiInputReadFlags_RepeatRateNavMove | ImGuiInputReadFlags_RepeatRateNavTweak,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1835,7 +1835,6 @@ struct ImGuiContext
|
|||||||
float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
|
float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
|
||||||
|
|
||||||
// Input Ownership
|
// Input Ownership
|
||||||
bool ActiveIdUsingMouseWheel; // Active widget will want to read mouse wheel. Blocks scrolling the underlying window.
|
|
||||||
ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those nav move requests (e.g. can activate a button and move away from it)
|
ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those nav move requests (e.g. can activate a button and move away from it)
|
||||||
ImBitArrayForNamedKeys ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array.
|
ImBitArrayForNamedKeys ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array.
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
@ -2094,7 +2093,6 @@ struct ImGuiContext
|
|||||||
LastActiveId = 0;
|
LastActiveId = 0;
|
||||||
LastActiveIdTimer = 0.0f;
|
LastActiveIdTimer = 0.0f;
|
||||||
|
|
||||||
ActiveIdUsingMouseWheel = false;
|
|
||||||
ActiveIdUsingNavDirMask = 0x00;
|
ActiveIdUsingNavDirMask = 0x00;
|
||||||
ActiveIdUsingKeyInputMask.ClearAllBits();
|
ActiveIdUsingKeyInputMask.ClearAllBits();
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
@ -2938,19 +2936,22 @@ namespace ImGui
|
|||||||
inline bool IsNamedKey(ImGuiKey key) { return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; }
|
inline bool IsNamedKey(ImGuiKey key) { return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; }
|
||||||
inline bool IsLegacyKey(ImGuiKey key) { return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyNativeKey_END; }
|
inline bool IsLegacyKey(ImGuiKey key) { return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyNativeKey_END; }
|
||||||
inline bool IsGamepadKey(ImGuiKey key) { return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; }
|
inline bool IsGamepadKey(ImGuiKey key) { return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; }
|
||||||
|
inline bool IsAliasKey(ImGuiKey key) { return key >= ImGuiKey_Aliases_BEGIN && key < ImGuiKey_Aliases_END; }
|
||||||
IMGUI_API ImGuiKeyData* GetKeyData(ImGuiKey key);
|
IMGUI_API ImGuiKeyData* GetKeyData(ImGuiKey key);
|
||||||
|
IMGUI_API void GetKeyChordName(ImGuiModFlags mods, ImGuiKey key, char* out_buf, int out_buf_size);
|
||||||
IMGUI_API void SetItemUsingMouseWheel();
|
IMGUI_API void SetItemUsingMouseWheel();
|
||||||
IMGUI_API void SetActiveIdUsingNavAndKeys();
|
IMGUI_API void SetActiveIdUsingNavAndKeys();
|
||||||
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }
|
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }
|
||||||
inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; return g.ActiveIdUsingKeyInputMask[key]; }
|
inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; return g.ActiveIdUsingKeyInputMask[key]; }
|
||||||
inline void SetActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; g.ActiveIdUsingKeyInputMask.SetBit(key); }
|
inline void SetActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; g.ActiveIdUsingKeyInputMask.SetBit(key); }
|
||||||
|
inline ImGuiKey MouseButtonToKey(ImGuiMouseButton button) { IM_ASSERT(button >= 0 && button < ImGuiMouseButton_COUNT); return ImGuiKey_MouseLeft + button; }
|
||||||
IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold = -1.0f);
|
IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold = -1.0f);
|
||||||
IMGUI_API ImGuiModFlags GetMergedModFlags();
|
IMGUI_API ImGuiModFlags GetMergedModFlags();
|
||||||
IMGUI_API ImVec2 GetKeyVector2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down);
|
IMGUI_API ImVec2 GetKeyVector2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down);
|
||||||
IMGUI_API float GetNavTweakPressedAmount(ImGuiAxis axis);
|
IMGUI_API float GetNavTweakPressedAmount(ImGuiAxis axis);
|
||||||
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);
|
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);
|
||||||
IMGUI_API void GetTypematicRepeatRate(ImGuiInputReadFlags flags, float* repeat_delay, float* repeat_rate);
|
IMGUI_API void GetTypematicRepeatRate(ImGuiInputFlags flags, float* repeat_delay, float* repeat_rate);
|
||||||
IMGUI_API bool IsKeyPressedEx(ImGuiKey key, ImGuiInputReadFlags flags = 0);
|
IMGUI_API bool IsKeyPressedEx(ImGuiKey key, ImGuiInputFlags flags = 0);
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } // [removed in 1.87]
|
inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } // [removed in 1.87]
|
||||||
#endif
|
#endif
|
||||||
|
@ -1717,6 +1717,8 @@ void ImGui::TableBeginRow(ImGuiTable* table)
|
|||||||
table->RowTextBaseline = 0.0f;
|
table->RowTextBaseline = 0.0f;
|
||||||
table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent
|
table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent
|
||||||
window->DC.PrevLineTextBaseOffset = 0.0f;
|
window->DC.PrevLineTextBaseOffset = 0.0f;
|
||||||
|
window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);
|
||||||
|
window->DC.IsSameLine = false;
|
||||||
window->DC.CursorMaxPos.y = next_y1;
|
window->DC.CursorMaxPos.y = next_y1;
|
||||||
|
|
||||||
// Making the header BG color non-transparent will allow us to overlay it multiple times when handling smooth dragging.
|
// Making the header BG color non-transparent will allow us to overlay it multiple times when handling smooth dragging.
|
||||||
@ -3957,6 +3959,7 @@ void ImGui::NextColumn()
|
|||||||
{
|
{
|
||||||
// New row/line: column 0 honor IndentX.
|
// New row/line: column 0 honor IndentX.
|
||||||
window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);
|
window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);
|
||||||
|
window->DC.IsSameLine = false;
|
||||||
columns->LineMinY = columns->LineMaxY;
|
columns->LineMinY = columns->LineMaxY;
|
||||||
}
|
}
|
||||||
window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
|
window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
|
||||||
|
@ -4359,9 +4359,10 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
const bool is_select_all = is_shortcut_key && IsKeyPressed(ImGuiKey_A);
|
const bool is_select_all = is_shortcut_key && IsKeyPressed(ImGuiKey_A);
|
||||||
|
|
||||||
// We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful.
|
// We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful.
|
||||||
|
const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
|
||||||
const bool is_enter_pressed = IsKeyPressed(ImGuiKey_Enter, true) || IsKeyPressed(ImGuiKey_KeypadEnter, true);
|
const bool is_enter_pressed = IsKeyPressed(ImGuiKey_Enter, true) || IsKeyPressed(ImGuiKey_KeypadEnter, true);
|
||||||
const bool is_gamepad_validate = IsKeyPressed(ImGuiKey_NavGamepadActivate, false) || IsKeyPressed(ImGuiKey_NavGamepadInput, false);
|
const bool is_gamepad_validate = nav_gamepad_active && (IsKeyPressed(ImGuiKey_NavGamepadActivate, false) || IsKeyPressed(ImGuiKey_NavGamepadInput, false));
|
||||||
const bool is_cancel = IsKeyPressed(ImGuiKey_Escape, false) || IsKeyPressed(ImGuiKey_NavGamepadCancel, false);
|
const bool is_cancel = IsKeyPressed(ImGuiKey_Escape, false) || (nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadCancel, false));
|
||||||
|
|
||||||
if (IsKeyPressed(ImGuiKey_LeftArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }
|
if (IsKeyPressed(ImGuiKey_LeftArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }
|
||||||
else if (IsKeyPressed(ImGuiKey_RightArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); }
|
else if (IsKeyPressed(ImGuiKey_RightArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); }
|
||||||
@ -7805,7 +7806,9 @@ void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id)
|
|||||||
// Called on manual closure attempt
|
// Called on manual closure attempt
|
||||||
void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
|
void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
|
||||||
{
|
{
|
||||||
IM_ASSERT(!(tab->Flags & ImGuiTabItemFlags_Button));
|
if (tab->Flags & ImGuiTabItemFlags_Button)
|
||||||
|
return; // A button appended with TabItemButton().
|
||||||
|
|
||||||
if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
||||||
{
|
{
|
||||||
// This will remove a frame of lag for selecting another tab on closure.
|
// This will remove a frame of lag for selecting another tab on closure.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user