summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-14 22:27:41 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-22 20:26:25 +0100
commit944b99f3a2e87a080666174dc1e2e2b543519904 (patch)
tree6d6feb616c2fbf614335ef8b5811c9513cecff1b /src/gui
parent44df7c0ebfef37e78be75407f490c1bb1ffb03b4 (diff)
downloadmana-944b99f3a2e87a080666174dc1e2e2b543519904.tar.gz
mana-944b99f3a2e87a080666174dc1e2e2b543519904.tar.bz2
mana-944b99f3a2e87a080666174dc1e2e2b543519904.tar.xz
mana-944b99f3a2e87a080666174dc1e2e2b543519904.zip
Fixed the distribution of action events by DropDown
It did not distribute them when the value of the DropDown was changed by key events or mouse wheel.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/dropdown.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index a4b02fe5..c548570d 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -196,7 +196,8 @@ void DropDown::keyPressed(gcn::KeyEvent& keyEvent)
if (keyEvent.isConsumed())
return;
- gcn::Key key = keyEvent.getKey();
+ const gcn::Key key = keyEvent.getKey();
+ const int selectedIndex = getSelected();
if (key.getValue() == Key::ENTER || key.getValue() == Key::SPACE)
dropDown();
@@ -212,6 +213,9 @@ void DropDown::keyPressed(gcn::KeyEvent& keyEvent)
return;
keyEvent.consume();
+
+ if (getSelected() != selectedIndex)
+ distributeActionEvent();
}
void DropDown::focusLost(const gcn::Event& event)
@@ -240,10 +244,12 @@ void DropDown::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent)
{
setSelected(getSelected() - 1);
mouseEvent.consume();
+ distributeActionEvent();
}
void DropDown::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent)
{
setSelected(getSelected() + 1);
mouseEvent.consume();
+ distributeActionEvent();
}