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

0001 /*
0002     SPDX-FileCopyrightText: 2020 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef FLOATINGGAPWINDOW_H
0007 #define FLOATINGGAPWINDOW_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 //! This window is responsible to identify if the mouse is still present
0036 //! in the REAL FLOATING GAP between the VIEW and the SCREEN EDGE.
0037 //! When VIEWS are REAL FLOATING then the VIEW Window is really placed
0038 //! as it is shown to the user. In that case we need a way to check
0039 //! where the mouse is even though it is OUTSIDE the VIEW or the
0040 //! SCREENEDGEGHOSTWINDOW. The main functionality of FloatingGapWindow
0041 //! is that it is TEMPORARILY shown/draw after a MUSTHIDE signal of
0042 //! VisibilityManager was sent; in order to check if the mouse is still
0043 //! inside the FLOATINGGAP. After it has really identified where mouse
0044 //! is present, an FloatingGapWindow::asyncContainsMouse(contains) signal
0045 //! is sent.
0046 
0047 class FloatingGapWindow : public SubWindow
0048 {
0049     Q_OBJECT
0050 
0051 public:
0052     FloatingGapWindow(Latte::View *view);
0053     ~FloatingGapWindow() override;
0054 
0055     void callAsyncContainsMouse();
0056 
0057 signals:
0058     void asyncContainsMouseChanged(bool contains); //called from visibility to check if mouse is in the free sensitive floating area
0059 
0060 protected:
0061     bool event(QEvent *ev) override;
0062     QString validTitlePrefix() const override;
0063     void updateGeometry() override;
0064 
0065 private:
0066     void triggerAsyncContainsMouseSignals();
0067 
0068 private:
0069     bool m_containsMouse{false};
0070 
0071     bool m_inAsyncContainsMouse{false}; //called from visibility to check if mouse is in the free sensitive floating area
0072 
0073     QTimer m_asyncMouseTimer; //called from visibility to check if mouse is in the free sensitive floating area
0074 };
0075 
0076 }
0077 }
0078 #endif