1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-03 09:17:50 +03:00
latte-dock/app/primaryoutputwatcher.h
Michail Vourlakos b1d57051c2 wayland:support Plasma primaryscreen protocol
--use ScreenPool as reference for primary screen.
The new code uses PrimaryOutputWatcher class from
Plasma Shell in order to keep track of primary
screen at all cases.

BUG:448418
FIXED-IN:0.11.0
2022-05-09 20:35:45 +03:00

59 lines
1.3 KiB
C++

/*
SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#ifndef PRIMARYOUTPUTWATCHER_H
#define PRIMARYOUTPUTWATCHER_H
#include <QAbstractNativeEventFilter>
#include <QObject>
namespace KWayland
{
namespace Client
{
class Registry;
class ConnectionThread;
}
}
class QScreen;
class PrimaryOutputWatcher : public QObject, public QAbstractNativeEventFilter
{
Q_OBJECT
public:
PrimaryOutputWatcher(QObject *parent);
QScreen *primaryScreen() const;
QScreen *screenForName(const QString &outputName) const;
Q_SIGNALS:
void primaryOutputNameChanged(const QString &oldOutputName, const QString &newOutputName);
protected:
friend class WaylandOutputDevice;
void setPrimaryOutputName(const QString &outputName);
private:
void setupRegistry();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
#else
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
#endif
// All
QString m_primaryOutputName;
// Wayland
KWayland::Client::Registry *m_registry = nullptr;
QString m_primaryOutputWayland;
// Xrandr
int m_xrandrExtensionOffset;
};
#endif // PRIMARYOUTPUTWATCHER_H