-
Notifications
You must be signed in to change notification settings - Fork 186
Description
I'm not sure if the root cause is within SFML itself or imgui-SFML, but you can observe the following behavior:
- Create a combobox with enough items so that the dropdown list has a scrollbar. Or simply use ImGui::ShowDemoWindow().
- Open the combobox, now you can use the mousewheel to scroll through the droplist.
- Press
Ctrlonce. - Now scrolling through the droplist via mousewheel no longer works.
- Press any "normal" key (like a letter).
- Scrolling works again.
The problem is within ProcessEvent(), which sets the keystate with io.KeyCtrl = event.key.control;. However, event.key.control seems to contain the wrong state in this scenario, probably because in this scenario Ctrl is treated as normal key and not as modifier key in combination with another key like e.g. Ctrl+C.
Pressing a "normal" key afterwards resets io.KeyCtrl again, so scrolling works again.
As mentioned, I'm not sure if this isn't an issue within SFML itself.
This scenario is particularly annoying to me because I have an application where I use Ctrl+Mousewheel to zoom in/out. So it is commonly used and afterwards the comboboxes don't work correctly anymore because the of this.
A rather crude fix that works for me is to replace io.KeyCtrl = event.key.control; with:
if( (event.key.code == sf::Keyboard::LControl) || (event.key.code == sf::Keyboard::RControl) )
{
io.KeyCtrl = (event.type == sf::Event::KeyPressed);
}
else
{
io.KeyCtrl = event.key.control;
}
I have only checked with the Ctrl key, but I assume other modifiers like Alt or Shift suffer from the same problem.