From c3d1629ff8b73e2f55e09951b6eb4a222357dfb1 Mon Sep 17 00:00:00 2001 From: chenzhe Date: Mon, 23 Dec 2019 15:40:40 +0800 Subject: [PATCH] fix(dock):fix appicon repeat open many instance --- frame/item/appitem.cpp | 6 ++++++ frame/item/appitem.h | 1 + 2 files changed, 7 insertions(+) diff --git a/frame/item/appitem.cpp b/frame/item/appitem.cpp index 35ddf4050..f1488321e 100644 --- a/frame/item/appitem.cpp +++ b/frame/item/appitem.cpp @@ -80,6 +80,7 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent) m_dragging(false), m_retryTimes(0), + m_lastclickTimes(0), m_appIcon(QPixmap()), @@ -306,6 +307,11 @@ void AppItem::mouseReleaseEvent(QMouseEvent *e) qDebug() << "app item clicked, name:" << m_itemEntryInter->name() << "id:" << m_itemEntryInter->id() << "my-id:" << m_id << "icon:" << m_itemEntryInter->icon(); + int curTimestamp = QX11Info::getTimestamp(); + if ((curTimestamp - m_lastclickTimes) < 200) + return; + + m_lastclickTimes = curTimestamp; m_itemEntryInter->Activate(QX11Info::getTimestamp()); // play launch effect diff --git a/frame/item/appitem.h b/frame/item/appitem.h index 0e06a435a..7a96d4723 100644 --- a/frame/item/appitem.h +++ b/frame/item/appitem.h @@ -113,6 +113,7 @@ private: bool m_dragging; bool m_active; int m_retryTimes; + unsigned long m_lastclickTimes; WindowInfoMap m_windowInfos; QString m_id;