mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-26 11:21:40 +03:00
48a5a4690e
--this patch fixes the show timer delayer in combination with KWin edges activation even more. The experience now looks almost identical to NONE-KWin edge activation
109 lines
2.7 KiB
C++
109 lines
2.7 KiB
C++
/*
|
|
* Copyright 2018 Michail Vourlakos <mvourlakos@gmail.com>
|
|
*
|
|
* This file is part of Latte-Dock
|
|
*
|
|
* Latte-Dock 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 2 of
|
|
* the License, or (at your option) any later version.
|
|
*
|
|
* Latte-Dock 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 SCREENEDGEGHOSTWINDOW_H
|
|
#define SCREENEDGEGHOSTWINDOW_H
|
|
|
|
// Qt
|
|
#include <QObject>
|
|
#include <QQuickView>
|
|
#include <QTimer>
|
|
|
|
namespace KWayland {
|
|
namespace Client {
|
|
class PlasmaShellSurface;
|
|
}
|
|
}
|
|
|
|
namespace Latte {
|
|
class View;
|
|
}
|
|
|
|
namespace Latte {
|
|
namespace ViewPart {
|
|
|
|
//! What is the importance of this class?
|
|
//!
|
|
//! Plasma is activating the screen edges for the main panel window
|
|
//! unfortunately this isn't possible for the Latte case.
|
|
//! When a window is hidden at an edge it becomes NOT visible
|
|
//! unfortunately that means that all the animations are
|
|
//! stopped (Qt behaviour) and that creates confusion to the user after the window
|
|
//! reappears because various animations are played (adding-removing tasks/launchers)
|
|
//! that aren't relevant any more.
|
|
//!
|
|
//! In order to workaround the above behaviour Latte is using a
|
|
//! fake window to communicate with KWin and the MAIN Latte::View window
|
|
//! continues to use only mask technique to hide
|
|
//!
|
|
//! KDE BUGS: https://bugs.kde.org/show_bug.cgi?id=382219
|
|
//! https://bugs.kde.org/show_bug.cgi?id=392464
|
|
|
|
class ScreenEdgeGhostWindow : public QQuickView
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
ScreenEdgeGhostWindow(Latte::View *view);
|
|
~ScreenEdgeGhostWindow() override;
|
|
|
|
bool containsMouse() const;
|
|
|
|
int location();
|
|
|
|
void hideWithMask();
|
|
void showWithMask();
|
|
|
|
Latte::View *parentView();
|
|
|
|
KWayland::Client::PlasmaShellSurface *surface();
|
|
|
|
signals:
|
|
void containsMouseChanged(bool contains);
|
|
|
|
protected:
|
|
bool event(QEvent *ev) override;
|
|
|
|
private slots:
|
|
void startGeometryTimer();
|
|
void updateGeometry();
|
|
void fixGeometry();
|
|
|
|
private:
|
|
void setContainsMouse(bool contains);
|
|
void setupWaylandIntegration();
|
|
|
|
private:
|
|
bool m_delayedContainsMouse{false};
|
|
bool m_containsMouse{false};
|
|
bool m_inDelete{false};
|
|
QRect m_calculatedGeometry;
|
|
|
|
QTimer m_delayedMouseTimer;
|
|
QTimer m_fixGeometryTimer;
|
|
|
|
Latte::View *m_latteView{nullptr};
|
|
|
|
KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};
|
|
};
|
|
|
|
}
|
|
}
|
|
#endif
|