fix: 修复wayland下设置智能隐藏失败的问题

1、wayland环境下根据窗口Id获取当前激活窗口错误,导致无法获取激活窗口
2、释放鼠标的时候没有触发激活窗口的判断函数,导致任务栏在拖动过程中释放鼠标后,没有发送是否隐藏信号

Log: 修复wayland下设置智能隐藏失败的问题
Influence: 进入wayland环境,任务栏设置智能隐藏,窗口拖动到任务栏下方,观察窗口是否隐藏,窗口移出任务栏,观察任务栏是否显示
Bug: https://pms.uniontech.com/bug-view-154513.html
Change-Id: I4de3b4db019a664f184b0676bb8ce2a77d1d66a9
This commit is contained in:
donghualin
2022-11-11 11:06:20 +00:00
parent ca33b78aed
commit 282227dc2b
12 changed files with 350 additions and 26 deletions

View File

@ -0,0 +1,73 @@
/*
* This file was generated by qdbusxml2cpp-fix version 0.8
* Command line was: qdbusxml2cpp-fix -c org_deepin_api_XEventMonitor -p /home/donghl/work/code/dde-dock/frame/dbusinterface/generation_dbus_interface/org_deepin_api_xeventmonitor /home/donghl/work/code/dde-dock/frame/dbusinterface/xml/org.deepin.api.XEventMonitor.xml
*
* qdbusxml2cpp-fix is Copyright (C) 2016 Deepin Technology Co., Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "dbusxeventmonitor.h"
/*
* Implementation of interface class __org_deepin_api_XEventMonitor
*/
class __org_deepin_api_XEventMonitorPrivate
{
public:
__org_deepin_api_XEventMonitorPrivate() = default;
// begin member variables
public:
QMap<QString, QDBusPendingCallWatcher *> m_processingCalls;
QMap<QString, QList<QVariant>> m_waittingCalls;
};
__org_deepin_api_XEventMonitor::__org_deepin_api_XEventMonitor(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
: DBusExtendedAbstractInterface(service, path, staticInterfaceName(), connection, parent)
, d_ptr(new __org_deepin_api_XEventMonitorPrivate)
{
if (QMetaType::type("AreaList") == QMetaType::UnknownType)
registerAreaListMetaType();
}
__org_deepin_api_XEventMonitor::~__org_deepin_api_XEventMonitor()
{
qDeleteAll(d_ptr->m_processingCalls.values());
delete d_ptr;
}
void __org_deepin_api_XEventMonitor::CallQueued(const QString &callName, const QList<QVariant> &args)
{
if (d_ptr->m_waittingCalls.contains(callName)) {
d_ptr->m_waittingCalls[callName] = args;
return;
}
if (d_ptr->m_processingCalls.contains(callName)) {
d_ptr->m_waittingCalls.insert(callName, args);
} else {
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(asyncCallWithArgumentList(callName, args));
connect(watcher, &QDBusPendingCallWatcher::finished, this, &__org_deepin_api_XEventMonitor::onPendingCallFinished);
d_ptr->m_processingCalls.insert(callName, watcher);
}
}
void __org_deepin_api_XEventMonitor::onPendingCallFinished(QDBusPendingCallWatcher *w)
{
w->deleteLater();
const auto callName = d_ptr->m_processingCalls.key(w);
Q_ASSERT(!callName.isEmpty());
if (callName.isEmpty())
return;
d_ptr->m_processingCalls.remove(callName);
if (!d_ptr->m_waittingCalls.contains(callName))
return;
const auto args = d_ptr->m_waittingCalls.take(callName);
CallQueued(callName, args);
}

View File

@ -0,0 +1,101 @@
/*
* This file was generated by qdbusxml2cpp-fix version 0.8
* Command line was: qdbusxml2cpp-fix -c org_deepin_api_XEventMonitor -p /home/donghl/work/code/dde-dock/frame/dbusinterface/generation_dbus_interface/org_deepin_api_xeventmonitor /home/donghl/work/code/dde-dock/frame/dbusinterface/xml/org.deepin.api.XEventMonitor.xml
*
* qdbusxml2cpp-fix is Copyright (C) 2016 Deepin Technology Co., Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#ifndef ORG_DEEPIN_API_XEVENTMONITOR_H
#define ORG_DEEPIN_API_XEVENTMONITOR_H
#include "types/arealist.h"
#include <DBusExtendedAbstractInterface>
#include <QtCore/QObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
/*
* Proxy class for interface org.deepin.api.XEventMonitor1
*/
class __org_deepin_api_XEventMonitorPrivate;
class __org_deepin_api_XEventMonitor : public DBusExtendedAbstractInterface
{
Q_OBJECT
public:
static inline const char *staticInterfaceName()
{ return "org.deepin.api.XEventMonitor1"; }
public:
explicit __org_deepin_api_XEventMonitor(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
~__org_deepin_api_XEventMonitor();
public Q_SLOTS: // METHODS
inline QDBusPendingReply<QString> RegisterArea(int in0, int in1, int in2, int in3, int in4)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1) << QVariant::fromValue(in2) << QVariant::fromValue(in3) << QVariant::fromValue(in4);
return asyncCallWithArgumentList(QStringLiteral("RegisterArea"), argumentList);
}
inline QDBusPendingReply<QString> RegisterAreas(AreaList in0, int in1)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
return asyncCallWithArgumentList(QStringLiteral("RegisterAreas"), argumentList);
}
inline QDBusPendingReply<QString> RegisterFullScreen()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("RegisterFullScreen"), argumentList);
}
inline QDBusPendingReply<bool> UnregisterArea(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("UnregisterArea"), argumentList);
}
Q_SIGNALS: // SIGNALS
void ButtonPress(int in0, int in1, int in2, const QString &in3);
void ButtonRelease(int in0, int in1, int in2, const QString &in3);
void CancelAllArea();
void CursorInto(int in0, int in1, const QString &in2);
void CursorMove(int in0, int in1, const QString &in2);
void CursorOut(int in0, int in1, const QString &in2);
void KeyPress(const QString &in0, int in1, int in2, const QString &in3);
void KeyRelease(const QString &in0, int in1, int in2, const QString &in3);
// begin property changed signals
public Q_SLOTS:
void CallQueued(const QString &callName, const QList<QVariant> &args);
private Q_SLOTS:
void onPendingCallFinished(QDBusPendingCallWatcher *w);
private:
__org_deepin_api_XEventMonitorPrivate *d_ptr;
};
namespace org {
namespace deepin {
namespace api {
typedef ::__org_deepin_api_XEventMonitor XEventMonitor1;
}
}
}
#endif

