Use wl_surface.set_buffer_transform to signal surface rotation
Drop the custom request in the surface extension, and use the wayland core mechanism. Change-Id: I580f56c90bcd3b2c5a6da08d1a033b10790ac330 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This commit is contained in:
parent
755eefab6a
commit
1cb65e556c
@ -71,9 +71,6 @@
|
||||
<entry name="InvertedLandscapeOrientation" value="8"/>
|
||||
</enum>
|
||||
|
||||
<request name="set_content_orientation">
|
||||
<arg name="orientation" type="int"/>
|
||||
</request>
|
||||
<request name="set_content_orientation_mask">
|
||||
<arg name="orientation" type="int"/>
|
||||
</request>
|
||||
|
@ -78,22 +78,6 @@ void QWaylandExtendedSurface::updateGenericProperty(const QString &name, const Q
|
||||
nativeInterface->emitWindowPropertyChanged(m_window, name);
|
||||
}
|
||||
|
||||
static int32_t waylandRotationFromScreenOrientation(Qt::ScreenOrientation orientation)
|
||||
{
|
||||
switch (orientation) {
|
||||
case Qt::PortraitOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION;
|
||||
case Qt::InvertedPortraitOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION;
|
||||
case Qt::LandscapeOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION;
|
||||
case Qt::InvertedLandscapeOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION;
|
||||
default: return QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION;
|
||||
}
|
||||
}
|
||||
|
||||
void QWaylandExtendedSurface::setContentOrientation(Qt::ScreenOrientation orientation)
|
||||
{
|
||||
set_content_orientation(waylandRotationFromScreenOrientation(orientation));
|
||||
}
|
||||
|
||||
void QWaylandExtendedSurface::setContentOrientationMask(Qt::ScreenOrientations mask)
|
||||
{
|
||||
int32_t wlmask = 0;
|
||||
|
@ -61,7 +61,6 @@ public:
|
||||
QWaylandExtendedSurface(QWaylandWindow *window, struct ::qt_extended_surface *extended_surface);
|
||||
~QWaylandExtendedSurface();
|
||||
|
||||
void setContentOrientation(Qt::ScreenOrientation orientation);
|
||||
void setContentOrientationMask(Qt::ScreenOrientations mask);
|
||||
|
||||
void updateGenericProperty(const QString &name, const QVariant &value);
|
||||
|
@ -435,8 +435,28 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const
|
||||
|
||||
void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
|
||||
{
|
||||
if (mExtendedWindow)
|
||||
mExtendedWindow->setContentOrientation(orientation);
|
||||
wl_output_transform transform;
|
||||
bool isPortrait = window()->screen() && window()->screen()->primaryOrientation() == Qt::PortraitOrientation;
|
||||
switch (orientation) {
|
||||
case Qt::PrimaryOrientation:
|
||||
transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
break;
|
||||
case Qt::LandscapeOrientation:
|
||||
transform = isPortrait ? WL_OUTPUT_TRANSFORM_270 : WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
break;
|
||||
case Qt::PortraitOrientation:
|
||||
transform = isPortrait ? WL_OUTPUT_TRANSFORM_NORMAL : WL_OUTPUT_TRANSFORM_90;
|
||||
break;
|
||||
case Qt::InvertedLandscapeOrientation:
|
||||
transform = isPortrait ? WL_OUTPUT_TRANSFORM_90 : WL_OUTPUT_TRANSFORM_180;
|
||||
break;
|
||||
case Qt::InvertedPortraitOrientation:
|
||||
transform = isPortrait ? WL_OUTPUT_TRANSFORM_180 : WL_OUTPUT_TRANSFORM_270;
|
||||
break;
|
||||
}
|
||||
set_buffer_transform(transform);
|
||||
// set_buffer_transform is double buffered, we need to commit.
|
||||
commit();
|
||||
}
|
||||
|
||||
void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask)
|
||||
|
Loading…
x
Reference in New Issue
Block a user