From efbd8cebe7bd7a410bc8e15fb45de22936bb4a39 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 1 Feb 2018 22:43:37 +0100 Subject: [PATCH] Nav: Comments (#787) --- TODO.txt | 3 +++ imgui.cpp | 15 ++++++++------- imgui_demo.cpp | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/TODO.txt b/TODO.txt index a483594f..6f6ab7cc 100644 --- a/TODO.txt +++ b/TODO.txt @@ -157,6 +157,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - tooltip: allow tooltips with timers? or general timer policy? (instaneous vs timed) - menus: calling BeginMenu() twice with a same name doesn't append as Begin() does for regular windows (#1207) + - menus: menu bars inside modals windows are acting weird. - statusbar: add a per-window status bar helper similar to what menubar does. - shortcuts: local-style shortcut api, e.g. parse "&Save" - shortcuts,menus: global-style shortcut api e.g. "Save (CTRL+S)" -> explicit flag for recursing into closed menu @@ -230,6 +231,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - font: (api breaking) removed "TTF" from symbol names. also because it now supports OTF. - nav: integrate navigation branch into master. (#787) + - nav: Left within a tree node block as a fallback. - nav: Esc on a flattened child - nav: menus: allow pressing Menu to leave a sub-menu. - nav: integrate/design keyboard controls. @@ -237,6 +239,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - nav: tabs should go through most/all widgets (in submission order?). - nav: cannot access menubar of a flattened child window with Alt/menu key (not a very common use case..). - nav: esc/enter default behavior for popups, e.g. be able to mark an "ok" or "cancel" button that would get triggered by those keys. + - nav: when activating a button that changes label (without a static ID) or disappear, can we somehow automatically recover into a nearest highlight item? - focus: preserve ActiveId/focus stack state, e.g. when opening a menu and close it, previously selected InputText() focus gets restored (#622) - focus: SetKeyboardFocusHere() on with >= 0 offset could be done on same frame (else latch and modulate on beginning of next frame) - focus: unable to use SetKeyboardFocusHere() on clipped widgets. (#787) diff --git a/imgui.cpp b/imgui.cpp index bb0b62d6..bd0ec45a 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -211,26 +211,27 @@ USING GAMEPAD/KEYBOARD NAVIGATION [BETA] - - Gamepad/keyboard navigation support is available, currently in Beta with some issues. Your feedback and bug reports are welcome. + - Gamepad/keyboard navigation support is now available. Your feedback and bug reports are greatly welcome! - See https://github.com/ocornut/imgui/issues/787 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. + - The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable. - Your inputs are passed to imgui by filling the io.NavInputs[] array. See 'enum ImGuiNavInput_' in imgui.h for a description of available inputs. + - Please refer to the examples/ application for suggested keyboard and gamepad mapping. + - PS4 users: Consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback. + - Consoles/Tablet/Phone users: Consider using Synergy host (on your computer) + uSynergy.c (in your console/tablet/phone app) to use your PC mouse/keyboard. - The ImGuiNavFlags_EnableGamepad and ImGuiNavFlags_EnableKeyboard flags of io.NavFlags are only here to instruct your binding whether to find 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.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set. - io.NavVisible: true when the navigation cursor is visible (and usually goes false when mouse is used). - - query focus information with IsWindowFocused(), IsAnyWindowFocused(), IsAnyItemFocused() functions. + - query focus information with e.g. IsWindowFocused(), IsItemFocused() etc. 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. - On a TV/console system where readability may be lower or mouse inputs may be awkward, you may want to set the ImGuiNavFlags_MoveMouse flag in io.NavFlags. - Enabling ImGuiNavFlags_MoveMouse instructs dear imgui to move your mouse cursor along when navigation movement. + Enabling ImGuiNavFlags_MoveMouse instructs dear imgui to move your mouse cursor along with navigation movement. When enabled, 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. Some of the binding in examples/ do that. - (Important: It you set the ImGuiNavFlags_MoveMouse flag but don't honor 'io.WantMoveMouse' properly, imgui will misbehave as it will think your mouse is moving back and forth.) + (If you set the ImGuiNavFlags_MoveMouse flag but don't honor 'io.WantMoveMouse' properly, imgui will misbehave as it will see your mouse as moving back and forth.) (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 may want to set a boolean to ignore your other external mouse positions until the external source is moved again.) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 2de0f632..3af5399b 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1533,7 +1533,7 @@ void ImGui::ShowDemoWindow(bool* p_open) ImGui::OpenPopup("Delete?"); if (ImGui::BeginPopupModal("Delete?", NULL, ImGuiWindowFlags_AlwaysAutoResize)) { - ImGui::Text("All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n"); + ImGui::Text("All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n"); ImGui::Separator(); //static int dummy_i = 0;