diff --git a/client/lobby/OptionsTab.cpp b/client/lobby/OptionsTab.cpp index 3aa94542e..4d5aa771c 100644 --- a/client/lobby/OptionsTab.cpp +++ b/client/lobby/OptionsTab.cpp @@ -765,9 +765,9 @@ void OptionsTab::SelectionWindow::sliderMove(int slidPos) redraw(); } -bool OptionsTab::SelectionWindow::receiveEvent(const Point & position, int eventType) const +void OptionsTab::SelectionWindow::notFocusedClick() { - return true; // capture click also outside of window + close(); } void OptionsTab::SelectionWindow::clickReleased(const Point & cursorPosition) @@ -775,12 +775,6 @@ void OptionsTab::SelectionWindow::clickReleased(const Point & cursorPosition) if(slider && slider->pos.isInside(cursorPosition)) return; - if(!pos.isInside(cursorPosition)) - { - close(); - return; - } - int elem = getElement(cursorPosition); setElement(elem, true); @@ -898,15 +892,9 @@ OptionsTab::HandicapWindow::HandicapWindow() center(); } -bool OptionsTab::HandicapWindow::receiveEvent(const Point & position, int eventType) const +void OptionsTab::HandicapWindow::notFocusedClick() { - return true; // capture click also outside of window -} - -void OptionsTab::HandicapWindow::clickReleased(const Point & cursorPosition) -{ - if(!pos.isInside(cursorPosition)) // make it possible to close window by touching/clicking outside of window - close(); + close(); } OptionsTab::SelectedBox::SelectedBox(Point position, PlayerSettings & playerSettings, SelType type) diff --git a/client/lobby/OptionsTab.h b/client/lobby/OptionsTab.h index 8bef7c9c2..e74666e6d 100644 --- a/client/lobby/OptionsTab.h +++ b/client/lobby/OptionsTab.h @@ -63,8 +63,7 @@ public: std::map>> textinputs; std::vector> buttons; - bool receiveEvent(const Point & position, int eventType) const override; - void clickReleased(const Point & cursorPosition) override; + void notFocusedClick() override; public: HandicapWindow(); }; @@ -167,7 +166,7 @@ private: void sliderMove(int slidPos); - bool receiveEvent(const Point & position, int eventType) const override; + void notFocusedClick() override; void clickReleased(const Point & cursorPosition) override; void showPopupWindow(const Point & cursorPosition) override; diff --git a/client/windows/GUIClasses.cpp b/client/windows/GUIClasses.cpp index 344b18deb..5178c332c 100644 --- a/client/windows/GUIClasses.cpp +++ b/client/windows/GUIClasses.cpp @@ -1703,7 +1703,7 @@ void VideoWindow::keyPressed(EShortcut key) exit(true); } -bool VideoWindow::receiveEvent(const Point & position, int eventType) const +void VideoWindow::notFocusedClick() { - return true; // capture click also outside of window + exit(true); } diff --git a/client/windows/GUIClasses.h b/client/windows/GUIClasses.h index 06e070bfe..f3c8a044c 100644 --- a/client/windows/GUIClasses.h +++ b/client/windows/GUIClasses.h @@ -523,5 +523,5 @@ public: void clickPressed(const Point & cursorPosition) override; void keyPressed(EShortcut key) override; - bool receiveEvent(const Point & position, int eventType) const override; + void notFocusedClick() override; };