Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gamepad / Keyboard navigation and interactions! #787

Closed
8 of 16 tasks
ocornut opened this issue Aug 21, 2016 · 57 comments
Closed
8 of 16 tasks

Gamepad / Keyboard navigation and interactions! #787

ocornut opened this issue Aug 21, 2016 · 57 comments
Labels
enhancement in progress nav keyboard/gamepad navigation

Comments

@ocornut
Copy link
Owner

ocornut commented Aug 21, 2016

EDIT: The navigation branch has been merged to master. See #1599. Further improvements/fixes will be pushed to mainline.

Opening a new thread because the old one ( #323 ) became overwhelmingly long and unwelcoming. This is a trimmed post with info that are still relevant.

TL;DR; there is a new branch that add supports for gamepad/joystick navigation. The same system can be used for keyboard navigation to some degree, but the initial focus is on gamepad. Typically you can use that to access your tools on PS4/XBone/Wii-U/etc without a synergy/mouse/keyboard setup. Best if you can still have even a virtual mouse around (e.g. on DualShock4 touch pad).

EDIT March 2018
Link to PNG + PSD depicting the controls for DualShock 4 and Joy-Con
https://drive.google.com/open?id=1k4328OV-w20pWZfNcfpH0UoxHHQRkbQi

imgui controls v6 - ps4
imgui controls v6 - switch

EDIT: Now in master!
Branch: https://github.com/ocornut/imgui/tree/navigation
(checkout branch navigation or download from web and overwrite your imgui_xxx files)

imgui-nav-20160821b

I'm calling it beta because:

  • This feature required changing lots of code. The branch probably has bugs.
  • It is rough and work in progress. The more I add and fix things the more I see new things to do. My initial schedule projection was a joke. Long tail feature.
  • But it is pretty useful already!
  • I would ideally like to merge this in master but I can only do so with more testing and feedback.
    Even if you don't need gamepad navigation, using this branch without wiring the inputs would be useful testing.

What I would like from users:

  • See how it fits in your real-world app and what we need to fix/add.
  • Any bug report, questions, features request, welcome. Please be critical!

The development of this feature has been partly sponsored by Insomniac Games (thank you!).

My current mapping for DualShock4

D-Pad up/down/left/right: navigate, tweak values
Cross button: press button, hold to tweak/activate widget, enter child, etc.
Circle button: close popup, exit child, clear selection, etc.
Square button(TAP): access menu, collapsing, window options, etc.
Square button(HOLD)+Dpad: resize window
Square button(HOLD)+Analog: move window
Square button(HOLD)+L/R trigger changes window focus, ALT-TAB style
Triangle button: text input (requires user back-end reading back io.WantTextInput, possibly display an OS keyboard display).
L/R Trigger: slow down/speed up tweaking values
Analog stick: manual scroll.

Quick instructions

// Fill ImGuiIO.NavInputs[] float array every frame to feed gamepad/keyboard navigation inputs.
// 0.0f= not held. 1.0f= fully held. Pass intermediate 0.0f..1.0f values for analog triggers/sticks.
// ImGui uses a simple >0.0f for activation testing, and won't attempt to test for a dead-zone.
// Your code passing analog gamepad values is likely to want to transform your raw inputs, using a dead-zone and maybe a power curve.
enum ImGuiNavInput_
{
    ImGuiNavInput_PadActivate,      // press button, tweak value                    // e.g. Circle button
    ImGuiNavInput_PadCancel,        // close menu/popup/child, lose selection       // e.g. Cross button
    ImGuiNavInput_PadInput,         // text input                                   // e.g. Triangle button
    ImGuiNavInput_PadMenu,          // access menu, focus, move, resize             // e.g. Square button
    ImGuiNavInput_PadUp,            // move up, resize window (with PadMenu held)   // e.g. D-pad up/down/left/right, analog
    ImGuiNavInput_PadDown,          // move down
    ImGuiNavInput_PadLeft,          // move left
    ImGuiNavInput_PadRight,         // move right
    ImGuiNavInput_PadScrollUp,      // scroll up, move window (with PadMenu held)   // e.g. right stick up/down/left/right, analog
    ImGuiNavInput_PadScrollDown,    // "
    ImGuiNavInput_PadScrollLeft,    //
    ImGuiNavInput_PadScrollRight,   //
    ImGuiNavInput_PadFocusPrev,     // next window (with PadMenu held)              // e.g. L-trigger
    ImGuiNavInput_PadFocusNext,     // prev window (with PadMenu held)              // e.g. R-trigger
    ImGuiNavInput_PadTweakSlow,     // slower tweaks                                // e.g. L-trigger, analog
    ImGuiNavInput_PadTweakFast,     // faster tweaks                                // e.g. R-trigger, analog
    ImGuiNavInput_COUNT,
};

Current blurb in imgui.cpp (I know it is cropped by github but please read it)

 USING GAMEPAD/KEYBOARD NAVIGATION [BETA]

 - Gamepad/keyboard navigation support is available, currently in Beta with some issues. Your feedback and bug reports are welcome.
 - See https://github.com/ocornut/imgui/issues/323 discussion thread and ask questions there.
 - The current primary focus is to support game controllers.
 - Consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback.
 - Consider using Synergy host (on your computer) + uSynergy.c (in your console/tablet/phone app) to use PC mouse/keyboard.
 - Your inputs are passed to imgui by filling the io.NavInputs[] array. See 'enum ImGuiNavInput_' in imgui.h for a description of available inputs.
 - For gamepad use, the easiest approach is to go all-or-nothing, with a buttons combo that toggle your inputs between imgui and your game/application.
   Sharing inputs in a more advanced or granular way between imgui and your game/application may be tricky and requires further work on imgui.
   For more advanced uses, you may want to use:
     - io.NavUsable: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set.
     - io.NavActive: true when the navigation cursor is visible (and usually goes false when mouse is used).
     - query focus information with IsWindowFocused(), IsAnyWindowFocused(), IsAnyItemFocused() functions.
   The reality is more complex than what those flags can express. Please discuss your issues and usage scenario in the thread above. 
   As we head toward more keyboard-oriented development this aspect will need to be improved.
 - It is recommended that you enable the 'io.NavMovesMouse' option. Enabling it instructs ImGui that it can move your move cursor to track navigated items and ease readability.
   When enabled and using directional navigation (with d-pad or arrow keys), the NewFrame() functions may alter 'io.MousePos' and set 'io.WantMoveMouse' to notify you that it did so.
   When that happens your back-end NEEDS to move the OS or underlying mouse cursor on the next frame. The examples binding in examples/ do that.
   (Important: It you set 'io.NavMovesMouse' to true but don't honor 'io.WantMoveMouse' properly, imgui will misbehave as it will think your mouse is moving back and forth.)

     // Application init
     io.NavMovesMouse = true;

     // Application main loop
     if (io.WantMoveMouse)
        MyFuncToSetMousePosition(io.MousePos.x, io.MousePos.y);
     ImGui::NewFrame();

   In a setup when you may not have easy control over the mouse cursor (e.g. uSynergy.c doesn't expose moving remote mouse cursor),
   you might want to set a boolean to ignore your other external mouse positions until they move again
  1. THE INITIAL FOCUS IS ON USING A GAME CONTROLLER! The inputs are explicitly named using the word "pad" because the current scheme is optimized for game controllers. You can however trivially map keyboard keys on those inputs and it'll work if you use mouse+keyboard combo. Later on I will focus on keyboard and add especially named enums for keyboard (user expectation for keyboard controls are much higher/harsher than with gamepad).

  2. Depending on your application using gamepad/keyboard might requires more fine-tuned controls of how inputs are dispatched and shared between your app/game and different parts of your imgui interfaces. We may need better options/tooling for that.

  3. It is very probably missing or failing at something that will appear obvious to you. I've nailed many issues and big technical problems but barely started scrapping the surface of all possible usage scenarios. Please report!

  4. The actual scoring function for navigating the graph hasn't been given a lot of love yet and is failing to behave as expected in various cases. Failure usually mean that you press a direction and don't end up exactly where you intended. Will keep improving it. Please report issues with screenshots!

  5. Addition to the public API are rather minimal. New functions IsItemFocused(), IsAnyItemFocused(), SetItemDefaultFocus(), GetKeyPressedAmount(). I agressively made IsItemHovered() be aware of current navigation focus to maximize existing code just naturally working with Nav (typically tooltip pattern). New window flags ImGuiWindowFlags_NoNavFocus ImGuiWindowFlags_NoNavInputs. New colors ImGuiCol_NavHighlight (make it same or close to ImGuiCol_HeaderActive) ImGuiCol_NavWindowingHighlight (white and very transparent), a bunch of keys (read instructions), 1 IO setting NavMovesMouse, 3 IO outputs WantMoveMouse NavUsable NavActive.

  6. The option io.NavMovesMouse is currently off by default. I recommend enabling it. When enabled. the mouse cursor can be moved by ImGui::NewFrame() when directional navigation is used. It does so by overwriting io.MousePos and set io.WantMoveMouse=true. It is up to your backend when that flag is set to apply the new mouse position in your OS. If you enable the option but don't honor those requests, ImGui will be very confused. (this is why I can't have it on by default).

  7. If you are running this on VR, some suggestions: if you want to display ImGui as a static overlay (not affected by head rotation) you may want to reduce DisplaySize and avoid rendering over your entire framebuffer. You can also increase the style.DisplaySafeAreaPadding value. Popups should stay within this rectangle while you can still partly move regular window outside. It might be just better to display it within the 3D world but I haven't tried.

Following in the next message will be my test code for GLFW binding to map a DualShock 4.

TODO list

  • A. Sort-out/finalize all the input bindings correctly.
  • B. Menus: Navigating menus is still awkward in multiple ways.
  • B. Investigate crossing over the boundaries of child windows, in particular those without scroll. Introduce a window flag to flatten child in term of navigation.
  • C. Menubars inside modals windows are acting weird (broken in master as well)
  • A. Problem various problem with graph navigation/scoring functions, currently biased toward vertical layouts.
  • C. Using scrolling should activate scrollbar in a way the user can tell programmatically (e.g. Log window).
  • C. NavHighlight clipping issue within child window.
  • C. Merge all the old FocusIdx tabbing stuff into the new system.
  • B. Resizing window will currently fail with certain types of resizing constraints/callback applied
  • C. Popup: introduce a default validation button e.g. SetItemDefaultValidation() activable from anywhere in the window with Enter. Currently can use imgui_internal.h declared ImGui::PushItemFlag(ImGuiItemFlags_SelectableDontClosePopup, true); / ImGui::PopItemFlag()
  • C. TreeNode: NavLeft to close, NavRight on closed node to open. How would it behave with buttons/items after a closed treenode, and/or multiple columns?
  • B. Can't reliably use Left/Right within menus with regular widgets. Need to figure out a way to only use the Left/Right nav requests for menu open/closure as fallback to a failed moving request.
  • C. Drag/Slider: experiment with keeping item active when activated, using cancel to stop editing.
  • B. Popup: add options to disable auto-closing popups when using a MenuItem/Selectable (Menus API work #126) (not part of Nav)
  • C. Lost of currently focused widget when using buttons that changes labels on click (obvious, but only made apparent with directional navigation- can we automagically work around it?)
  • B. Bug with keeping visibility of navigated them within horizontal scrollbar. Stuck nav (visible in Horizontal Scrolling demo corner. Still there?).
@ocornut
Copy link
Owner Author

ocornut commented Aug 21, 2016

BINDING EXAMPLE CODE

Here's my ugly test binding for GLFW+DualShock4+DS4Window as rough guidance.

We shall make that less ugly but as soon as we venture into controllers it's hard to get anything portable and reliable. Will probably add a dedicated input visualization/configuration window to make it easier. Currently under "Keyboard,Mouse,etc." in the demo window there's a panel that shows all pressed inputs.

EDIT 2017/10/21: introduced ImGuiNavInput_KeyMenu which is the first explicitly keyboard-related enum. It handle the menu toggling like ImGuiNavInput_PadMenu but when held doesn't trigger the window highlight that is used for resizing/moving Windows with the pad.

Gamepad (GLFW, basing mapped on DualShock4+DS4Window)

// Setup directional navigation events/key mapping [BETA]
memset(io.NavInputs, 0, sizeof(io.NavInputs));

// Enable to allow ImGui moving mouse cursor when using keyboard/gamepad navigation
io.NavMovesMouse = true;

// Update Gamepad Inputs
const bool nav_uses_gamepad = true;
if (nav_uses_gamepad)
{
    #define MAP_BUTTON(NAV_NO, BUTTON_NO)       { if (buttons_count > BUTTON_NO && buttons[BUTTON_NO] == GLFW_PRESS) io.NavInputs[NAV_NO] = 1.0f; }
    #define MAP_ANALOG(NAV_NO, AXIS_NO, V0, V1) { float v = (axes_count > AXIS_NO) ? axes[AXIS_NO] : V0; v = (v - V0) / (V1 - V0); if (v > 1.0f) v = 1.0f; if (io.NavInputs[NAV_NO] < v) io.NavInputs[NAV_NO] = v; }
    int axes_count = 0, buttons_count = 0;
    const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &axes_count);
    const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &buttons_count);
    MAP_BUTTON(ImGuiNavInput_PadActivate,   0);
    MAP_BUTTON(ImGuiNavInput_PadCancel,     1);
    MAP_BUTTON(ImGuiNavInput_PadMenu,       2);
    MAP_BUTTON(ImGuiNavInput_PadInput,      3);
    MAP_BUTTON(ImGuiNavInput_PadUp,         10);
    MAP_BUTTON(ImGuiNavInput_PadDown,       12);
    MAP_BUTTON(ImGuiNavInput_PadLeft,       13);
    MAP_BUTTON(ImGuiNavInput_PadRight,      11);
    MAP_BUTTON(ImGuiNavInput_PadFocusPrev,  4);
    MAP_BUTTON(ImGuiNavInput_PadFocusNext,  5);
    MAP_BUTTON(ImGuiNavInput_PadTweakSlow,  4);
    MAP_BUTTON(ImGuiNavInput_PadTweakFast,  5);
    MAP_ANALOG(ImGuiNavInput_PadScrollUp,   1,  +0.3f,  +0.9f);
    MAP_ANALOG(ImGuiNavInput_PadScrollDown, 1,  -0.3f,  -0.9f);
    MAP_ANALOG(ImGuiNavInput_PadScrollLeft, 0,  -0.3f,  -0.9f);
    MAP_ANALOG(ImGuiNavInput_PadScrollRight,0,  +0.3f,  +0.9f);
    #undef MAP_BUTTON
    #undef MAP_ANALOG
}

For keyboard (GLFW)

// Update Keyboard Inputs
const bool nav_uses_keyboard = true;
if (nav_uses_keyboard)
{
    #define MAP_KEY(NAV_NO, KEY_NO) { if (io.KeysDown[KEY_NO]) io.NavInputs[NAV_NO] = 1.0f; }
    MAP_KEY(ImGuiNavInput_PadActivate,      GLFW_KEY_SPACE);
    MAP_KEY(ImGuiNavInput_PadCancel,        GLFW_KEY_ESCAPE);
    MAP_KEY(ImGuiNavInput_KeyMenu,          GLFW_KEY_LEFT_ALT);
    MAP_KEY(ImGuiNavInput_PadInput,         GLFW_KEY_ENTER);
    MAP_KEY(ImGuiNavInput_PadUp,            GLFW_KEY_UP);
    MAP_KEY(ImGuiNavInput_PadDown,          GLFW_KEY_DOWN);
    MAP_KEY(ImGuiNavInput_PadLeft,          GLFW_KEY_LEFT);
    MAP_KEY(ImGuiNavInput_PadRight,         GLFW_KEY_RIGHT);
    MAP_KEY(ImGuiNavInput_PadTweakSlow,     GLFW_KEY_LEFT_ALT);
    MAP_KEY(ImGuiNavInput_PadTweakSlow,     GLFW_KEY_RIGHT_ALT);
    MAP_KEY(ImGuiNavInput_PadTweakFast,     GLFW_KEY_LEFT_SHIFT);
    MAP_KEY(ImGuiNavInput_PadTweakFast,     GLFW_KEY_RIGHT_SHIFT);
    #undef MAP_KEY
}

For keyboard (DX11)

    // Update Keyboard Inputs
    const bool nav_uses_keyboard = true;
    if (nav_uses_keyboard)
    {
#define MAP_KEY(NAV_NO, KEY_NO) { if (io.KeysDown[KEY_NO]) io.NavInputs[NAV_NO] = 1.0f; }
        MAP_KEY(ImGuiNavInput_PadActivate, VK_SPACE);
        MAP_KEY(ImGuiNavInput_PadCancel, VK_ESCAPE);
        MAP_KEY(ImGuiNavInput_KeyMenu, VK_MENU);
        MAP_KEY(ImGuiNavInput_PadInput, VK_RETURN);
        MAP_KEY(ImGuiNavInput_PadUp, VK_UP);
        MAP_KEY(ImGuiNavInput_PadDown, VK_DOWN);
        MAP_KEY(ImGuiNavInput_PadLeft, VK_LEFT);
        MAP_KEY(ImGuiNavInput_PadRight, VK_RIGHT);
        MAP_KEY(ImGuiNavInput_PadTweakSlow, VK_LMENU);
        MAP_KEY(ImGuiNavInput_PadTweakSlow, VK_RMENU);
        MAP_KEY(ImGuiNavInput_PadTweakFast, VK_LSHIFT);
        MAP_KEY(ImGuiNavInput_PadTweakFast, VK_RSHIFT);
#undef MAP_KEY
}

Will improve this skeleton in user examples, but I don't really expect to be able to provide working examples for all backends and controllers just because mapping gamepad buttons is an unsolved computer science mystery. I'll probably devise a set of functions where mapping can easily be setup from the outside.

@unpacklo
Copy link

Not particularly helpful feedback, but thought I'd let you know that I'm currently seeing these warnings on PS4:

imgui.cpp(2965,9): warning : add explicit braces to avoid dangling else [-Wdangling-else]
imgui.cpp(3788,13): warning : unused function 'IsKeyDownMap' [-Wunused-function]

We tend to compile with -Wall !

-Dale Kim

@karacaenes
Copy link

Hmm. Depends on how you design the ui but this could actually make imgui useful on embedded devices where there is no mouse and only a keypad as the only input device. I will give it a try soon, possibly with a directfb backend. I have such device at my hand, which only has a numberpad, up and down buttons an enter button in the middle of them and a couple of other keys that could be used as left/right or tab keys. Right now i am drawing everything with DirectFB myself and getting input one screen at a time. (enter username on one screen press enter, enter password on another screen press enter, see a loading screen, get presented with a menu that covers whole screen etc.)

@uglycoyote
Copy link

Thanks so much for the progress on getting gamepad navigation working.

We have an existing custom (non-imgui) tree-based debug menu in our game. I created an alternate implementation in ImGui and am considering deprecating the old one eventually. It mostly depends on getting the game-pad support right as we don't always have the ability to use mouse on our game builds.

The menu is essentially just a big tree containing mostly booleans, ints and floats and "triggers", so in the imgui implementation they are mostly checkboxes, sliders, and buttons.

I'm trying out the latest 2016-07-Navigation branch. At the moment I'm finding the dpad left/right behaviour particularly frustrating.

In my case the thing I'm trying to replace something that users have been using for about 10 years and the controls are ingrained in everyone's muscle memory so it would be nice to be able to configure the controls in ImGui to work as similar as possible to how the tree navigation works under that system.

This is how our existing menu system works and how I hoped ImGui would be able to configured to work:

When focused on a folder in the tree:

  • Press PadRight or "A" (activate) to expand a folder in the tree
  • Press PadLeft or "B" (cancel) to collapse the folder

When focused on a leaf node in the tree

  • Press PadRight or "A" to toggle a checkbox or activate a button
  • Press PadRight or PadLeft to adjust a slider
  • Press B to collapse the parent folder and set parent as the focused item

In ImGui Pressing PadRight takes the focus away from wherever you are in the tree and off to never-never land. From looking at the code I understand that it's using some kind of scoring system for determining where the focus goes, but at least in my use case it feels wrong and unpredictable. It either focuses another item higher in the tree (presumably because that item is indented more to the right) or it jumps the focus to a "Clear" button that I have on the filter box at the top of the tree. Either way it's taking the input focus away from something that you just pressed the d-pad a few dozen times to get to, so it's frustrating in that regard.

I know others on this thread and the previous one have said similar things, but the rebuttal was that the dpad navigation needs to be able to work with multiple columns and with tree nodes which have multiple things in them that you can focus on. But in my case I only have one column and each tree node only has one focusable element, (basically the simplest kind of tree) so it would be nice if it worked well in this situation.

The scoring system leads to unpredictable jumping of focus which takes the user a long time to recover from. IMHO the scoring system should only be used when there's not some simpler more direct context-specific interpretation of the arrow keys. Once you enter the "tree navigation" context it should not use the scoring system anymore but a more custom logic for interpreting directional inputs such as the rules I listed above.

@ocornut
Copy link
Owner Author

ocornut commented Aug 8, 2017

NB: The branch has been renamed from 2016-07-navigation to navigation removing the date in it. I think the date made people think the branch was not keep up to date, while my intent was merely to note approximate date a branch was being worked on. Of course, for those long standing branch it doesn't make much sense. I'll be using the date when closing branches.

ocornut added a commit that referenced this issue Aug 22, 2017
ocornut added a commit that referenced this issue Aug 29, 2017
ocornut added a commit that referenced this issue Aug 29, 2017
…ch into Master to reduce differences. Some code in NewFrame() has been moved around. (#787)
@ocornut
Copy link
Owner Author

ocornut commented Aug 29, 2017

Update: while I don't have a date for merging this branch, I have already merged many of the non-strictly-navigation-related changes back to Master, so the diff between branches is smaller (and some of the changes will be tested a little more due to being in Master already).

@inolen
Copy link
Contributor

inolen commented Sep 18, 2017

Just gave this an initial spin - it worked right out of the box!

Out of curiosity, I skimmed #323, what was the reasoning for moving to the NavInputs array vs reusing the existing KeysDown / KeyMap setup? When initially setting everything up, I realized I was just assigning NavInputs[key] = KeysDown[KeyMap[key]]; effectively.

Edit: Just realized, it seems to make navigation from multiple inputs work, e.g. also letting the user scroll through touch events.

ocornut added a commit that referenced this issue Sep 18, 2017
@inolen
Copy link
Contributor

inolen commented Sep 19, 2017

@ocornut first off, apologies for all of the issue spam, I'm on a death march to get an initial frontend UI going for https://github.com/inolen/redream.

I've been playing with this branch to try and get my UI to work as I'd like, and after hacking around a bit it works really well, but I'm not sure how to make my changes in a manageable fashion.

I've posted a few photos before, but to reiterate, the UI is just like Netflix, Steam Big Picture, etc.:
discs

What I wanted to do here was flatten the parent / child navigation, while still enabling the child window to scroll when moving left / right starting from one of the items in the child window.

To do so, I hacked this up:
https://gist.github.com/inolen/b460ae06d05f55390c6dde4709888657

What I've done is hacked in the NavMoveResultWindow, and removed the g.NavWindow->ScrollbarX part of the conditional that enables the window to scroll.

I have no problem doing more work on this, I just need a bit of direction - I'm very motivated to get this work done.

@ocornut
Copy link
Owner Author

ocornut commented Sep 19, 2017

what was the reasoning for moving to the NavInputs array vs reusing the existing KeysDown / KeyMap setup?
Edit: Just realized, it seems to make navigation from multiple inputs work, e.g. also letting the user scroll through touch events.

Also, in my experiments I found that input logic has to be specialized for gamepad type vs keyboard type, there are specifying controls that makes sense for typical gamepad (holding Square + L/R doesn't work exactly the same as Ctrl+Tabbing would work). So for now note that those enums are named after the Gamepad. The branch is also marked Beta for this reason that not everything has been 100% designed.

What I wanted to do here was flatten the parent / child navigation, while still enabling the child window to scroll when moving left / right starting from one of the items in the child window.

I think you are hitting a few barriers that we'd need to lift and this is an interesting use case. Navigating between Games and Options I'd imagine the normal Nav system would be practical, but for your Dreamcast cover browsing you are probably better off making something custom.

Similarly to your issue #1328 I think you may be using a generic-over-engineered piece of feature (the Nav system) for something you could more easy recreate yourself, may be worth going that path short term. And you are not going to get the nice custom smooth scrolling that your apps wants using the immediate focusing?

At the least I think we need to support a way for user code to hook/disable certain Nav inputs so they can be processed by the code, so you could process Left/Right yourself. And we probably need an internal flag to signify "x scrolling" allowed that's independant of ScrollbarX.

PS: I'm just blurting those thoughs but haven't actually dug into your use case or code very much. Your gist/patch is useful for reference. I appreciate it is an interesting use case that I would like to have solved, I just don't have so much time to think about it right now.

@inolen
Copy link
Contributor

inolen commented Sep 19, 2017

@ocornut thanks for the comments!

I agree wrt using the nav system, using something hand-rolled probably makes the most sense giving its limited scope right now.

@inolen
Copy link
Contributor

inolen commented Sep 21, 2017

@ocornut noodling some this morning, how would a nav hook / callback work?

Would there be an IsItemNavigated function that could be called after adding each item. with some option to disable the automatic scrolling, etc.?

@ocornut
Copy link
Owner Author

ocornut commented Sep 21, 2017

I don't know yet. Part of the work is figuring out the design. It's in my list and there is a decent chance I'll be able to focus on the Navigation branch on the upcoming few months.

ocornut added a commit that referenced this issue Sep 27, 2017
ocornut added a commit that referenced this issue Aug 2, 2021
…d + fix GLFW uninstalling handler + tweaks to reduce branch drift with docking. (#787, #2445, #2696, #3751, #4377)
ocornut added a commit that referenced this issue Aug 2, 2021
…d + fix GLFW uninstalling handler + tweaks to reduce branch drift with docking. (#787, #2445, #2696, #3751, #4377)

# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_sdl.cpp
#	backends/imgui_impl_win32.cpp
ocornut added a commit that referenced this issue Aug 17, 2021
… it to true, relied on Alt release only). Removed unnecessary KeyMenu_ from NavInput. (#4439, #787)
AnClark pushed a commit to AnClark/imgui-vst-mod that referenced this issue Aug 30, 2021
… it to true, relied on Alt release only). Removed unnecessary KeyMenu_ from NavInput. (ocornut#4439, ocornut#787)
AnClark pushed a commit to AnClark/imgui-vst-mod that referenced this issue Aug 30, 2021
… it to true, relied on Alt release only). Removed unnecessary KeyMenu_ from NavInput. (ocornut#4439, ocornut#787)
ocornut added a commit that referenced this issue Nov 8, 2021
ocornut added a commit that referenced this issue Nov 10, 2021
bojosos pushed a commit to bojosos/imgui that referenced this issue Nov 16, 2021
…d + fix GLFW uninstalling handler + tweaks to reduce branch drift with docking. (ocornut#787, ocornut#2445, ocornut#2696, ocornut#3751, ocornut#4377)

# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_sdl.cpp
#	backends/imgui_impl_win32.cpp
actondev pushed a commit to actondev/imgui that referenced this issue Nov 26, 2021
actondev pushed a commit to actondev/imgui that referenced this issue Nov 26, 2021
ocornut added a commit that referenced this issue Dec 30, 2021
… (amend 1dc3af3, 23ef6c1, 657073a)

+ Expose FindHoveredViewportFromPlatformWindowStack() in imgui_internal.h
ocornut added a commit that referenced this issue Jan 20, 2022
…AddKeyAnalogEvent(), stopped writing to io.NavInputs[]. (#4858, #787)
ocornut added a commit that referenced this issue Jan 20, 2022
…ddKeyAnalogEvent(), stopped writing to io.NavInputs[]. (#4858, #787)
ocornut added a commit that referenced this issue Jan 20, 2022
…dKeyAnalogEvent(), stopped writing to io.NavInputs[]. (#4858, #787)
ocornut pushed a commit that referenced this issue Jan 20, 2022
…dKeyAnalogEvent(), stopped writing to io.NavInputs[]. (#4858, #787)
ocornut added a commit that referenced this issue Jul 25, 2022
…ding config flags (#5504). Fixes 8b8a61b. #4921, #4858, #787, #1599, #323)

NavUpdate() can now clears ImGuiInputSource_None.
DnA-IntRicate added a commit to DnA-IntRicate/imgui that referenced this issue Oct 7, 2022
* Docking: added comments. added experimental TabItemFlagsOverrideSet to ImGuiWindowClass.

(Could probably do something similar with TabBarFlagsOverrideSet+Clear for ocornut#2700 later.)

* Docking: docked window honor tab and text colors by storing them. (ocornut#2771)

Later to lead into ocornut#2700 and ocornut#2539
Move tab submission block above in DockNodeUpdateTabBar(), not strictly necessary for this change as is, but useful if needing to apply override for TitleBg* as we'd need a value for node->VisibleWindow earlier than currently set.

* Fixed some compile warnings with Clang on Windows (ocornut#3754)

* Viewports, Backends: Vulkan: handle VK_ERROR_OUT_OF_DATE_KHR when resizing secondary viewport (ocornut#3766, ocornut#3758)

Cannot repro here but appears to a user on Linux. Fix may be not super solid.

* Docking: on node split, update memorized DockId for currently closed windows (ocornut#3716)

Amended by @ocornut with same fix in DockBuilderRemoveNodeChildNodes().

* Docking: fix gap in hit test hold when using ImGuiDockNodeFlags_PassthruCentralNode touching the edge of a viewport. (ocornut#3733)

* Viewports: (breaking) removed ImGuiPlatformIO::MainViewport which is now pretty much unused and duplicate (and misleading as we will evolve the concept)

Use GetMainViewport() if stuck.

* Viewports: Moved in own section of imgui.h ahead of merging a small part of viewport interface to master.

* Viewports: trying to treat GetMainViewport() as const. Reducing unnecessary casts of ImGuiViewportP*

Metrics: readded root Drawlists node in metrics to match master.
The (void*) casts are implying const-casst but currently left GetMainViewport() as returning non-const.

* Viewports: (Breaking) turned GetWorkPos(), GetWorkSize() into straight fields -> WorkPos, WorkSize before exposing in master branch.

* Fix for compiling imgui_internal.h without operators + made GetWorkRect() consistent with clamped WorkSize.

* Misc tweaks - mostly toward minimizing diff in upcoming backport merge of a few viewport structures in master

* Viewports: Fix issue inferring viewport z-order when new popups gets created. (ocornut#3734) + Metrics updates.

Revert 6bc5266
Showing inferred order and missing flags in metrics.

* Viewports: Setting the new (currently dummy) flags on viewports. (ocornut#3789, ocornut#1542, ocornut#3680, ocornut#3350, ocornut#3012, ocornut#2471)

Amend the merging of f14042c (merge ee59d7a)

* Remove redundant GetMainViewport decl in imgui.h (ocornut#3801, ocornut#3800)

* Docking: Made close button enable logic consistent on dockspace. When no docked window have a close button or it is disabled on the node, the space is given to tabs.

Clarified close_button_is_visible vs close_button_is_enabled behavior in DockNodeUpdateTabBar().. (ocornut#3633, ocornut#3521)
Reduced alpha of disabled close button a little bit further.
Removed 'EnableCloseButton' which was actually unused (can't be infered early, need ->VisibleWindow anyway, which is not == ->ActiveWindow)

* Examples: DX9-DX11: Removed half-assed DPI awareness enable. Updated Docking/Viewports part of Changelog (e.g. removed bits that are now already in master, clarified some added bits)

* Viewports: Fix setting of ImGuiViewportFlags_NoRendererClear. (ocornut#3213)

* Internals: Add a way to request window to not process any interactions for specified number of frames.

* Added missing IMGUI_API to internal docking-related structs. (ocornut#3850)

* Internals: Docking: some renaming.

* Internals: rename RootWindow->RootWindowDockTree, RootWindowDockStop->RootWindow.

Why?  So by default RootWindow matches user expectation on both branches, and RootWindowDockTree is more intentful.
(Actually should reduce diff between master<>docking)

* Viewports, Backend: SDL: Fix missing ImGuiBackendFlags_HasSetMousePos flag in docking branch (ok in master), GLFW: Fix application of WantSetMousePos. (ocornut#1542, ocornut#787)

Shows how little this feature is used with nav (was designed for small devices and frankly may be dropped) - but the backend support itself we will make use of for other features.

* Viewports, Internals: added GetViewportPlatformMonitor() will a safety net to keep code portable + simplified handling of disconnected monitor in Begin().

* ImDrawFlags: rework/revert c2d6d26 + 39432bf in a way that is closer to old version and back to opt-in but with default 0 = all corners.

* Removed deprecated flag stopping compilation (ocornut#3902)

* Docking: Dockspace() never draws a background. (ocornut#3924)

* Docking: undocking nodes/windows covering most of the monitor max their size down to 90% to ease further manipulations.

Kind of a welcome hack.

* Docking: Add support for split_outer in DockContextCalcDropPosForDocking().
Misc: Add FIXME regarding behavior of some window fields.

* Viewports, Backends: Vulkan: Rebuild swapchain on VK_SUBOPTIMAL_KHR. (ocornut#3881)

* BeginMainMenuBar(): remove expectation that we don't know menu bar height ahead, allowing up to generalize placement in any direction (will be done in master)

Amend 75de34e

* Viewports: Hotfix for crash in monitor array access, caused by 4b9bc49. (ocornut#3967)

* TabBar: Use mouse position instead of hardcoded +1/-1 offset when reordering tabs.

Fixes tab reordering in test engine when using fast mode.

# Conflicts:
#	imgui_widgets.cpp

* TabBar: Amend previous commit. Fix tab reordering when tab bar has scrolling.

Some tidying up with helpers + honor 16-bit offsets as with other tab bar features (unlikely single reorder can reach that but consistent)

* Backends, Viewports: GLFW: Add a workaround for stuck keys after closing a GLFW window (ocornut#3837).

* Docking: DockSpace() returns its node ID + adding branch changelog.

* Docking: fix undocking from tab-bar by moving mouse horizontally, broken by d705192.

* Docking: removed io.ConfigDockingWithShift option. (ocornut#2109)

* Docking: fix undocking from tab-bar by moving mouse horizontally, amend 3ed07a8 + d705192.

Automation system may drag e.g. right-most tab far left (and vice-versa) and one frame and our current logic would fail at it.

* Fix popup positioning, broken by 84e6fe4. (ocornut#3991, ocornut#3982)

* Docking: Fixed restoring of tab order within a dockspace or a split node.

(tests in "docking_tab_order")

* Docking: Fixed multiple simultaneously reappearing window from appearing undocked in their initial frame.

* Docking: Fixed reappearing docked windows with no close button showing a tab with extraneous space for one frame.

* Docking: move NavWindow to SelectedTabId application lower to leave a chance for in-between code to alter focus. + store per-node window menu button id to simplify usage.

* Docking: Fix window menu button. Broken by 3f16a52 (ocornut#4043)

Worked on single-frame click.

* Changelog: added docking+entries from 1.72 to 1.82 to increase their visibility.

* Backends: Vulkan: Fix for using IMGUI_IMPL_VULKAN_NO_PROTOTYPES (ocornut#4151, ocornut#3759, ocornut#3227)

* Docking: Docking node tab bar honors ItemInnerSpacing.x before first tab. Tweak rendering and alignment of dock node menu marker. (ocornut#4130)

+ Fix ~0 in EndFrameDrawDimmedBackgrounds() which is obsolete way of signifying "all round corners".

* Docking: Fix IsWindowAppearing() and ImGuiCond_Appearing on docked windows. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061)

* Docking: Amend 91704b7, window->DockXXX booleans not properly cleared when window not docked. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061)

Fix issue with freshly split windows/nodes incorrectly returning true to IsWindowAppearing().

* Docking: Fix IsWindowAppearing() unnecessarily returning true twice in a row. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061) + added a zealous assert.

* Docking: Clicking on the right-most close button of a docking node closes all windows. (ocornut#4186)

* Docking: comments (ocornut#4189)

* Added PushDisabled(), PopDisabled() currently only exposed in imgui_internal.h (ocornut#211)

* ImVector: added clear_delete(), clear_destruct() helpers.

# Conflicts:
#	imgui.cpp

* Nav, Drag and Drop, Docking: fixed two issues leading nav result to conflict with moving a window. (ocornut#4211, ocornut#3025)

* Backends, Viewports: Vulkan: Fix the use of the incorrect fence in wait for fence. (ocornut#4208)

The fence being waited upon was not the one associated with the current frame.
This results in validation error detecting a reset of command buffers still in use and resetting fences while still in use.
Read more details in ocornut#4208

* Metrics: Tentative fix for bad printf format.

Ref b53b8f5, a7a1b3b

* Viewport: extracted code out of Begin() into WindowSyncOwnedViewport() - no other change

* Viewports: Fix popup/tooltip created without a parent window from being given a ParentViewportId value of the implicit/fallback window. (ocornut#4236, ocornut#2409)

Amend 3ead982

* Backends: amends to 1db1066 + merge minor bits from docking incl SetActiveIdUsingNavAndKeys().

No need to clear fields before deletion. DX12: renamed to match docking branch.

* Backends: Viewports: renamed viewport storage structures ImGuiViewportDataXXXX -> ImGui_ImplXXXX_ViewportData and locals (matching naming convention in 70c6038)

* Docking: removed DockNodeFlagsOverrideClear flags from ImGuiWindowClass. (ocornut#2999, ocornut#3521, ocornut#3633)

+ extraded bits of metrics into DebugNodeDockNodeFlags()

* Docking: Reworked node flags saving/inheritance... (ocornut#4292, ocornut#3834, ocornut#3633, ocornut#3521, ocornut#3492, ocornut#3335, ocornut#2999, ocornut#2648)

..so that flags enforced by docked windows via the DockNodeFlagsOverrideSet mechanism are are not left in empty dockspace nodes once the windows gets undocked.

* Docking: Added ImGuiDockNodeFlags_NoDockingOverEmpty. Breaking definition of ImGuiDockNodeFlags_NoDockingOverOther which now means "non empty node". (ocornut#3492, ocornut#2648, ocornut#4292)

* Docking: Fixed crash issues using DockBuilderRemoveNode() in some situations. (ocornut#3111, ocornut#3179, ocornut#3203, ocornut#4295)

If the deleted root node isn't part of a dockspace with a central node, it won't be "protected" but removed when last window gets removed.

* Docking: Fix crash when a dock node gets re-qualified as dockspace>floating>dockspace.. (ocornut#3203, ocornut#4295)

Which tends to happen when incorrectly calling DockBuilderAddNode() without ImGuiDockNodeFlags_Dockspace and using it as a Dockspace on the next frame after the floating window hosting the node has been automatically created.

* Added missing IMGUI_API to GetViewportPlatformMonitor. (ocornut#4309)

* Backends: Win32, SDL, GLFW: only honor io.WantSetMousePos when focused + fix GLFW uninstalling handler + tweaks to reduce branch drift with docking. (ocornut#787, ocornut#2445, ocornut#2696, ocornut#3751, ocornut#4377)

# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_sdl.cpp
#	backends/imgui_impl_win32.cpp

* IO: modify io.AddFocusEvent() to tolerate in/out for multi-viewports. Amend 2f40be6. (ocornut#3532)

* Fix BeginDisabled(false), (ocornut#211, ocornut#4452)

* Fix BeginDisabled(false), again, (ocornut#211, ocornut#4452, ocornut#4453) Version 1.84.1

(forced pushed since our earlier versioning didn't sort correctly in github web)

# Conflicts:
#	docs/CHANGELOG.txt

* Backends: GLFW: Fixed unused variable warning for empty assert macro. (ocornut#4459)

* Docking: fixed settings load issue when mouse wheeling. (ocornut#4310)

* Docking: fix 58f5092 (ocornut#4310)

If we clear _ChildWindow flag we must remove it from here otherwise render loop will fail.

* Docking: warning fix for when IM_ASSERT() is empty

* Fixed bad merge of Changelog in docking branch

* Internals: refactored IsWindowHovered()/IsWindowFocused() to make their logic more similar + change underlying value of ImGuiHoveredFlags_AllowWhenBlockedByPopup + comment out docking only flags.

* Fixed _ChildWindows from leaking docking hierarchy. Added ImGuiFocusedFlags_DockHierarchy and ImGuiHoveredFlags_DockHierarchy.

* Viewports: fixed unnecessary creation of temporary viewports when multiple docked windows got reassigned to a new node (created mid-frame) which already has a HostWindow

* Viewports: Fixed a crash while a window owning its viewport disappear while being dragged.

t would manifest when e.g. reconfiguring dock nodes while dragging.

* Viewports: fix window with viewport ini data immediately merged into a host viewport from leaving a temporary viewport alive for a frame (would leak into backend).

* Fixed IsWindowFocused/IsWindowHovered with _ChildWindows for not following through popup parents (amend 6b1e094, fix ocornut#4527)

* Viewports: extracted DestroyViewport() out of UpdateViewportsNewFrame() function.

* Docking: bits.

* Docking: floating node with a central node hides properly when nothing is docked + rename.

* Docking: Improved resizing system so that non-central zone are better at keeping their fixed size.

* Nav: Fixed an issue with losing focus on docked windows when pressing Alt while keyboard navigation is disabled. (ocornut#4547, ocornut#4439)

* Docking: Fixed IsItemHovered() and functions depending on it (e.g. BeginPopupContextItem()) when called after Begin() on a docked window (ocornut#3851)

Fix ee643b2

* Added ImGuiFocusedFlags_NoPopupHierarchy and ImGuiHoveredFlags_NoPopupHierarchy (followup ocornut#4527)

IsWindowFocused: fix flag usage (amend 6b1e094) was technically harmless because of light typing.

* Docking: reinstate io.ConfigDockingWithShift option. (ocornut#4643)

This more or less reverts commit 3ed07a8.

* Fixed nested BeginDisabled()/EndDisabled() bug in Docking branch due to bad merge. (ocornut#4655, ocornut#4452, ocornut#4453, ocornut#4462)

* Backends: Made it possible to shutdown default Platform Backends before the Renderer backends. (ocornut#4656)

* Viewports: Made it possible to explicitly assign ImGuiWindowClass::ParentViewportId to 0. (ocornut#3152, ocornut#2871)

* Fixed tooltip in own viewport over modal from being incorrectly dimmed. (ocornut#4729)

Normally we would aim to ensure that g.Windows[] gets maintained to reflect display layer but it is presently non trivial.

* Fixed crash on right-click without modal, introduced by previous commit a3667f4,  (ocornut#4729)

* Viewports: fix missing default per-window value for ParentViewportId due to zero-cleared in-window instance (ocornut#4756)

Broken by 2080d12

* Docking: Fixed a bug undocking windows docked into a non-visible or _KeepAliveOnly dockspace. (ocornut#4757)

* Docking: Fix typo (had no side effect) (ocornut#4778)

Co-authored-by: Mikko Sivulainen <mikko.sivulainen@supercell.com>

* Viewports: Fixed CTRL+TAB highlight outline on docked windows not always fitting in host viewport + moved EndFrameDrawDimmedBackgrounds() call + removed duplicate code in Begin() already in EndFrameDrawDimmedBackgrounds()

* Docking: Fixed incorrectly rounded tab bars for dock node that are not at the top of their dock tree.

* Docking: Fixed single-frame node pos/size inconsistencies when window stop or start being submitted.

Fix 718e15c while preserving its intended property. Tested by "docking_window_appearing_layout". (ocornut#2109)

* Docking: internals: extracted rounding corner calculation into reusable CalcRoundingFlagsForRectInRect() function.

* Docking: docked windows honor ImGuiCol_WindowBg. Host window in charge of rendering seams. (ocornut#2700, ocornut#2539 + Docked windows honor display their border properly. (ocornut#2522)

Plus: better support for transparent one in nodes
Side effects: DockContextBindNodeToWindow doesn't alter node->IsVisible.
Side effects: ImDrawList:: _ResetForNewFrame() needs to merge, sane (in case of
(Amended, force-pushed)

* Docking: Amend b16f738 fixed dimming of docked window + removed thin highlight around windows (never worked on docked window, not viewports friendly, hard to move to EndFrame) (ocornut#2700, ocornut#2539, ocornut#2522)

* Nav, Docking: reworked modal/ctrl+tab dimming system to be entirely processed at end of the frame, which will simplify things for an upcoming commit.

(Will backport some of this back to master now.)

* Nav, Docking: Fix dimming on docked windows.

* Nav, Docking: Fix crash on dimming docked window and DockSpaceOverViewport() with PassthruCentralNode.

(amend 1dc3af3, 23ef6c1, 657073a)

* Added an assertion for the common user mistake of using "" as an identifier at the root level of a window. (ocornut#1414, ocornut#2562, ocornut#2807, ocornut#4008, ocornut#4158, ocornut#4375, ocornut#4548, ocornut#4657, ocornut#4796)

  ocornut#4158, ocornut#4375, ocornut#4548, ocornut#4657, ocornut#4796)

* Docking: prevent docking any window created above a popup/modal. (ocornut#4317)

* Internals: UpdateWindowInFocusOrderList: amend a528398 to fix docking. (ocornut#3496, ocornut#4797)

* Internals: reduced side-effects of setting window->HiddenFramesForRenderOnly > 0

* Viewports: Fixed a CTRL+TAB crash with viewports enabled (ocornut#4023, ocornut#787) (amend 1dc3af3, 23ef6c1, 657073a)

+ Expose FindHoveredViewportFromPlatformWindowStack() in imgui_internal.h

* Update .gitignore

* Backends: OSX: Fixed typo.

* Rename io.AddKeyModEvent() -> io.AddKeyModsEvent() and updated backends accordingly. (ocornut#2625, ocornut#4858)

Amend 790132a (breaking)

# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_sdl.cpp
#	backends/imgui_impl_win32.cpp

* IO: fix SetKeyEventNativeData() not handling ImGuiKey_None the same way as AddKeyEvent(). (ocornut#4905, ocornut#4858)

* Merge "Backends: SDL: Fix for Emscriptem. Amend 98ce013." + Fix bad merge from master of "is_app_focused" property (Amend 0647ba3)

* Viewports: Fixed active InputText() from preventing viewports to merge. (ocornut#4212)

* Viewports: Relaxed specs for backend supporting ImGuiBackendFlags_HasMouseHoveredViewport. Backends: SDL: Added support for simplified HasMouseHoveredViewport. (ocornut#1542, ocornut#4665)

* IO: added AddMouseViewportEvent() + used in backends.

* Docking: Fixed a CTRL+TAB crash when aiming at an empty docked window. (ocornut#4792)

* Revert moving ImGuiKeyModFlags to internal.h (amendc906c65)

# Conflicts:
#	imgui.cpp

* Backends: SDL: no support for ImGuiBackendFlags_HasMouseHoveredViewport under OSX/LInux (ocornut#4960)

* Docking: Fixed size constraints not working on single window holding on a dock id (still doesn't work on docked windows).

* Docking: Tabs use their own identifier (in order to make window->ID refer to whole window in test engine).  Also prevents Tab ID from clashing with "" which was common.

* Docking: Fixed CTRL+TAB back into a docked window not selecting menu layer when no item are on main layer.

Could merge on master.

* Backends: SDL: Amend 08350e5, multi-viewports mouse tracking works under Linux. (ocornut#4960) + Reword tests to help static analysis.

* Docking: fixed potential crash if a passthrough dock node is submitted without a child intermediate (currently not possible via API)

* Internals: rework RenderMouseCursor() signature so we can use it in docking branch more naturally. (Merged from master+ rework for docking)

# Conflicts:
#	imgui.cpp
#	imgui_draw.cpp

* Viewports: Fixed main viewport size not matching ImDrawData::DisplaySize for one frame during resize when multi-viewports are disabled. (ocornut#4900)

* Docking: Fixed floating docked nodes not being clamped into viewport workrect to stay reachable when g.ConfigWindowsMoveFromTitleBarOnly is set and multi-viewports are disabled. (ocornut#5044)

* Viewports: Fixed translating a host viewport from briefly altering the size of AlwaysAutoResize windows. (ocornut#5057)

* Backends: SDL: Fix multi-viewport dragging issue with SDL on some systems. (ocornut#5012)

* Backends: SDL: Fix more dragging issues. SDL_CaptureMouse() is essentially broken. (ocornut#5012, ocornut#5082)

master got c5f6721 which is combining f337378 and this commit.

* Windows: Fixed first-time windows appearing in negative coordinates. (ocornut#5215, ocornut#3414)

Regression added in 6af92b0

* Backends: OSX, Metal: Added multi-viewports support. (ocornut#4821, ocornut#2778)

* Backends: OSX, Metal: Amend d111133, tidying up, remove unused, misc tweaks. . (ocornut#4821, ocornut#2778)

* Backends: OSX: Implement ImGui_ImplOSX_ShowWindow(). (ocornut#5299)

* Examples: Apple+OpenGL: Fix build.

* Docking: Fixed moving window being interrupted when undocing a window with "io.ConfigDockingAlwaysTabBar = true". (ocornut#5324)

Regression introduced in 6b77668

* Docking: Fix unhiding tab bar regression. (ocornut#5325, ocornut#5181)

Broken by 9038678

* Misc: Fix custom assertion macro failing to compile imgui.cpp (ocornut#5378)

* Docking: Fixed incorrect focus highlight on docking node when focusing empty central node or a child window which was manually injected into a dockspace window.

* Backends: SDL+GLFW, Examples: SDL+Metal, GLFW+Metal: Fix viewport support with Metal backend.

Fixes ocornut#5392 + alignment fixes and removed static_cast<> + Amended with fix.

* Docking, Modal: Fixed a crash when opening popup from a parent which is being docked on the same frame. (ocornut#5401)

Ideally we should untangle the purpose of parent_window_in_stack / ParentWindowInBeginStack better.

* Docking: Amend 24dfebf. Fixed incorrect focus highlight on docking node with nested hierarchies.

* Backends: GLFW: Fixed leftover static variable preventing from changing or reinitializing backend while application is running. (ocornut#4616, ocornut#5434)

* Backends, Viewport: Metal: Pull format from shared context. (ocornut#5403, ocornut#5437)

* Docking, Nav: Fixed using gamepad/keyboard navigation not being able enter menu layer  (ocornut#5463, ocornut#4792)

Fix 37958ca

* Docking: Fix docked window contents not rendering when switching with CTRL+Tab.

(regression from 8eb8689).

* Internals: Docking: make DockContextFindNodeByID() more visible (instead of DockBuilderGetNode)

+ using defines for channel changes.

* Docking: Fixed splitting/docking into a node that has buttons amended into tab bar. Windows were not moved correctly. (ocornut#5515)

* Docking: Fixed amending into an existing tab bar from rendering invisible items. (ocornut#5515, amend b16f738 ocornut#2700, ocornut#2539)

Commit b16f738 left us with a "current" channel 0 which seems inadequate. Undoing that, assuming default is always 1, code filling bg color does a switch. Only DockContextEndFrame() leave it at 0 and it's not particularly necessary.

* Docking+Viewports: Fix undocking window node causing parent viewport to become unresponsive. (ocornut#5503)

Amend 67be485, Somehow ties to 58f5092 + 0eb45a0 (ocornut#4310)
Unsure of exact chain of event but this caused a parent link msimatch between the time of the MouseMoving test in AddUpdateViewport() setting _NoInputs on the wrong parent., and the release clearing _NoInputs on the rght one.

* Docking: Simplify logic of moving tabs between nodes. Amends 0abe7d. (ocornut#5515)

The idea is that in the absence of a tab bar, as new one gets created new tabs will be sorted based on window->DockOrder so this may work but we're not 100% sure.

* Docking: Add source dock node parameter DockContextCalcDropPosForDocking() to facilitate test engine (un)docking nodes before they are split out to their own window.
Metrics: Display dock_node->Windows in node metrics.

* Internals: Docking: rename HoveredDockNode to DebugHoveredDockNode to clarify that it isn't usable for much other than debugging.

* Nav: Fixed regression in e99c4fc preventing CTR+Tab to work without NavEnableKeyboard (ocornut#5504, ocornut#4023);

* Obsoleted using SetCursorPos()/SetCursorScreenPos() to extend parent window/cell boundaries. (ocornut#5548)

This incorrect pattern has been mentioned or suggested in: ocornut#4510, ocornut#3355, ocornut#1760, ocornut#1490, ocornut#4152, ocornut#150

# Conflicts:
#	imgui.cpp

* Backends: SDL: Fixed building backend under non-OSX Apple targets (e.g. iPhone). (ocornut#5665)

* Docking: Fixed incorrect focus highlight on docking node when focusing a menu. (ocornut#5702)

* Backends: OpenGL: Add ability to #define IMGUI_IMPL_OPENGL_DEBUG. (ocornut#4468, ocornut#4825, ocornut#4832, ocornut#5127, ocornut#5655, ocornut#5709)

# Conflicts:
#	backends/imgui_impl_opengl3.cpp

* Update imgui_impl_vulkan.h to match martty/imgui

https://github.com/martty/imgui/blob/master/examples/imgui_impl_vulkan.h

* Update imgui_impl_vulkan.cpp to match martty/imgui

https://github.com/martty/imgui/blob/master/examples/imgui_impl_vulkan.cpp

* Viewports: Fix AddMouseViewportEvent() to honor AppAcceptingEvents, filter duplicate, add to debug log.

* Docking: Fixed missing highlight when using dock node host window borders. (ocornut#5702)

Amend 8f43487, 9764adc, 24dfebf

* Fixed ImGuiWindowFlags_UnsavedDocument clipping label in docked windows with no close button. [changes for docking] (ocornut#5745)

+ TabBar: starts displaying the unsaved document marker with a frame delay to match how close button is processed, otherwise the transition would be noticeable.

* Fix for Vulkan validation layer warnings

Fix from: TheCherno@add065f
ocornut#3957

Co-authored-by: ocornut <omarcornut@gmail.com>
Co-authored-by: Sammy Fatnassi <sammyfreg@gmail.com>
Co-authored-by: GamingMinds-DanielC <daniel.cremers@gamingmindsstudios.com>
Co-authored-by: Adam Kewley <contact@adamkewley.com>
Co-authored-by: Rokas Kupstys <rokups@zoho.com>
Co-authored-by: David Maas <contact@pathogenstudios.com>
Co-authored-by: CheckmateAt7 <66566308+CheckmateAt7@users.noreply.github.com>
Co-authored-by: warriormaster12 <streng.alexander@gmail.com>
Co-authored-by: Michel Lesoinne <michel.lesoinne@androdevllc.com>
Co-authored-by: Mikko Sivulainen <mikko.sivulainen@gmail.com>
Co-authored-by: Mikko Sivulainen <mikko.sivulainen@supercell.com>
Co-authored-by: Dima Koltun <koltundimachamp@gmail.com>
Co-authored-by: stuartcarnie <stuart.carnie@gmail.com>
Co-authored-by: omar <ocornut@users.noreply.github.com>
Co-authored-by: Andrej Redeky <41929176+WSSDude420@users.noreply.github.com>
Co-authored-by: Runik <rtoumazet@free.fr>
Co-authored-by: Stephen H. Gerstacker <stephen@gerstacker.us>
ocornut added a commit that referenced this issue Mar 10, 2023
kjblanchard pushed a commit to kjblanchard/imgui that referenced this issue May 5, 2023
kjblanchard pushed a commit to kjblanchard/imgui that referenced this issue May 5, 2023
ocornut added a commit that referenced this issue Sep 11, 2023
…Enter key wouldn't be accepted by the widget when navigation highlight is visible. (#6802, #3092, #5759, #787)

+ Added test in ImGuiTestSuite: "widgets_inputtext_multiline_enter"
ocornut added a commit that referenced this issue Sep 11, 2023
ocornut added a commit that referenced this issue Dec 14, 2023
…GuiInputTextFlags_AllowTabInput doesn't activate it. (#3092, #5759, #787)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement in progress nav keyboard/gamepad navigation
Projects
None yet
Development

No branches or pull requests

10 participants