GUI: Fix infinite loop with mouse wheel over tab

Reported as regression in #13106

Comment link:  https://bugs.scummvm.org/ticket/13106#comment:4
This commit is contained in:
antoniou79 2022-06-29 15:52:22 +03:00
parent 125edd6724
commit dc69bd4d67
2 changed files with 9 additions and 0 deletions

View File

@ -318,6 +318,14 @@ bool TabWidget::handleKeyDown(Common::KeyState state) {
return Widget::handleKeyDown(state);
}
void TabWidget::handleMouseWheel(int x, int y, int direction) {
if (direction == 1) {
adjustTabs(kTabForwards);
} else {
adjustTabs(kTabBackwards);
}
}
void TabWidget::adjustTabs(int value) {
// Determine which tab is next
int tabID = _activeTab + value;

View File

@ -112,6 +112,7 @@ public:
void handleMouseMoved(int x, int y, int button) override;
void handleMouseLeft(int button) override { _lastRead = -1; };
bool handleKeyDown(Common::KeyState state) override;
void handleMouseWheel(int x, int y, int direction) override;
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
virtual int getFirstVisible() const;
virtual void setFirstVisible(int tabID, bool adjustIfRoom = false);