- 暂存区非空且未拖拽时只显示暂存列表,隐藏传送门与内容工厂并收窄窗口 - 内容工厂自身区域拖入也会展开动作 - 面板矩形改用屏幕可用区 + 边距计算(layer-shell 下 mapToGlobal 不可靠) - 离开概览只复位传送门状态,不关闭面板;125ms - 移除“在哪里 drop”提示
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
// SPDX-FileCopyrightText: 2026 GXDE OS Team
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QRect>
|
|
|
|
/**
|
|
* Client for the compositor side "portal" (org.gxde.Portal).
|
|
*
|
|
* Start with \a beginPortal() while a drag hovers the portal zone. The
|
|
* compositor opens the window overview in portal mode and forwards the drag
|
|
* to the window under the cursor, so the target application receives a real
|
|
* wl_data_device drop at the cursor position.
|
|
*/
|
|
class PortalClient : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
static PortalClient *instance();
|
|
|
|
bool available() const { return m_available; }
|
|
|
|
/** @return true when the compositor opened the overview. */
|
|
bool beginPortal(const QRect &panelRect = QRect());
|
|
void cancelPortal();
|
|
|
|
/** Filter the drag mime types we want to react to. */
|
|
static bool mimeInteresting(const QString &mimeTypes);
|
|
|
|
signals:
|
|
void dragStarted(const QString &mimeTypes);
|
|
void dragEnded();
|
|
void portalClosed();
|
|
void dropped(const QString &uuid, bool accepted);
|
|
|
|
private slots:
|
|
void onDragStarted(const QString &mimeTypes);
|
|
void onDragEnded();
|
|
void onPortalClosed();
|
|
void onDropped(const QString &uuid, bool accepted);
|
|
|
|
private:
|
|
explicit PortalClient(QObject *parent = nullptr);
|
|
|
|
bool m_available = false;
|
|
};
|