Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Dock cannot hide clipboard in non special effects mode #159

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion dde-clipboard/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ MainWindow::MainWindow(QWidget *parent)
, m_widthAni(new QPropertyAnimation(this))
, m_aniGroup(new QSequentialAnimationGroup(this))
, m_wmHelper(DWindowManagerHelper::instance())
, m_trickTimer(new QTimer)
{
initUI();
initAni();
Expand Down Expand Up @@ -94,6 +95,11 @@ void MainWindow::geometryChanged()

void MainWindow::showAni()
{
if (m_trickTimer->isActive()) {
return;
}
m_trickTimer->start();

if (!m_hasComposite) {
move(m_rect.x() + WindowMargin, m_rect.y());
setFixedWidth(m_rect.width());
Expand All @@ -111,6 +117,11 @@ void MainWindow::showAni()

void MainWindow::hideAni()
{
if (m_trickTimer->isActive()) {
return;
}
m_trickTimer->start();

if (m_alwaysShow) {
return;
}
Expand Down Expand Up @@ -165,7 +176,7 @@ void MainWindow::registerMonitor()
}
m_regionMonitor = new DRegionMonitor(this);
m_regionMonitor->registerRegion(QRegion(QRect()));
connect(m_regionMonitor, &DRegionMonitor::buttonPress, this, [ = ](const QPoint &p, const int flag) {
connect(m_regionMonitor, &DRegionMonitor::buttonRelease, this, [ = ](const QPoint &p, const int flag) {
Q_UNUSED(flag);
if (!geometry().contains(p))
if (!isHidden()) {
Expand Down Expand Up @@ -219,6 +230,9 @@ void MainWindow::initUI()

setMaskAlpha(static_cast<int>(this->opacity() * 255));
setFocusPolicy(Qt::NoFocus);

m_trickTimer->setInterval(300);
m_trickTimer->setSingleShot(true);
}

void MainWindow::initAni()
Expand Down
2 changes: 2 additions & 0 deletions dde-clipboard/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ private Q_SLOTS:
QRect m_rect;

DWindowManagerHelper *m_wmHelper;

QTimer *m_trickTimer;

bool m_hasComposite = false;

Expand Down
Loading