summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandoutput.h
diff options
context:
space:
mode:
authorPier Luigi Fiorini <pierluigi.fiorini@gmail.com>2015-04-10 17:52:49 +0200
committerPier Luigi Fiorini <pierluigi.fiorini@hawaiios.org>2016-10-03 15:15:58 +0000
commit7ee4be6af2c92c345539bb4950dd48d7a740847d (patch)
tree2acbcfb9fd0a2dbc995cb0d700e7e14ad4afd759 /src/compositor/compositor_api/qwaylandoutput.h
parent59c8598958959de943a0782093f020ae1c348edf (diff)
Add mode support to QWaylandOutput
Outputs usually have more than one mode, add an API to support them. When sizeFollowsWindow is true, modes are replaced by one with the window size and refresh rate. In that circumstance the mode changes when the window is resized. The sizeFollowsWindow property default value is no longer true. The setGeometry() method is gone as it doesn't make sense now, the setWidth() and setHeight() methods are now private slots to resize the resolution as the window resizes (and sizeFollowsWindow is true). Refresh rate is expressed in mHz rather than Hz just like the Wayland protocol. A compositor implementation may choose to add modes if it has access to hardware information, it will call addMode() for each mode and then invoke the setCurrentMode() method that sends the modes list to the client. The preferred mode is indicated with a boolean parameter to the addMode() method. Change-Id: Iffed4784ccef695c276ebd800172957f4cff3324 Task-number: QTBUG-49814 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandoutput.h')
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.h28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/compositor/compositor_api/qwaylandoutput.h b/src/compositor/compositor_api/qwaylandoutput.h
index e4cbb6109..190231c12 100644
--- a/src/compositor/compositor_api/qwaylandoutput.h
+++ b/src/compositor/compositor_api/qwaylandoutput.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2014-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+** Copyright (C) 2014-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt.io/licensing/
**
@@ -39,6 +39,7 @@
#define QWAYLANDOUTPUT_H
#include <QtWaylandCompositor/qwaylandcompositorextension.h>
+#include <QtWaylandCompositor/QWaylandOutputMode>
#include <QtCore/QObject>
#include <QObject>
@@ -66,7 +67,6 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandOutput : public QWaylandObject
Q_PROPERTY(QString manufacturer READ manufacturer WRITE setManufacturer NOTIFY manufacturerChanged)
Q_PROPERTY(QString model READ model WRITE setModel NOTIFY modelChanged)
Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged)
- Q_PROPERTY(QWaylandOutput::Mode mode READ mode WRITE setMode NOTIFY modeChanged)
Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
Q_PROPERTY(QRect availableGeometry READ availableGeometry WRITE setAvailableGeometry NOTIFY availableGeometryChanged)
Q_PROPERTY(QSize physicalSize READ physicalSize WRITE setPhysicalSize NOTIFY physicalSizeChanged)
@@ -99,12 +99,6 @@ public:
};
Q_ENUM(Transform)
- struct Mode
- {
- QSize size;
- qreal refreshRate;
- };
-
QWaylandOutput();
QWaylandOutput(QWaylandCompositor *compositor, QWindow *window);
~QWaylandOutput();
@@ -127,13 +121,14 @@ public:
QPoint position() const;
void setPosition(const QPoint &pt);
- Mode mode() const;
- void setMode(const Mode &mode);
+ QList<QWaylandOutputMode> modes() const;
+
+ void addMode(const QWaylandOutputMode &mode, bool preferred = false);
+
+ QWaylandOutputMode currentMode() const;
+ void setCurrentMode(const QWaylandOutputMode &mode);
QRect geometry() const;
- void setGeometry(const QRect &geometry);
- void setWidth(int newWidth);
- void setHeight(int newHeight);
QRect availableGeometry() const;
void setAvailableGeometry(const QRect &availableGeometry);
@@ -169,7 +164,8 @@ Q_SIGNALS:
void windowChanged();
void positionChanged();
void geometryChanged();
- void modeChanged();
+ void modeAdded();
+ void currentModeChanged();
void availableGeometryChanged();
void physicalSizeChanged();
void scaleFactorChanged();
@@ -182,6 +178,8 @@ Q_SIGNALS:
void windowDestroyed();
private Q_SLOTS:
+ void handleSetWidth(int newWidth);
+ void handleSetHeight(int newHeight);
void handleWindowDestroyed();
protected:
@@ -192,6 +190,4 @@ protected:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QWaylandOutput::Mode)
-
#endif // QWAYLANDOUTPUT_H