feat(portal): 接入合成器传送门,暂存区固定/消耗语义

- 新增 PortalClient:org.gxde.Portal 的 BeginPortal / CancelPortal 与 drag 信号
- 传送门区域悬停 150ms 后打开合成器 overview;无窗口/不支持时给出提示
- 拖拽开始时自动弹出面板(120ms 延迟,mime 过滤),拖拽结束自动收起
- 暂存区每行新增固定按钮;默认拖出后消耗,固定后保留;取消拖拽不消耗
- 拒绝自身拖拽落入暂存区,避免重复条目
This commit is contained in:
2026-10-30 19:55:25 +08:00
parent f9204a03d1
commit 68d3eb1a24
10 changed files with 314 additions and 6 deletions
+24
View File
@@ -4,10 +4,12 @@
#include "app.h"
#include "config.h"
#include "portal/portalclient.h"
#include "staging/stagingmodel.h"
#include "ui/portalpanel.h"
#include <QLocalServer>
#include <QTimer>
#include <QLocalSocket>
#include <unistd.h>
@@ -50,6 +52,28 @@ bool App::init(bool daemon, bool forceShow)
m_model = new StagingModel(this);
PortalClient *portal = PortalClient::instance();
connect(portal, &PortalClient::dragStarted, this, [this](const QString &mimeTypes) {
if (!PortalClient::mimeInteresting(mimeTypes)) {
return;
}
m_dragging = true;
if (!m_model->isEmpty()) {
return;
}
QTimer::singleShot(120, this, [this]() {
if (m_dragging && m_model->isEmpty()) {
showPanel();
}
});
});
connect(portal, &PortalClient::dragEnded, this, [this]() {
m_dragging = false;
if (m_model->isEmpty() && m_panel && m_panel->isVisible()) {
m_panel->dismiss();
}
});
connect(m_model, &StagingModel::countChanged, this, [this]() {
if (!m_daemon && !m_model->isEmpty() && m_panel) {
m_panel->popup();