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:
parent
0da1a2fd8b
commit
2f0ffdd27e
|
@ -356,3 +356,8 @@ void SystemTrayIcon::setIcon(QIcon &icon)
|
||||||
qtIcon->setIcon(icon);
|
qtIcon->setIcon(icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SystrayBackendType SystemTrayIcon::backend() const
|
||||||
|
{
|
||||||
|
return backendType;
|
||||||
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
void hide();
|
void hide();
|
||||||
void setVisible(bool);
|
void setVisible(bool);
|
||||||
void setIcon(QIcon &icon);
|
void setIcon(QIcon &icon);
|
||||||
|
SystrayBackendType backend() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void activated(QSystemTrayIcon::ActivationReason);
|
void activated(QSystemTrayIcon::ActivationReason);
|
||||||
|
|
|
@ -63,15 +63,9 @@ extern "C" {
|
||||||
enum class SystrayBackendType
|
enum class SystrayBackendType
|
||||||
{
|
{
|
||||||
Qt,
|
Qt,
|
||||||
#ifdef ENABLE_SYSTRAY_UNITY_BACKEND
|
|
||||||
Unity,
|
Unity,
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND
|
|
||||||
StatusNotifier,
|
StatusNotifier,
|
||||||
#endif
|
GTK
|
||||||
#ifdef ENABLE_SYSTRAY_GTK_BACKEND
|
|
||||||
GTK,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SYSTEMTRAYICON_PRIVATE_H
|
#endif // SYSTEMTRAYICON_PRIVATE_H
|
||||||
|
|
|
@ -1815,7 +1815,9 @@ void Widget::onTryCreateTrayIcon()
|
||||||
trayMenu->addAction(actionQuit);
|
trayMenu->addAction(actionQuit);
|
||||||
icon->setContextMenu(trayMenu);
|
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())
|
if (Settings::getInstance().getShowSystemTray())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user