2018-03-28 20:39:52 +03:00
/*
* 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
2019-07-15 14:53:40 +03:00
// local
2020-01-22 19:45:13 +02:00
# include "subwindow.h"
# include "../../lattecorona.h"
# include "../../wm/windowinfowrap.h"
2019-07-15 14:53:40 +03:00
2018-12-02 02:05:52 +02:00
// Qt
2018-03-28 20:39:52 +03:00
# include <QObject>
# include <QQuickView>
2018-05-20 22:50:23 +03:00
# include <QTimer>
2018-03-28 20:39:52 +03:00
namespace KWayland {
namespace Client {
class PlasmaShellSurface ;
}
}
namespace Latte {
2019-07-15 14:53:40 +03:00
class Corona ;
2018-12-06 12:15:58 +02:00
class View ;
2018-03-28 20:39:52 +03:00
}
namespace Latte {
2018-12-09 00:15:17 +02:00
namespace ViewPart {
2018-03-28 20:39:52 +03:00
//! What is the importance of this class?
//!
//! Plasma is activating the screen edges for the main panel window
2019-01-01 11:19:44 +02:00
//! unfortunately this isn't possible for the Latte case.
2018-03-28 20:39:52 +03:00
//! 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)
2019-01-01 11:19:44 +02:00
//! that aren't relevant any more.
2018-03-28 20:39:52 +03:00
//!
//! In order to workaround the above behaviour Latte is using a
2018-12-06 16:09:42 +02:00
//! fake window to communicate with KWin and the MAIN Latte::View window
2018-03-28 20:39:52 +03:00
//! 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
2020-01-22 19:45:13 +02:00
class ScreenEdgeGhostWindow : public SubWindow
2018-07-03 22:15:45 +03:00
{
2018-03-28 20:39:52 +03:00
Q_OBJECT
public :
2018-12-06 12:15:58 +02:00
ScreenEdgeGhostWindow ( Latte : : View * view ) ;
2018-03-28 20:39:52 +03:00
~ ScreenEdgeGhostWindow ( ) override ;
2019-02-24 19:09:48 +02:00
bool containsMouse ( ) const ;
2018-03-28 20:39:52 +03:00
signals :
2018-11-13 19:06:33 +02:00
void containsMouseChanged ( bool contains ) ;
2019-07-10 16:23:06 +03:00
void dragEntered ( ) ;
2018-03-28 20:39:52 +03:00
protected :
bool event ( QEvent * ev ) override ;
2020-03-02 09:39:07 +02:00
QString validTitlePrefix ( ) const override ;
2020-01-22 19:45:13 +02:00
void updateGeometry ( ) override ;
2018-03-28 20:39:52 +03:00
private :
2019-02-24 19:09:48 +02:00
void setContainsMouse ( bool contains ) ;
2018-03-28 20:39:52 +03:00
private :
2019-03-11 16:09:50 +02:00
bool m_delayedContainsMouse { false } ;
2019-02-24 19:09:48 +02:00
bool m_containsMouse { false } ;
2018-03-28 20:39:52 +03:00
2019-03-11 16:09:50 +02:00
QTimer m_delayedMouseTimer ;
2018-03-28 20:39:52 +03:00
} ;
}
2018-12-09 00:15:17 +02:00
}
2018-03-28 20:39:52 +03:00
# endif