X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fgraphicalui.cpp;h=e04234e49b16915370c18f40365a53cecc882e88;hp=73affbf7a0371f87b5c8bc6b6fc7d0cabe6df959;hb=edc55b1f86cf613a332eeeb5d85537a54120dfa5;hpb=c1cf157116de7fc3da96203aa6f03c38c7ebb650 diff --git a/src/uisupport/graphicalui.cpp b/src/uisupport/graphicalui.cpp index 73affbf7..e04234e4 100644 --- a/src/uisupport/graphicalui.cpp +++ b/src/uisupport/graphicalui.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2019 by the Quassel Project * * devel@quassel-irc.org * * * * This contains code from KStatusNotifierItem, part of the KDE libs * @@ -144,38 +144,26 @@ bool GraphicalUi::eventFilter(QObject* obj, QEvent* event) bool GraphicalUi::checkMainWidgetVisibility(bool perform) { + bool needsActivation{true}; + #ifdef Q_OS_WIN // the problem is that we lose focus when the systray icon is activated // and we don't know the former active window // therefore we watch for activation event and use our stopwatch :) if (GetTickCount() - _dwTickCount < 300) { // we were active in the last 300ms -> hide it - if (perform) - minimizeRestore(false); - return false; - } - else { - if (perform) - minimizeRestore(true); - return true; + needsActivation = false; } - #else - - if (!mainWidget()->isVisible() || mainWidget()->isMinimized() || !mainWidget()->isActiveWindow()) { - if (perform) - minimizeRestore(true); - return true; + if (mainWidget()->isVisible() && !mainWidget()->isMinimized() && mainWidget()->isActiveWindow()) { + needsActivation = false; } - else { - if (perform) - minimizeRestore(false); - return false; - } - #endif - return true; + if (perform) { + minimizeRestore(needsActivation); + } + return needsActivation; } bool GraphicalUi::isMainWidgetVisible()