1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(systemtray): don't activate qTox widget on tray icon click in Unity backend

based on #3423 by @abbat
This commit is contained in:
sudden6 2016-08-01 20:58:14 +02:00
parent 0da1a2fd8b
commit 2f0ffdd27e
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
4 changed files with 10 additions and 8 deletions

View File

@ -356,3 +356,8 @@ void SystemTrayIcon::setIcon(QIcon &icon)
qtIcon->setIcon(icon);
}
}
SystrayBackendType SystemTrayIcon::backend() const
{
return backendType;
}

View File

@ -38,6 +38,7 @@ public:
void hide();
void setVisible(bool);
void setIcon(QIcon &icon);
SystrayBackendType backend() const;
signals:
void activated(QSystemTrayIcon::ActivationReason);

View File

@ -63,15 +63,9 @@ extern "C" {
enum class SystrayBackendType
{
Qt,
#ifdef ENABLE_SYSTRAY_UNITY_BACKEND
Unity,
#endif
#ifdef ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND
StatusNotifier,
#endif
#ifdef ENABLE_SYSTRAY_GTK_BACKEND
GTK,
#endif
GTK
};
#endif // SYSTEMTRAYICON_PRIVATE_H

View File

@ -1815,7 +1815,9 @@ void Widget::onTryCreateTrayIcon()
trayMenu->addAction(actionQuit);
icon->setContextMenu(trayMenu);
connect(icon, &SystemTrayIcon::activated, this, &Widget::onIconClick);
// don't activate qTox widget on tray icon click in Unity backend (see #3419)
if (icon->backend() != SystrayBackendType::Unity)
connect(icon, &SystemTrayIcon::activated, this, &Widget::onIconClick);
if (Settings::getInstance().getShowSystemTray())
{