From 7dcc6ebdf12bba6273f091cf7b19b539edcb9993 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 4 Mar 2018 15:25:28 +0100 Subject: opentrack: fix close button with tray Reported by: Yuri Vostrenkov --- variant/default/main-window.cpp | 16 ++++++++-------- variant/default/main-window.hpp | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'variant') diff --git a/variant/default/main-window.cpp b/variant/default/main-window.cpp index 9df36a7d..62b969e1 100644 --- a/variant/default/main-window.cpp +++ b/variant/default/main-window.cpp @@ -339,21 +339,16 @@ bool main_window::get_new_config_name_from_dialog(QString& ret) main_window::~main_window() { - if (tray) - tray->hide(); - tray = nullptr; - - const bool just_stopping = bool(work); - // stupid ps3 eye has LED issues - if (just_stopping) + if (work) { stop_tracker_(); - close(); QEventLoop ev; ev.processEvents(); portable::sleep(2000); } + + exit(); } void main_window::set_working_directory() @@ -842,6 +837,11 @@ bool main_window::maybe_hide_to_tray(QEvent* e) return false; } +void main_window::closeEvent(QCloseEvent*) +{ + exit(); +} + void main_window::maybe_start_profile_from_executable() { if (!work) diff --git a/variant/default/main-window.hpp b/variant/default/main-window.hpp index b4b7dbb7..c28aadc4 100644 --- a/variant/default/main-window.hpp +++ b/variant/default/main-window.hpp @@ -115,6 +115,8 @@ class main_window : public QMainWindow, private State template bool mk_window_common(std::unique_ptr& d, F&& ctor); + void closeEvent(QCloseEvent *event) override; + private slots: void save_modules(); void exit(int status = EXIT_SUCCESS); -- cgit v1.2.3