View File

@ -0,0 +1,59 @@
/*
* Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
*
* Author: sbw <sbw@sbw.so>
* kirigaya <kirigaya@mkacg.com>
* Hualet <mr.asianwang@gmail.com>
*
* Maintainer: sbw <sbw@sbw.so>
* kirigaya <kirigaya@mkacg.com>
* Hualet <mr.asianwang@gmail.com>
* zhaolong <zhaolong@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "arealist.h"
bool MonitRect::operator ==(const MonitRect &rect)
{
return x1 == rect.x1 && y1 == rect.y1 && x2 == rect.x2 && y2 == rect.y2;
}
QDBusArgument &operator<<(QDBusArgument &arg, const MonitRect &rect)
{
arg.beginStructure();
arg << rect.x1 << rect.y1 << rect.x2 << rect.y2;
arg.endStructure();
return arg;
}
const QDBusArgument &operator>>(const QDBusArgument &arg, MonitRect &rect)
{
arg.beginStructure();
arg >> rect.x1 >> rect.y1 >> rect.x2 >> rect.y2;
arg.endStructure();
return arg;
}
void registerAreaListMetaType()
{
qRegisterMetaType<MonitRect>("MonitRect");
qDBusRegisterMetaType<MonitRect>();
qRegisterMetaType<AreaList>("AreaList");
qDBusRegisterMetaType<AreaList>();
}

View File

@ -0,0 +1,53 @@
/*
* Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
*
* Author: sbw <sbw@sbw.so>
* kirigaya <kirigaya@mkacg.com>
* Hualet <mr.asianwang@gmail.com>
*
* Maintainer: sbw <sbw@sbw.so>
* kirigaya <kirigaya@mkacg.com>
* Hualet <mr.asianwang@gmail.com>
* zhaolong <zhaolong@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AREALIST_H
#define AREALIST_H
#include <QDBusMetaType>
#include <QRect>
#include <QList>
struct MonitRect {
int x1;
int y1;
int x2;
int y2;
bool operator ==(const MonitRect& rect);
};
typedef QList<MonitRect> AreaList;
Q_DECLARE_METATYPE(MonitRect)
Q_DECLARE_METATYPE(AreaList)
QDBusArgument &operator<<(QDBusArgument &arg, const MonitRect &rect);
const QDBusArgument &operator>>(const QDBusArgument &arg, MonitRect &rect);
void registerAreaListMetaType();
#endif // AREALIST_H