/***************************************************************************
- * Copyright (C) 2005-2012 by the Quassel Project *
+ * Copyright (C) 2005-2015 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This contains code from KStatusNotifierItem, part of the KDE libs *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "graphicalui.h"
#ifdef Q_WS_X11
# include <QX11Info>
#endif
-#ifdef HAVE_KDE
+#ifdef HAVE_KDE4
# include <KWindowInfo>
# include <KWindowSystem>
#endif
Q_ASSERT(!_instance);
_instance = this;
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
_dwTickCount = 0;
#endif
}
void GraphicalUi::init()
{
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
mainWidget()->installEventFilter(this);
#endif
}
bool GraphicalUi::eventFilter(QObject *obj, QEvent *event)
{
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
if (obj == mainWidget() && event->type() == QEvent::ActivationChange) {
_dwTickCount = GetTickCount();
}
}
+// 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)
{
-#ifdef Q_WS_WIN
+#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 :)
return true;
}
-#elif defined(HAVE_KDE) && defined(Q_WS_X11)
+#elif defined(HAVE_KDE4) && defined(Q_WS_X11)
KWindowInfo info1 = KWindowSystem::windowInfo(mainWidget()->winId(), NET::XAWMState | NET::WMState | NET::WMDesktop);
// mapped = visible (but possibly obscured)
bool mapped = (info1.mappingState() == NET::Visible) && !info1.isMinimized();
void GraphicalUi::activateMainWidget()
{
-#ifdef HAVE_KDE
+#ifdef HAVE_KDE4
# ifdef Q_WS_X11
KWindowInfo info = KWindowSystem::windowInfo(mainWidget()->winId(), NET::WMDesktop | NET::WMFrameExtents);
if (_onAllDesktops) {
KWindowSystem::forceActiveWindow(mainWidget()->winId());
# endif
-#else /* HAVE_KDE */
+#else /* HAVE_KDE4 */
#ifdef Q_WS_X11
// Bypass focus stealing prevention
mainWidget()->raise();
mainWidget()->activateWindow();
-#endif /* HAVE_KDE */
+#endif /* HAVE_KDE4 */
}
void GraphicalUi::hideMainWidget()
{
-#if defined(HAVE_KDE) && defined(Q_WS_X11)
+#if defined(HAVE_KDE4) && defined(Q_WS_X11)
KWindowInfo info = KWindowSystem::windowInfo(mainWidget()->winId(), NET::WMDesktop | NET::WMFrameExtents);
_onAllDesktops = info.onAllDesktops();
#endif