imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Nav: Weird scoring behavior

Open averne opened this issue 2 years ago • 4 comments

Version: v1.89.1 Branch: v1.89.1-master

Back-end/Renderer/Compiler/OS

Back-ends: Custom for Nintendo Switch Operating System: Horizon OS (Nintendo Switch OS)

My Issue/Question:

Hi, I'm hitting some odd keyboard nav behavior, it seems the nav scoring code is making non-sensical choices. (Please see the video below) After some debugging I traced it to these two lines: https://github.com/ocornut/imgui/blob/master/imgui.cpp#L10539-L10540 I don't understand their purpose. Removing them doesn't seem to break keyboard nav, and fixes the issue. Can you please explain this behavior, and if possible steps to fix the issue? Many thanks in advance.

Screenshots/Video

Instead of moving to the "Use fast presentation checkbox" which seems to be the logical choice, the nav system scores the pencil button very low and chooses it instead.

https://user-images.githubusercontent.com/45773016/208242816-75440b1f-7eac-4883-8997-ea8971303a45.mp4

averne avatar Dec 17 '22 12:12 averne

The biases are/were useful in some situations. Clearly not here.

It’s not clear which right now but I think the more reasonable route is to be adding more tests cases in imgui_test_suite (www.github.com/ocornut/imgui_test_engine).

First see if removing that weighting bias breaks any existing test, then adding a test like yours, then figuring out how to write a situation/test that would have benefited from the bias and take further from that position of knowledge.

ocornut avatar Dec 18 '22 05:12 ocornut

Thanks for your answer. It looks like the test suite is really meant for Windows, and unfortunately I work on Linux so I won't be able to test the bias removal myself.

averne avatar Dec 20 '22 20:12 averne

Test Suite should work on all platforms, we mostly run CI on Linux.

ocornut avatar Dec 21 '22 05:12 ocornut

Thanks for the heads up. I've run the test suite with and without the bias. All tests pass for the unmodified master branch, however the patch breaks two tests: image

nav_page_home_end_arrows
[0000] -- SetRef 'Test Window' 00000000
[0000] STEP 0
[0002] -- KeyPress(PageDown, 1)
[0005] Error imgui_tests_nav.cpp:1465 'g.NavId [0xE21294DD] == ctx->GetID("OK 20") [0xC7E44F2C]'
[0005] nav_page_home_end_arrows test failed.
nav_wrapping
[0000] -- SetRef 'Test Window' 00000000
[0001] -- ItemClick '0,0' > 00000000
[0008] -- KeyPress(RightArrow, 1)
[0011] OK imgui_tests_nav.cpp:2156 'g.NavId == ctx->GetID("0,1")'
[0011] -- KeyPress(RightArrow, 1)
[0014] -- KeyPress(RightArrow, 1)
[0017] OK imgui_tests_nav.cpp:2159 'g.NavId == ctx->GetID("0,3")'
[0017] -- KeyPress(RightArrow, 1)
[0020] OK imgui_tests_nav.cpp:2161 'g.NavId == ctx->GetID("0,3")'
[0020] -- ItemClick '0,0' > 00000000
[0028] -- KeyPress(RightArrow, 1)
[0031] OK imgui_tests_nav.cpp:2166 'g.NavId == ctx->GetID("0,1")'
[0031] -- KeyPress(RightArrow, 1)
[0034] -- KeyPress(RightArrow, 1)
[0037] OK imgui_tests_nav.cpp:2169 'g.NavId == ctx->GetID("0,3")'
[0037] -- KeyPress(RightArrow, 1)
[0040] OK imgui_tests_nav.cpp:2171 'g.NavId == ctx->GetID("1,0")'
[0040] -- KeyPress(RightArrow, 1)
[0043] -- KeyPress(RightArrow, 1)
[0046] -- KeyPress(RightArrow, 1)
[0049] -- KeyPress(RightArrow, 1)
[0052] -- KeyPress(RightArrow, 1)
[0055] -- KeyPress(RightArrow, 1)
[0058] -- KeyPress(RightArrow, 1)
[0061] -- KeyPress(RightArrow, 1)
[0064] -- KeyPress(RightArrow, 1)
[0067] -- KeyPress(RightArrow, 1)
[0070] -- KeyPress(RightArrow, 1)
[0073] -- KeyPress(RightArrow, 1)
[0076] -- KeyPress(RightArrow, 1)
[0079] -- KeyPress(RightArrow, 1)
[0082] -- KeyPress(RightArrow, 1)
[0085] -- KeyPress(RightArrow, 1)
[0088] -- KeyPress(RightArrow, 1)
[0091] -- KeyPress(RightArrow, 1)
[0094] -- KeyPress(RightArrow, 1)
[0097] -- KeyPress(RightArrow, 1)
[0100] -- KeyPress(RightArrow, 1)
[0103] -- KeyPress(RightArrow, 1)
[0106] -- KeyPress(RightArrow, 1)
[0109] -- KeyPress(RightArrow, 1)
[0112] -- KeyPress(RightArrow, 1)
[0115] -- KeyPress(RightArrow, 1)
[0118] -- KeyPress(RightArrow, 1)
[0121] -- KeyPress(RightArrow, 1)
[0124] -- KeyPress(RightArrow, 1)
[0127] -- KeyPress(RightArrow, 1)
[0130] -- KeyPress(RightArrow, 1)
[0133] -- KeyPress(RightArrow, 1)
[0136] -- KeyPress(RightArrow, 1)
[0139] -- KeyPress(RightArrow, 1)
[0142] -- KeyPress(RightArrow, 1)
[0145] -- KeyPress(RightArrow, 1)
[0148] -- KeyPress(RightArrow, 1)
[0151] -- KeyPress(RightArrow, 1)
[0154] -- KeyPress(RightArrow, 1)
[0157] -- KeyPress(RightArrow, 1)
[0160] -- KeyPress(RightArrow, 1)
[0163] -- KeyPress(RightArrow, 1)
[0166] -- KeyPress(RightArrow, 1)
[0169] -- KeyPress(RightArrow, 1)
[0172] -- KeyPress(RightArrow, 1)
[0175] -- KeyPress(RightArrow, 1)
[0178] -- KeyPress(RightArrow, 1)
[0181] -- KeyPress(RightArrow, 1)
[0184] -- KeyPress(RightArrow, 1)
[0187] -- KeyPress(RightArrow, 1)
[0190] Error imgui_tests_nav.cpp:2174 'g.NavId == ctx->GetID("3,1")'
[0190] nav_wrapping test failed.```
</details>

averne avatar Dec 21 '22 12:12 averne