You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
2.9 KiB
C
122 lines
2.9 KiB
C
7 years ago
|
/*
|
||
5 years ago
|
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
|
||
7 years ago
|
*
|
||
|
* 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/>.
|
||
|
*/
|
||
|
|
||
5 years ago
|
#ifndef VIEWSUBWINDOW_H
|
||
|
#define VIEWSUBWINDOW_H
|
||
7 years ago
|
|
||
6 years ago
|
// local
|
||
5 years ago
|
#include "../../lattecorona.h"
|
||
|
#include "../../wm/windowinfowrap.h"
|
||
6 years ago
|
|
||
6 years ago
|
// Qt
|
||
7 years ago
|
#include <QObject>
|
||
|
#include <QQuickView>
|
||
7 years ago
|
#include <QTimer>
|
||
7 years ago
|
|
||
|
namespace KWayland {
|
||
|
namespace Client {
|
||
|
class PlasmaShellSurface;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
namespace Latte {
|
||
6 years ago
|
class Corona;
|
||
6 years ago
|
class View;
|
||
7 years ago
|
}
|
||
|
|
||
|
namespace Latte {
|
||
6 years ago
|
namespace ViewPart {
|
||
7 years ago
|
|
||
|
//! What is the importance of this class?
|
||
|
//!
|
||
5 years ago
|
//! This window is responsible to provide a common window base for ViewPart::Helpers
|
||
7 years ago
|
|
||
5 years ago
|
class SubWindow : public QQuickView
|
||
7 years ago
|
{
|
||
7 years ago
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
5 years ago
|
SubWindow(Latte::View *view, QString debugType);
|
||
|
~SubWindow() override;
|
||
6 years ago
|
|
||
7 years ago
|
int location();
|
||
5 years ago
|
int thickness() const;
|
||
7 years ago
|
|
||
|
void hideWithMask();
|
||
|
void showWithMask();
|
||
|
|
||
6 years ago
|
Latte::View *parentView();
|
||
7 years ago
|
|
||
|
KWayland::Client::PlasmaShellSurface *surface();
|
||
|
|
||
|
signals:
|
||
6 years ago
|
void forcedShown(); //[workaround] forced shown to avoid a KWin issue that hides windows when activities are stopped
|
||
5 years ago
|
void calculatedGeometryChanged();
|
||
7 years ago
|
|
||
|
protected:
|
||
|
bool event(QEvent *ev) override;
|
||
|
|
||
5 years ago
|
//! it is used to update m_calculatedGeometry correctly
|
||
|
virtual void updateGeometry() = 0;
|
||
|
|
||
7 years ago
|
private slots:
|
||
7 years ago
|
void startGeometryTimer();
|
||
7 years ago
|
void fixGeometry();
|
||
7 years ago
|
|
||
|
private:
|
||
|
void setupWaylandIntegration();
|
||
|
|
||
5 years ago
|
protected:
|
||
|
bool m_debugMode{false};
|
||
7 years ago
|
bool m_inDelete{false};
|
||
5 years ago
|
|
||
|
int m_thickness{2};
|
||
|
|
||
5 years ago
|
QString m_debugType;
|
||
|
|
||
7 years ago
|
QRect m_calculatedGeometry;
|
||
7 years ago
|
|
||
5 years ago
|
//! [workaround] colors in order to help masking to apply immediately
|
||
|
//! for some reason when the window in with no content the mask is not
|
||
|
//! update immediately
|
||
|
QColor m_hideColor;
|
||
|
QColor m_showColor;
|
||
|
|
||
7 years ago
|
QTimer m_fixGeometryTimer;
|
||
|
|
||
6 years ago
|
//! HACK: Timers in order to handle KWin faulty
|
||
|
//! behavior that hides Views when closing Activities
|
||
|
//! with no actual reason
|
||
|
QTimer m_visibleHackTimer1;
|
||
|
QTimer m_visibleHackTimer2;
|
||
|
//! Connections for the KWin visibility hack
|
||
|
QList<QMetaObject::Connection> connectionsHack;
|
||
|
|
||
6 years ago
|
Latte::View *m_latteView{nullptr};
|
||
7 years ago
|
|
||
6 years ago
|
QPointer<Latte::Corona> m_corona;
|
||
|
|
||
6 years ago
|
Latte::WindowSystem::WindowId m_trackedWindowId;
|
||
7 years ago
|
KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};
|
||
|
};
|
||
|
|
||
|
}
|
||
6 years ago
|
}
|
||
7 years ago
|
#endif
|