X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fgraphicalui.cpp;h=3f65505a386688738e73e7c4ac015efabdd7c1a1;hb=72473527f99cbe68dcfcb4ca17f828bd3775bba7;hp=0fb34b04292650c25f2767c06ba512ca9139028d;hpb=c52a94cb937654bf06d5074bf0736a52ec94a52d;p=quassel.git diff --git a/src/uisupport/graphicalui.cpp b/src/uisupport/graphicalui.cpp index 0fb34b04..3f65505a 100644 --- a/src/uisupport/graphicalui.cpp +++ b/src/uisupport/graphicalui.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This contains code from KStatusNotifierItem, part of the KDE libs * @@ -36,7 +36,6 @@ # include #endif -GraphicalUi *GraphicalUi::_instance = 0; QWidget *GraphicalUi::_mainWidget = 0; QHash GraphicalUi::_actionCollections; ContextMenuActionProvider *GraphicalUi::_contextMenuActionProvider = 0; @@ -44,14 +43,15 @@ ToolBarActionProvider *GraphicalUi::_toolBarActionProvider = 0; UiStyle *GraphicalUi::_uiStyle = 0; bool GraphicalUi::_onAllDesktops = false; -GraphicalUi::GraphicalUi(QObject *parent) : AbstractUi(parent) -{ - Q_ASSERT(!_instance); - _instance = this; +GraphicalUi::GraphicalUi(QObject *parent) : AbstractUi(parent), Singleton(this) +{ #ifdef Q_OS_WIN _dwTickCount = 0; #endif +#ifdef Q_OS_MAC + GetFrontProcess(&_procNum); +#endif } @@ -146,6 +146,9 @@ bool GraphicalUi::eventFilter(QObject *obj, QEvent *event) } +// NOTE: Window activation stuff seems to work just fine in Plasma 5 without requiring X11 hacks. +// TODO: Evaluate cleaning all this up once we can get rid of Qt4/KDE4 + // Code taken from KStatusNotifierItem for handling minimize/restore bool GraphicalUi::checkMainWidgetVisibility(bool perform) @@ -296,9 +299,13 @@ void GraphicalUi::activateMainWidget() // this does not actually work on all platforms... and causes more evil than good // mainWidget()->move(mainWidget()->frameGeometry().topLeft()); // avoid placement policies +#ifdef Q_OS_MAC + SetFrontProcess(&instance()->_procNum); +#else mainWidget()->show(); mainWidget()->raise(); mainWidget()->activateWindow(); +#endif #endif /* HAVE_KDE4 */ } @@ -312,7 +319,11 @@ void GraphicalUi::hideMainWidget() #endif if (instance()->isHidingMainWidgetAllowed()) +#ifdef Q_OS_MAC + ShowHideProcess(&instance()->_procNum, false); +#else mainWidget()->hide(); +#endif }