File indexing completed on 2024-04-28 16:49:28

0001 /*
0002 *  Copyright 2019  Michail Vourlakos <mvourlakos@gmail.com>
0003 *
0004 *  This file is part of Latte-Dock
0005 *
0006 *  Latte-Dock is free software; you can redistribute it and/or
0007 *  modify it under the terms of the GNU General Public License as
0008 *  published by the Free Software Foundation; either version 2 of
0009 *  the License, or (at your option) any later version.
0010 *
0011 *  Latte-Dock is distributed in the hope that it will be useful,
0012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 *  GNU General Public License for more details.
0015 *
0016 *  You should have received a copy of the GNU General Public License
0017 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 #ifndef WINDOWSCURRENTSCREENTRACKER_H
0021 #define WINDOWSCURRENTSCREENTRACKER_H
0022 
0023 // local
0024 #include "../../wm/abstractwindowinterface.h"
0025 
0026 // Qt
0027 #include <QObject>
0028 
0029 namespace Latte{
0030 class View;
0031 
0032 namespace ViewPart {
0033 class WindowsTracker;
0034 }
0035 
0036 namespace WindowSystem {
0037 class AbstractWindowInterface;
0038 class SchemeColors;
0039 namespace Tracker {
0040 class LastActiveWindow;
0041 }
0042 }
0043 }
0044 
0045 namespace Latte {
0046 namespace ViewPart {
0047 namespace TrackerPart {
0048 
0049 class CurrentScreenTracker : public QObject {
0050     Q_OBJECT
0051     Q_PROPERTY(bool activeWindowMaximized READ activeWindowMaximized NOTIFY activeWindowMaximizedChanged)
0052     Q_PROPERTY(bool activeWindowTouching READ activeWindowTouching NOTIFY activeWindowTouchingChanged)
0053     Q_PROPERTY(bool existsWindowActive READ existsWindowActive NOTIFY existsWindowActiveChanged)
0054     Q_PROPERTY(bool existsWindowMaximized READ existsWindowMaximized NOTIFY existsWindowMaximizedChanged)
0055     Q_PROPERTY(bool existsWindowTouching READ existsWindowTouching NOTIFY existsWindowTouchingChanged)
0056     Q_PROPERTY(bool isTouchingBusyVerticalView READ isTouchingBusyVerticalView NOTIFY isTouchingBusyVerticalViewChanged)
0057     Q_PROPERTY(Latte::WindowSystem::SchemeColors *activeWindowScheme READ activeWindowScheme NOTIFY activeWindowSchemeChanged)
0058     Q_PROPERTY(Latte::WindowSystem::SchemeColors *touchingWindowScheme READ touchingWindowScheme NOTIFY touchingWindowSchemeChanged)
0059 
0060     Q_PROPERTY(Latte::WindowSystem::Tracker::LastActiveWindow *lastActiveWindow READ lastActiveWindow NOTIFY lastActiveWindowChanged)
0061 
0062 public:
0063     explicit CurrentScreenTracker(WindowsTracker *parent);
0064     virtual ~CurrentScreenTracker();
0065 
0066     bool activeWindowMaximized() const;
0067     bool activeWindowTouching() const;
0068     bool existsWindowActive() const;
0069     bool existsWindowMaximized() const;
0070     bool existsWindowTouching() const;
0071 
0072     bool isTouchingBusyVerticalView() const;
0073 
0074     WindowSystem::SchemeColors *activeWindowScheme() const;
0075     WindowSystem::SchemeColors *touchingWindowScheme() const;
0076 
0077     WindowSystem::Tracker::LastActiveWindow *lastActiveWindow();
0078 
0079 public slots:
0080     Q_INVOKABLE void requestMoveLastWindow(int localX, int localY);
0081 
0082 signals:
0083     void activeWindowMaximizedChanged();
0084     void activeWindowTouchingChanged();
0085     void existsWindowActiveChanged();
0086     void existsWindowMaximizedChanged();
0087     void existsWindowTouchingChanged();
0088     void isTouchingBusyVerticalViewChanged();
0089 
0090     void activeWindowSchemeChanged();
0091     void touchingWindowSchemeChanged();
0092 
0093     void lastActiveWindowChanged();
0094 
0095 private slots:
0096     void initSignalsForInformation();
0097 
0098 private:
0099     void init();
0100 
0101 private:
0102     Latte::View *m_latteView{nullptr};
0103     WindowSystem::AbstractWindowInterface *m_wm{nullptr};
0104 };
0105 
0106 }
0107 }
0108 }
0109 
0110 #endif