diff --git a/tools/chatgui/src/mainwindow.cpp b/tools/chatgui/src/mainwindow.cpp index 5465c83d..defaeccf 100644 --- a/tools/chatgui/src/mainwindow.cpp +++ b/tools/chatgui/src/mainwindow.cpp @@ -183,6 +183,7 @@ MainWindow::MainWindow(QWidget *parent, DbManager* db, const QString& cfgPath, MainWindow::~MainWindow() { s_mainWindow = nullptr; if (m_messageNotification) m_messageNotification->dismiss("shutdown"); + m_messageNotification.reset(); delete AvatarManager::instance(); delete GroupAvatarManager::instance(); gui_bridge_set_group_avatar_result_cb(nullptr); @@ -816,8 +817,8 @@ void MainWindow::setupTray() { m_trayIcon->setIcon(QIcon(":/icons/app_icon.png")); m_trayIcon->setToolTip("vibechat"); - m_messageNotification = new MessageNotification(this); - connect(m_messageNotification, &MessageNotification::activated, this, [this](const QString& target) { + m_messageNotification = std::make_unique(); + connect(m_messageNotification.get(), &MessageNotification::activated, this, [this](const QString& target) { if (isMinimized()) setWindowState(windowState() & ~Qt::WindowMinimized); show(); raise(); @@ -873,7 +874,7 @@ void MainWindow::showIncomingMessageNotification(const QString& target, quint64 return; } } - m_messageNotification->showMessage(target, m_db->getDisplayName(author), channel, m_trayIcon->geometry()); + m_messageNotification->showMessage(target, m_db->getDisplayName(author), channel, m_trayIcon->geometry(), screen()); } void MainWindow::closeEvent(QCloseEvent *event) { diff --git a/tools/chatgui/src/mainwindow.h b/tools/chatgui/src/mainwindow.h index 691750b0..6747f711 100644 --- a/tools/chatgui/src/mainwindow.h +++ b/tools/chatgui/src/mainwindow.h @@ -10,6 +10,7 @@ #include #include #include +#include class ChannelList; class MessageList; @@ -110,7 +111,7 @@ private: QSplitter *m_splitter = nullptr; QSystemTrayIcon *m_trayIcon; QMenu *m_trayMenu; - MessageNotification* m_messageNotification = nullptr; + std::unique_ptr m_messageNotification; DbManager *m_db; UtunNode *m_node = nullptr; QString m_cfgPath; diff --git a/tools/chatgui/src/user_activity_monitor.cpp b/tools/chatgui/src/user_activity_monitor.cpp index 4ec208b6..b6accb28 100644 --- a/tools/chatgui/src/user_activity_monitor.cpp +++ b/tools/chatgui/src/user_activity_monitor.cpp @@ -81,8 +81,11 @@ bool UserActivityMonitor::eventFilter(QObject*, QEvent* event) { switch (event->type()) { case QEvent::MouseMove: case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseButtonDblClick: case QEvent::Wheel: case QEvent::KeyPress: + case QEvent::KeyRelease: case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TabletMove: