File indexing completed on 2024-04-21 05:31:04

0001 /*
0002     SPDX-FileCopyrightText: 2018 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef SCREENEDGEGHOSTWINDOW_H
0007 #define SCREENEDGEGHOSTWINDOW_H
0008 
0009 // local
0010 #include "subwindow.h"
0011 #include "../../lattecorona.h"
0012 #include "../../wm/windowinfowrap.h"
0013 
0014 // Qt
0015 #include <QObject>
0016 #include <QQuickView>
0017 #include <QTimer>
0018 
0019 namespace KWayland {
0020 namespace Client {
0021 class PlasmaShellSurface;
0022 }
0023 }
0024 
0025 namespace Latte {
0026 class Corona;
0027 class View;
0028 }
0029 
0030 namespace Latte {
0031 namespace ViewPart {
0032 
0033 //! What is the importance of this class?
0034 //!
0035 //! Plasma is activating the screen edges for the main panel window
0036 //! unfortunately this isn't possible for the Latte case.
0037 //! When a window is hidden at an edge it becomes NOT visible
0038 //! unfortunately that means that all the animations are
0039 //! stopped (Qt behaviour) and that creates confusion to the user after the window
0040 //! reappears because various animations are played (adding-removing tasks/launchers)
0041 //! that aren't relevant any more.
0042 //!
0043 //! In order to workaround the above behaviour Latte is using a
0044 //! fake window to communicate with KWin and the MAIN Latte::View window
0045 //! continues to use only mask technique to hide
0046 //!
0047 //! KDE BUGS: https://bugs.kde.org/show_bug.cgi?id=382219
0048 //!           https://bugs.kde.org/show_bug.cgi?id=392464
0049 
0050 class ScreenEdgeGhostWindow : public SubWindow
0051 {
0052     Q_OBJECT
0053 
0054 public:
0055     ScreenEdgeGhostWindow(Latte::View *view);
0056     ~ScreenEdgeGhostWindow() override;
0057 
0058     bool containsMouse() const;
0059 
0060 signals:
0061     void containsMouseChanged(bool contains);
0062     void dragEntered();
0063 
0064 protected:
0065     bool event(QEvent *ev) override;
0066     QString validTitlePrefix() const override;
0067     void updateGeometry() override;
0068 
0069 private:
0070     void setContainsMouse(bool contains);
0071 
0072 private:
0073     bool m_delayedContainsMouse{false};
0074     bool m_containsMouse{false};
0075 
0076     QTimer m_delayedMouseTimer;
0077 };
0078 
0079 }
0080 }
0081 #endif