From 944b99f3a2e87a080666174dc1e2e2b543519904 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Thu, 14 Mar 2024 22:27:41 +0100 Subject: 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. --- src/gui/widgets/dropdown.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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(); } -- cgit v1.2.3-70-g09d2