summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-03-03 17:24:26 +0200
committerPier Luigi Fiorini <pierluigi.fiorini@gmail.com>2014-07-31 19:06:30 +0200
commit00d7933816d37f5e7bb8d61624c4d4ca38bb014f (patch)
tree9823c47e7b81ead86cacd15643baac62ff8d8f60
parentd6fd07906286562c6fa3103aa671f6166d99db90 (diff)
Use wayland core interfaces to signal output rotation
The wl_output interface has an event for signaling the rotation of the display, so use that instead of our own thing. Change-Id: I8a017d575ee456a7a81649e19a015085fb784805 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
-rw-r--r--src/client/qwaylandextendedoutput.cpp42
-rw-r--r--src/client/qwaylandextendedoutput_p.h5
-rw-r--r--src/client/qwaylandextendedsurface.cpp16
-rw-r--r--src/client/qwaylandextendedsurface_p.h1
-rw-r--r--src/client/qwaylandscreen.cpp41
-rw-r--r--src/client/qwaylandscreen_p.h1
-rw-r--r--src/client/qwaylandwindow.cpp7
-rw-r--r--src/client/qwaylandwindow_p.h2
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp4
-rw-r--r--src/compositor/wayland_wrapper/qwlcompositor.cpp18
-rw-r--r--src/compositor/wayland_wrapper/qwlcompositor_p.h2
-rw-r--r--src/compositor/wayland_wrapper/qwlextendedoutput.cpp52
-rw-r--r--src/compositor/wayland_wrapper/qwlextendedoutput_p.h6
-rw-r--r--src/compositor/wayland_wrapper/qwlextendedsurface.cpp27
-rw-r--r--src/compositor/wayland_wrapper/qwlextendedsurface_p.h4
-rw-r--r--src/compositor/wayland_wrapper/qwloutput.cpp31
-rw-r--r--src/compositor/wayland_wrapper/qwloutput_p.h2
-rw-r--r--src/extensions/output-extension.xml13
-rw-r--r--src/extensions/surface-extension.xml3
19 files changed, 132 insertions, 145 deletions
diff --git a/src/client/qwaylandextendedoutput.cpp b/src/client/qwaylandextendedoutput.cpp
index c79685af4..c34f5d317 100644
--- a/src/client/qwaylandextendedoutput.cpp
+++ b/src/client/qwaylandextendedoutput.cpp
@@ -52,49 +52,7 @@ QT_BEGIN_NAMESPACE
QWaylandExtendedOutput::QWaylandExtendedOutput(QWaylandScreen *screen, ::qt_extended_output *extended_output)
: QtWayland::qt_extended_output(extended_output)
, m_screen(screen)
- , m_orientation(m_screen->orientation())
{
}
-Qt::ScreenOrientation QWaylandExtendedOutput::currentOrientation() const
-{
- return m_orientation;
-}
-
-void QWaylandExtendedOutput::setOrientationUpdateMask(Qt::ScreenOrientations orientations)
-{
- int mask = 0;
- if (orientations & Qt::PortraitOrientation)
- mask |= QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION;
- if (orientations & Qt::LandscapeOrientation)
- mask |= QT_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION;
- if (orientations & Qt::InvertedPortraitOrientation)
- mask |= QT_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION;
- if (orientations & Qt::InvertedLandscapeOrientation)
- mask |= QT_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION;
- set_orientation_update_mask(mask);
-}
-
-void QWaylandExtendedOutput::extended_output_set_screen_rotation(int32_t rotation)
-{
- switch (rotation) {
- case QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION:
- m_orientation = Qt::PortraitOrientation;
- break;
- case QT_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION:
- m_orientation = Qt::LandscapeOrientation;
- break;
- case QT_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION:
- m_orientation = Qt::InvertedPortraitOrientation;
- break;
- case QT_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION:
- m_orientation = Qt::InvertedLandscapeOrientation;
- break;
- default:
- m_orientation = Qt::PortraitOrientation;
- break;
- }
- QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), m_orientation);
-}
-
QT_END_NAMESPACE
diff --git a/src/client/qwaylandextendedoutput_p.h b/src/client/qwaylandextendedoutput_p.h
index 4295412ec..71bd3fce2 100644
--- a/src/client/qwaylandextendedoutput_p.h
+++ b/src/client/qwaylandextendedoutput_p.h
@@ -56,14 +56,9 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedOutput : public QtWayland::qt_exte
public:
QWaylandExtendedOutput(QWaylandScreen *screen, struct ::qt_extended_output *extended_output);
- Qt::ScreenOrientation currentOrientation() const;
- void setOrientationUpdateMask(Qt::ScreenOrientations mask);
-
private:
- void extended_output_set_screen_rotation(int32_t rotation) Q_DECL_OVERRIDE;
QWaylandScreen *m_screen;
- Qt::ScreenOrientation m_orientation;
};
QT_END_NAMESPACE
diff --git a/src/client/qwaylandextendedsurface.cpp b/src/client/qwaylandextendedsurface.cpp
index fe2804162..3155ca6b0 100644
--- a/src/client/qwaylandextendedsurface.cpp
+++ b/src/client/qwaylandextendedsurface.cpp
@@ -94,6 +94,22 @@ void QWaylandExtendedSurface::setContentOrientation(Qt::ScreenOrientation orient
set_content_orientation(waylandRotationFromScreenOrientation(orientation));
}
+void QWaylandExtendedSurface::setContentOrientationMask(Qt::ScreenOrientations mask)
+{
+ int32_t wlmask = 0;
+ if (mask & Qt::PrimaryOrientation)
+ wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION;
+ if (mask & Qt::PortraitOrientation)
+ wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION;
+ if (mask & Qt::LandscapeOrientation)
+ wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION;
+ if (mask & Qt::InvertedPortraitOrientation)
+ wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION;
+ if (mask & Qt::InvertedLandscapeOrientation)
+ wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION;
+ set_content_orientation_mask(wlmask);
+}
+
QVariantMap QWaylandExtendedSurface::properties() const
{
return m_properties;
diff --git a/src/client/qwaylandextendedsurface_p.h b/src/client/qwaylandextendedsurface_p.h
index 00b961d38..030786472 100644
--- a/src/client/qwaylandextendedsurface_p.h
+++ b/src/client/qwaylandextendedsurface_p.h
@@ -62,6 +62,7 @@ public:
~QWaylandExtendedSurface();
void setContentOrientation(Qt::ScreenOrientation orientation);
+ void setContentOrientationMask(Qt::ScreenOrientations mask);
void updateGenericProperty(const QString &name, const QVariant &value);
diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp
index 416b320aa..cd709f8a8 100644
--- a/src/client/qwaylandscreen.cpp
+++ b/src/client/qwaylandscreen.cpp
@@ -44,8 +44,12 @@
#include "qwaylanddisplay_p.h"
#include "qwaylandcursor_p.h"
#include "qwaylandextendedoutput_p.h"
+#include "qwaylandwindow_p.h"
+
+#include <QtGui/QGuiApplication>
#include <qpa/qwindowsysteminterface.h>
+#include <qpa/qplatformwindow.h>
QT_BEGIN_NAMESPACE
@@ -57,6 +61,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id)
, mRefreshRate(60000)
, mFormat(QImage::Format_ARGB32_Premultiplied)
, mOutputName(QStringLiteral("Screen%1").arg(id))
+ , m_orientation(Qt::PrimaryOrientation)
, mWaylandCursor(new QWaylandCursor(this))
{
// handle case of output extension global being sent after outputs
@@ -99,15 +104,16 @@ QDpi QWaylandScreen::logicalDpi() const
void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask)
{
- if (mExtendedOutput)
- mExtendedOutput->setOrientationUpdateMask(mask);
+ foreach (QWindow *window, QGuiApplication::allWindows()) {
+ QWaylandWindow *w = static_cast<QWaylandWindow *>(window->handle());
+ if (w && w->screen() == this)
+ w->setOrientationMask(mask);
+ }
}
Qt::ScreenOrientation QWaylandScreen::orientation() const
{
- if (mExtendedOutput)
- return mExtendedOutput->currentOrientation();
- return QPlatformScreen::orientation();
+ return m_orientation;
}
qreal QWaylandScreen::refreshRate() const
@@ -166,7 +172,30 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y,
{
Q_UNUSED(subpixel);
Q_UNUSED(make);
- Q_UNUSED(transform);
+
+ bool isPortrait = screen() && screen()->primaryOrientation() == Qt::PortraitOrientation;
+ switch (transform) {
+ case WL_OUTPUT_TRANSFORM_NORMAL:
+ m_orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation;
+ break;
+ case WL_OUTPUT_TRANSFORM_90:
+ m_orientation = isPortrait ? Qt::InvertedLandscapeOrientation : Qt::PortraitOrientation;
+ break;
+ case WL_OUTPUT_TRANSFORM_180:
+ m_orientation = isPortrait ? Qt::InvertedPortraitOrientation : Qt::InvertedLandscapeOrientation;
+ break;
+ case WL_OUTPUT_TRANSFORM_270:
+ m_orientation = isPortrait ? Qt::LandscapeOrientation : Qt::InvertedPortraitOrientation;
+ break;
+ // Ignore these ones, at least for now
+ case WL_OUTPUT_TRANSFORM_FLIPPED:
+ case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+ case WL_OUTPUT_TRANSFORM_FLIPPED_180:
+ case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+ break;
+ }
+
+ QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation);
if (!model.isEmpty())
mOutputName = model;
diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h
index 42408acf4..5d06227a5 100644
--- a/src/client/qwaylandscreen_p.h
+++ b/src/client/qwaylandscreen_p.h
@@ -101,6 +101,7 @@ private:
QImage::Format mFormat;
QSize mPhysicalSize;
QString mOutputName;
+ Qt::ScreenOrientation m_orientation;
QWaylandCursor *mWaylandCursor;
};
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index d04e76b50..e7ff8f300 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -130,6 +130,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
mShellSurface->setTopLevel();
}
+ setOrientationMask(window->screen()->orientationUpdateMask());
setWindowFlags(window->flags());
setGeometry_helper(window->geometry());
setWindowStateInternal(window->windowState());
@@ -438,6 +439,12 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient
mExtendedWindow->setContentOrientation(orientation);
}
+void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask)
+{
+ if (mExtendedWindow)
+ mExtendedWindow->setContentOrientationMask(mask);
+}
+
void QWaylandWindow::setWindowState(Qt::WindowState state)
{
if (setWindowStateInternal(state))
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
index dbf76d11f..2ca47d590 100644
--- a/src/client/qwaylandwindow_p.h
+++ b/src/client/qwaylandwindow_p.h
@@ -128,8 +128,10 @@ public:
QWaylandShellSurface *shellSurface() const;
QWaylandExtendedSurface *extendedWindow() const;
QWaylandSubSurface *subSurfaceWindow() const;
+ QWaylandScreen *screen() const { return mScreen; }
void handleContentOrientationChange(Qt::ScreenOrientation orientation);
+ void setOrientationMask(Qt::ScreenOrientations mask);
void setWindowState(Qt::WindowState state);
void setWindowFlags(Qt::WindowFlags flags);
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index ba3dff61e..862393059 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -167,7 +167,9 @@ void QWaylandSurface::requestSize(const QSize &size)
Qt::ScreenOrientations QWaylandSurface::orientationUpdateMask() const
{
Q_D(const QWaylandSurface);
- return d->compositor()->orientationUpdateMaskForClient(static_cast<wl_client *>(client()));
+ if (!d->extendedSurface())
+ return Qt::PrimaryOrientation;
+ return d->extendedSurface()->contentOrientationMask();
}
Qt::ScreenOrientation QWaylandSurface::contentOrientation() const
diff --git a/src/compositor/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp
index e13fcfdb3..d89d653d3 100644
--- a/src/compositor/wayland_wrapper/qwlcompositor.cpp
+++ b/src/compositor/wayland_wrapper/qwlcompositor.cpp
@@ -330,26 +330,10 @@ QList<struct wl_client *> Compositor::clients() const
return list;
}
-Qt::ScreenOrientations Compositor::orientationUpdateMaskForClient(wl_client *client)
-{
- Output *output = m_output_global->outputForClient(client);
- Q_ASSERT(output);
- if (output->extendedOutput)
- return output->extendedOutput->orientationUpdateMask;
- return 0;
-}
-
void Compositor::setScreenOrientation(Qt::ScreenOrientation orientation)
{
m_orientation = orientation;
-
- QList<struct wl_client*> clientList = clients();
- for (int i = 0; i < clientList.length(); ++i) {
- struct wl_client *client = clientList.at(i);
- Output *output = m_output_global->outputForClient(client);
- if (output && output->extendedOutput)
- output->extendedOutput->sendOutputOrientation(orientation);
- }
+ m_output_global->sendOutputOrientation(orientation);
}
Qt::ScreenOrientation Compositor::screenOrientation() const
diff --git a/src/compositor/wayland_wrapper/qwlcompositor_p.h b/src/compositor/wayland_wrapper/qwlcompositor_p.h
index e1338255a..922c7f102 100644
--- a/src/compositor/wayland_wrapper/qwlcompositor_p.h
+++ b/src/compositor/wayland_wrapper/qwlcompositor_p.h
@@ -130,8 +130,6 @@ public:
void setOutputRefreshRate(int rate);
int outputRefreshRate() const;
- Qt::ScreenOrientations orientationUpdateMaskForClient(wl_client *client);
-
void setClientFullScreenHint(bool value);
QWaylandCompositor::ExtensionFlags extensions() const;
diff --git a/src/compositor/wayland_wrapper/qwlextendedoutput.cpp b/src/compositor/wayland_wrapper/qwlextendedoutput.cpp
index eb2de318a..3517a99d3 100644
--- a/src/compositor/wayland_wrapper/qwlextendedoutput.cpp
+++ b/src/compositor/wayland_wrapper/qwlextendedoutput.cpp
@@ -64,58 +64,6 @@ void OutputExtensionGlobal::output_extension_get_extended_output(qt_output_exten
Q_ASSERT(!output->extendedOutput);
output->extendedOutput = extendedOutput;
extendedOutput->output = output;
-
- extendedOutput->sendOutputOrientation(m_compositor->screenOrientation());
-}
-
-void OutputExtensionGlobal::extended_output_set_orientation_update_mask(qt_extended_output::Resource *resource,
- int32_t orientation_update_mask)
-{
- ExtendedOutput *output = static_cast<ExtendedOutput *>(resource);
-
- Qt::ScreenOrientations mask = 0;
- if (orientation_update_mask & QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION)
- mask |= Qt::PortraitOrientation;
- if (orientation_update_mask & QT_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION)
- mask |= Qt::LandscapeOrientation;
- if (orientation_update_mask & QT_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION)
- mask |= Qt::InvertedPortraitOrientation;
- if (orientation_update_mask & QT_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION)
- mask |= Qt::InvertedLandscapeOrientation;
-
- Qt::ScreenOrientations oldMask = output->orientationUpdateMask;
- output->orientationUpdateMask = mask;
-
- if (mask != oldMask) {
- QList<Surface*> surfaces = m_compositor->surfacesForClient(resource->client());
- foreach (Surface *surface, surfaces) {
- if (surface->waylandSurface())
- emit surface->waylandSurface()->orientationUpdateMaskChanged();
- }
- }
-}
-
-void ExtendedOutput::sendOutputOrientation(Qt::ScreenOrientation orientation)
-{
- int sendOperation;
- switch (orientation) {
- case Qt::PortraitOrientation:
- sendOperation = QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION;
- break;
- case Qt::LandscapeOrientation:
- sendOperation = QT_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION;
- break;
- case Qt::InvertedPortraitOrientation:
- sendOperation = QT_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION;
- break;
- case Qt::InvertedLandscapeOrientation:
- sendOperation = QT_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION;
- break;
- default:
- sendOperation = QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION;
- }
-
- extended_output_object->send_set_screen_rotation(handle, sendOperation);
}
}
diff --git a/src/compositor/wayland_wrapper/qwlextendedoutput_p.h b/src/compositor/wayland_wrapper/qwlextendedoutput_p.h
index f3625ed46..5f620cd86 100644
--- a/src/compositor/wayland_wrapper/qwlextendedoutput_p.h
+++ b/src/compositor/wayland_wrapper/qwlextendedoutput_p.h
@@ -61,10 +61,7 @@ class ExtendedOutput : public QtWaylandServer::qt_extended_output::Resource
public:
ExtendedOutput() : output(0) {}
- void sendOutputOrientation(Qt::ScreenOrientation orientation);
-
Output *output;
- Qt::ScreenOrientations orientationUpdateMask;
};
class OutputExtensionGlobal : public QtWaylandServer::qt_output_extension, public QtWaylandServer::qt_extended_output
@@ -77,9 +74,6 @@ private:
qt_extended_output::Resource *extended_output_allocate() Q_DECL_OVERRIDE { return new ExtendedOutput; }
- void extended_output_set_orientation_update_mask(qt_extended_output::Resource *resource,
- int32_t orientation_update_mask) Q_DECL_OVERRIDE;
-
void output_extension_get_extended_output(qt_output_extension::Resource *resource,
uint32_t id,
struct wl_resource *output_resource) Q_DECL_OVERRIDE;
diff --git a/src/compositor/wayland_wrapper/qwlextendedsurface.cpp b/src/compositor/wayland_wrapper/qwlextendedsurface.cpp
index 47bbafbf1..f8dea98d5 100644
--- a/src/compositor/wayland_wrapper/qwlextendedsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlextendedsurface.cpp
@@ -142,6 +142,11 @@ Qt::ScreenOrientation ExtendedSurface::contentOrientation() const
return m_contentOrientation;
}
+Qt::ScreenOrientations ExtendedSurface::contentOrientationMask() const
+{
+ return m_contentOrientationMask;
+}
+
void ExtendedSurface::extended_surface_set_content_orientation(Resource *resource, int32_t orientation)
{
Q_UNUSED(resource);
@@ -151,6 +156,28 @@ void ExtendedSurface::extended_surface_set_content_orientation(Resource *resourc
emit m_surface->waylandSurface()->contentOrientationChanged();
}
+void ExtendedSurface::extended_surface_set_content_orientation_mask(Resource *resource, int32_t orientation)
+{
+ Q_UNUSED(resource);
+ Qt::ScreenOrientations mask = 0;
+ if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION)
+ mask |= Qt::PortraitOrientation;
+ if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION)
+ mask |= Qt::LandscapeOrientation;
+ if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION)
+ mask |= Qt::InvertedPortraitOrientation;
+ if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION)
+ mask |= Qt::InvertedLandscapeOrientation;
+ if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION)
+ mask |= Qt::PrimaryOrientation;
+
+ Qt::ScreenOrientations oldMask = m_contentOrientationMask;
+ m_contentOrientationMask = mask;
+
+ if (mask != oldMask)
+ emit m_surface->waylandSurface()->orientationUpdateMaskChanged();
+}
+
QVariantMap ExtendedSurface::windowProperties() const
{
return m_windowProperties;
diff --git a/src/compositor/wayland_wrapper/qwlextendedsurface_p.h b/src/compositor/wayland_wrapper/qwlextendedsurface_p.h
index af1042687..333f6eeff 100644
--- a/src/compositor/wayland_wrapper/qwlextendedsurface_p.h
+++ b/src/compositor/wayland_wrapper/qwlextendedsurface_p.h
@@ -90,6 +90,7 @@ public:
QLinkedList<QWaylandSurface *> subSurfaces() const;
Qt::ScreenOrientation contentOrientation() const;
+ Qt::ScreenOrientations contentOrientationMask() const;
QWaylandSurface::WindowFlags windowFlags() const { return m_windowFlags; }
@@ -104,6 +105,7 @@ private:
Surface *m_surface;
Qt::ScreenOrientation m_contentOrientation;
+ Qt::ScreenOrientations m_contentOrientationMask;
QWaylandSurface::WindowFlags m_windowFlags;
QWindow::Visibility m_visibility;
@@ -117,6 +119,8 @@ private:
void extended_surface_set_content_orientation(Resource *resource,
int32_t orientation) Q_DECL_OVERRIDE;
+ void extended_surface_set_content_orientation_mask(Resource *resource,
+ int32_t orientation) Q_DECL_OVERRIDE;
void extended_surface_set_window_flags(Resource *resource,
int32_t flags) Q_DECL_OVERRIDE;
diff --git a/src/compositor/wayland_wrapper/qwloutput.cpp b/src/compositor/wayland_wrapper/qwloutput.cpp
index e5123e03b..b80452131 100644
--- a/src/compositor/wayland_wrapper/qwloutput.cpp
+++ b/src/compositor/wayland_wrapper/qwloutput.cpp
@@ -52,6 +52,7 @@ OutputGlobal::OutputGlobal(struct ::wl_display *display)
: QtWaylandServer::wl_output(display)
, m_displayId(-1)
, m_numQueued(0)
+ , m_transform(WL_OUTPUT_TRANSFORM_NORMAL)
{
QScreen *screen = QGuiApplication::primaryScreen();
m_geometry = QRect(QPoint(0, 0), screen->availableGeometry().size());
@@ -65,7 +66,7 @@ OutputGlobal::~OutputGlobal()
void OutputGlobal::output_bind_resource(Resource *resource)
{
wl_output_send_geometry(resource->handle, 0, 0,
- size().width(), size().height(), 0, "", "", 0);
+ size().width(), size().height(), 0, "", "", m_transform);
wl_output_send_mode(resource->handle, WL_OUTPUT_MODE_CURRENT|WL_OUTPUT_MODE_PREFERRED,
size().width(), size().height(), refreshRate());
@@ -81,6 +82,34 @@ void OutputGlobal::setRefreshRate(int rate)
m_refreshRate = rate;
}
+void OutputGlobal::sendOutputOrientation(Qt::ScreenOrientation orientation)
+{
+ QScreen *screen = QGuiApplication::primaryScreen();
+ bool isPortrait = screen->primaryOrientation() == Qt::PortraitOrientation;
+ switch (orientation) {
+ case Qt::PrimaryOrientation:
+ m_transform = WL_OUTPUT_TRANSFORM_NORMAL;
+ break;
+ case Qt::PortraitOrientation:
+ m_transform = isPortrait ? WL_OUTPUT_TRANSFORM_NORMAL : WL_OUTPUT_TRANSFORM_90;
+ break;
+ case Qt::LandscapeOrientation:
+ m_transform = isPortrait ? WL_OUTPUT_TRANSFORM_270 : WL_OUTPUT_TRANSFORM_NORMAL;
+ break;
+ case Qt::InvertedPortraitOrientation:
+ m_transform = isPortrait ? WL_OUTPUT_TRANSFORM_180 : WL_OUTPUT_TRANSFORM_270;
+ break;
+ case Qt::InvertedLandscapeOrientation:
+ m_transform = isPortrait ? WL_OUTPUT_TRANSFORM_90 : WL_OUTPUT_TRANSFORM_180;
+ break;
+ }
+
+ foreach (Resource *res, resourceMap()) {
+ wl_output_send_geometry(res->handle, 0, 0,
+ size().width(), size().height(), 0, "", "", m_transform);
+ }
+}
+
Output *OutputGlobal::outputForClient(wl_client *client) const
{
return static_cast<Output *>(resourceMap().value(client));
diff --git a/src/compositor/wayland_wrapper/qwloutput_p.h b/src/compositor/wayland_wrapper/qwloutput_p.h
index 738a73fc9..9184f87ce 100644
--- a/src/compositor/wayland_wrapper/qwloutput_p.h
+++ b/src/compositor/wayland_wrapper/qwloutput_p.h
@@ -73,6 +73,7 @@ public:
void setRefreshRate(int rate);
int refreshRate() const { return m_refreshRate; }
+ void sendOutputOrientation(Qt::ScreenOrientation orientation);
Output *outputForClient(struct wl_client *client) const;
@@ -84,6 +85,7 @@ private:
int m_refreshRate;
int m_displayId;
int m_numQueued;
+ wl_output_transform m_transform;
};
#if 0
diff --git a/src/extensions/output-extension.xml b/src/extensions/output-extension.xml
index 07aa1102c..0a7f11a90 100644
--- a/src/extensions/output-extension.xml
+++ b/src/extensions/output-extension.xml
@@ -46,19 +46,6 @@
</interface>
<interface name="qt_extended_output" version="1">
- <enum name="rotation">
- <entry name="PortraitOrientation" value="1"/>
- <entry name="LandscapeOrientation" value="2"/>
- <entry name="InvertedPortraitOrientation" value="4"/>
- <entry name="InvertedLandscapeOrientation" value="8"/>
- </enum>
- <event name="set_screen_rotation">
- <arg name="rotation" type="int"/>
- </event>
-
- <request name="set_orientation_update_mask">
- <arg name="orientation" type="int"/>
- </request>
</interface>
</protocol>
diff --git a/src/extensions/surface-extension.xml b/src/extensions/surface-extension.xml
index 31f286200..d43b8d8b2 100644
--- a/src/extensions/surface-extension.xml
+++ b/src/extensions/surface-extension.xml
@@ -74,6 +74,9 @@
<request name="set_content_orientation">
<arg name="orientation" type="int"/>
</request>
+ <request name="set_content_orientation_mask">
+ <arg name="orientation" type="int"/>
+ </request>
<enum name="windowflag">
<entry name="OverridesSystemGestures" value="1"/>