1 Star 0 Fork 1

iceleaf/kwin

forked from Jingling/kwin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
globalpinchgestures.cpp 1.76 KB
一键复制 编辑 原始数据 按行查看 历史
jingos 提交于 2021-11-30 16:22 . JingOS V1.1.0
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2021 yongrui li <liyongrui@jingos.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "globalpinchgestures.h"
#include "effects.h"
#include "gestures.h"
namespace KWin {
GlobalPinchGestures::GlobalPinchGestures(QObject *parent)
: QObject(parent)
, m_5FingersPinchGesture(new PinchGesture(this))
{
}
void GlobalPinchGestures::registerGesture(GestureRecognizer *recongnizer)
{
if (nullptr == recongnizer) {
return;
}
recongnizer->registerPinchGesture(m_5FingersPinchGesture);
init5FingersPinchGesture();
}
void GlobalPinchGestures::unregisterGesture(GestureRecognizer *recongnizer)
{
if (nullptr == recongnizer) {
return;
}
recongnizer->unregisterPinchGesture(m_5FingersPinchGesture);
}
void GlobalPinchGestures::init5FingersPinchGesture()
{
m_5FingersPinchGesture->setMinimumFingerCount(5);
m_5FingersPinchGesture->setMaximumFingerCount(5);
m_5FingersPinchGesture->setFingerDistanceIncrement(800);
connect(m_5FingersPinchGesture, &Gesture::cancelled, this, &GlobalPinchGestures::on5FingersPinchCancelled, Qt::QueuedConnection);
connect(m_5FingersPinchGesture, &Gesture::triggered, this, &GlobalPinchGestures::on5FingersPinchTriggered, Qt::QueuedConnection);
}
void GlobalPinchGestures::on5FingersPinchTriggered(quint32 time, const qreal &lastSpeed)
{
Q_UNUSED(time);
Q_UNUSED(lastSpeed);
showTaskPanel();
}
void GlobalPinchGestures::on5FingersPinchCancelled(quint32 time, const qreal &lastSpeed)
{
Q_UNUSED(time);
Q_UNUSED(lastSpeed);
m_5FingersPinchGesture->resetStartDistance();
}
void GlobalPinchGestures::showTaskPanel()
{
effects->toTriggerTask();
}
} // namespace
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/iceleaf/kwin.git
git@gitee.com:iceleaf/kwin.git
iceleaf
kwin
kwin
master

搜索帮助