2017-01-03 01:05:30 +03:00
/*
* Copyright 2016 Smith AR < audoban @ openmailbox . org >
* 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/>.
*/
2016-12-28 10:45:21 +03:00
# ifndef ABSTRACTWINDOWINTERFACE_H
# define ABSTRACTWINDOWINTERFACE_H
2018-12-02 03:05:52 +03:00
// local
2018-10-14 13:54:09 +03:00
# include "schemecolors.h"
2016-12-28 10:45:21 +03:00
# include "windowinfowrap.h"
2018-12-07 19:55:35 +03:00
# include "../liblatte2/types.h"
# include "../liblatte2/extras.h"
2016-12-28 10:45:21 +03:00
2018-12-02 03:05:52 +03:00
// C++
2016-12-28 10:45:21 +03:00
# include <unordered_map>
# include <list>
2018-12-02 03:05:52 +03:00
// Qt
2016-12-28 10:45:21 +03:00
# include <QObject>
2017-06-16 00:56:55 +03:00
# include <QWindow>
2017-02-25 05:40:47 +03:00
# include <QDialog>
2018-10-14 13:54:09 +03:00
# include <QMap>
2017-06-16 00:56:55 +03:00
# include <QRect>
2018-10-28 11:03:22 +03:00
# include <QPoint>
2017-06-16 00:56:55 +03:00
# include <QPointer>
2017-03-23 08:03:45 +03:00
# include <QScreen>
2019-05-27 20:09:48 +03:00
# include <QTimer>
2016-12-28 10:45:21 +03:00
2018-12-02 03:05:52 +03:00
// KDE
2017-02-25 05:40:47 +03:00
# include <KActivities/Consumer>
2016-12-29 08:37:53 +03:00
2018-12-02 03:05:52 +03:00
// Plasma
# include <Plasma>
2019-05-11 21:10:02 +03:00
namespace Latte {
class Corona ;
namespace WindowSystem {
2019-05-31 14:52:16 +03:00
namespace Tracker {
class Schemes ;
class Windows ;
}
2019-05-11 21:10:02 +03:00
}
}
2016-12-28 10:45:21 +03:00
namespace Latte {
2019-05-11 15:43:10 +03:00
namespace WindowSystem {
2016-12-30 10:11:42 +03:00
2018-07-03 22:15:45 +03:00
class AbstractWindowInterface : public QObject
{
2016-12-28 10:45:21 +03:00
Q_OBJECT
2017-01-16 22:07:49 +03:00
2016-12-28 10:45:21 +03:00
public :
2018-07-03 22:15:45 +03:00
enum class Slide
{
2017-02-25 05:40:47 +03:00
None ,
Top ,
Left ,
Bottom ,
Right ,
} ;
explicit AbstractWindowInterface ( QObject * parent = nullptr ) ;
2016-12-28 10:45:21 +03:00
virtual ~ AbstractWindowInterface ( ) ;
2017-01-16 22:07:49 +03:00
2018-12-06 17:09:42 +03:00
virtual void setViewExtraFlags ( QWindow & view ) = 0 ;
virtual void setViewStruts ( QWindow & view , const QRect & rect
2018-01-13 13:55:13 +03:00
, Plasma : : Types : : Location location ) = 0 ;
2018-01-21 12:53:15 +03:00
virtual void setWindowOnActivities ( QWindow & window , const QStringList & activities ) = 0 ;
2017-03-23 08:03:45 +03:00
2018-12-06 17:09:42 +03:00
virtual void removeViewStruts ( QWindow & view ) const = 0 ;
2017-01-16 22:07:49 +03:00
2017-06-09 01:10:49 +03:00
virtual WindowId activeWindow ( ) const = 0 ;
virtual WindowInfoWrap requestInfo ( WindowId wid ) const = 0 ;
2017-01-02 09:04:10 +03:00
virtual WindowInfoWrap requestInfoActive ( ) const = 0 ;
2017-06-09 01:10:49 +03:00
virtual bool isOnCurrentDesktop ( WindowId wid ) const = 0 ;
2017-06-21 03:06:04 +03:00
virtual bool isOnCurrentActivity ( WindowId wid ) const = 0 ;
2017-01-16 22:07:49 +03:00
2018-01-26 20:46:02 +03:00
virtual void setKeepAbove ( const QDialog & dialog , bool above = true ) const = 0 ;
2017-02-25 05:40:47 +03:00
virtual void skipTaskBar ( const QDialog & dialog ) const = 0 ;
2017-06-16 00:56:55 +03:00
virtual void slideWindow ( QWindow & view , Slide location ) const = 0 ;
virtual void enableBlurBehind ( QWindow & view ) const = 0 ;
2018-03-28 20:39:52 +03:00
virtual void setEdgeStateFor ( QWindow * view , bool active ) const = 0 ;
2017-01-16 22:07:49 +03:00
2019-01-14 19:47:49 +03:00
virtual void releaseMouseEventFor ( WindowId wid ) const = 0 ;
2019-04-01 23:50:25 +03:00
virtual void requestActivate ( WindowId wid ) const = 0 ;
2018-10-28 22:10:08 +03:00
virtual void requestToggleMaximized ( WindowId wid ) const = 0 ;
virtual void requestMoveWindow ( WindowId wid , QPoint from ) const = 0 ;
virtual bool windowCanBeDragged ( WindowId wid ) const = 0 ;
2019-05-27 18:56:24 +03:00
virtual QIcon iconFor ( WindowId wid ) const = 0 ;
2019-04-01 23:50:25 +03:00
virtual WindowId winIdFor ( QString appId , QRect geometry ) const = 0 ;
2018-10-28 11:03:22 +03:00
2019-05-11 21:10:02 +03:00
Latte : : Corona * corona ( ) ;
2019-05-31 14:52:16 +03:00
Tracker : : Schemes * schemesTracker ( ) ;
Tracker : : Windows * windowsTracker ( ) ;
2018-10-14 13:54:09 +03:00
2016-12-28 10:45:21 +03:00
signals :
2017-06-09 01:10:49 +03:00
void activeWindowChanged ( WindowId wid ) ;
void windowChanged ( WindowId winfo ) ;
void windowAdded ( WindowId wid ) ;
void windowRemoved ( WindowId wid ) ;
2017-02-14 01:52:41 +03:00
void currentDesktopChanged ( ) ;
2017-02-12 11:01:12 +03:00
void currentActivityChanged ( ) ;
2017-01-16 22:07:49 +03:00
2016-12-28 10:45:21 +03:00
protected :
2017-02-25 05:40:47 +03:00
QPointer < KActivities : : Consumer > m_activities ;
2018-10-14 13:54:09 +03:00
2019-05-27 20:09:48 +03:00
//! Sending too fast plenty of signals for the same window
//! has no reason and can create HIGH CPU usage. This Timer
//! can delay the batch sending of signals for the same window
WindowId m_windowChangedWaiting ;
QTimer m_windowWaitingTimer ;
void considerWindowChanged ( WindowId wid ) ;
2018-10-14 13:54:09 +03:00
private :
2019-05-11 21:10:02 +03:00
Latte : : Corona * m_corona ;
2019-05-31 14:52:16 +03:00
Tracker : : Schemes * m_schemesTracker ;
Tracker : : Windows * m_windowsTracker ;
2016-12-28 10:45:21 +03:00
} ;
2017-02-25 05:40:47 +03:00
}
2019-05-11 15:43:10 +03:00
}
2016-12-28 10:45:21 +03:00
# endif // ABSTRACTWINDOWINTERFACE_H