Used to find out whether the client wants orientation updates.
Change-Id: Ibefc98df7b346cbfe13cb021c932dab3d6c5d758
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
<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>
d->surface->setSize(size);
}
+Qt::ScreenOrientations WaylandSurface::orientationUpdateMask() const
+{
+ Q_D(const WaylandSurface);
+ return d->surface->compositor()->orientationUpdateMaskForClient(static_cast<wl_client *>(client()));
+}
+
Qt::ScreenOrientation WaylandSurface::contentOrientation() const
{
Q_D(const WaylandSurface);
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation NOTIFY contentOrientationChanged)
Q_PROPERTY(int windowRotation READ windowRotation NOTIFY windowRotationChanged)
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
+ Q_PROPERTY(Qt::ScreenOrientations orientationUpdateMask READ orientationUpdateMask NOTIFY orientationUpdateMaskChanged)
Q_ENUMS(WindowFlag)
Q_FLAGS(WindowFlag WindowFlags)
QSize size() const;
void setSize(const QSize &size);
+ Qt::ScreenOrientations orientationUpdateMask() const;
Qt::ScreenOrientation contentOrientation() const;
Qt::ScreenOrientation windowOrientation() const;
int windowRotation() const;
void windowOrientationChanged();
void contentOrientationChanged();
void windowRotationChanged();
+ void orientationUpdateMaskChanged();
void extendedSurfaceReady();
void titleChanged();
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;
void setOutputRefreshRate(int rate);
int outputRefreshRate() const;
+ Qt::ScreenOrientations orientationUpdateMaskForClient(wl_client *client);
+
void setClientFullScreenHint(bool value);
TouchExtensionGlobal *touchExtension() { return m_touchExtension; }
#include "wlextendedoutput.h"
#include "wlcompositor.h"
+#include "wlsurface.h"
#include "wloutput.h"
namespace Wayland {
: m_output(output)
, m_compositor(compositor)
{
+ static const struct wl_extended_output_interface extended_output_interface = {
+ set_orientation_update_mask
+ };
Q_ASSERT(m_output->extendedOutput() == 0);
m_output->setExtendedOutput(this);
- m_extended_output_resource = wl_client_add_object(client,&wl_extended_output_interface,0,id,this);
+ m_extended_output_resource = wl_client_add_object(client,&wl_extended_output_interface,&extended_output_interface,id,this);
m_extended_output_resource->destroy = ExtendedOutput::destroy_resource;
sendOutputOrientation(m_compositor->screenOrientation());
free(resource);
}
+void ExtendedOutput::set_orientation_update_mask(struct wl_client *client,
+ struct wl_resource *resource,
+ int32_t orientation_update_mask)
+{
+ ExtendedOutput *output = static_cast<ExtendedOutput *>(resource->data);
+
+ Qt::ScreenOrientations mask = 0;
+ if (orientation_update_mask & WL_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION)
+ mask |= Qt::PortraitOrientation;
+ if (orientation_update_mask & WL_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION)
+ mask |= Qt::LandscapeOrientation;
+ if (orientation_update_mask & WL_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION)
+ mask |= Qt::InvertedPortraitOrientation;
+ if (orientation_update_mask & WL_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION)
+ mask |= Qt::InvertedLandscapeOrientation;
+
+ Qt::ScreenOrientations oldMask = output->m_orientationUpdateMask;
+ output->m_orientationUpdateMask = mask;
+
+ if (mask != oldMask) {
+ QList<Surface*> surfaces = output->m_compositor->surfacesForClient(client);
+ foreach (Surface *surface, surfaces) {
+ if (surface->waylandSurface())
+ emit surface->waylandSurface()->orientationUpdateMaskChanged();
+ }
+ }
+}
+
void ExtendedOutput::sendOutputOrientation(Qt::ScreenOrientation orientation)
{
int sendOpperation;
public:
ExtendedOutput(struct wl_client *client, uint32_t id, Output *output, Compositor *compositor);
+ Qt::ScreenOrientations orientationUpdateMask() { return m_orientationUpdateMask; }
+
void sendOutputOrientation(Qt::ScreenOrientation orientation);
static void destroy_resource(wl_resource *resource);
+ static void set_orientation_update_mask(struct wl_client *client,
+ struct wl_resource *resource,
+ int32_t orientation_update_mask);
+
private:
struct wl_resource *m_extended_output_resource;
Output *m_output;
Compositor *m_compositor;
+ Qt::ScreenOrientations m_orientationUpdateMask;
};
}
return m_orientation;
}
+void QWaylandExtendedOutput::setOrientationUpdateMask(Qt::ScreenOrientations orientations)
+{
+ int mask = 0;
+ if (orientations & Qt::PortraitOrientation)
+ mask |= WL_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION;
+ if (orientations & Qt::LandscapeOrientation)
+ mask |= WL_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION;
+ if (orientations & Qt::InvertedPortraitOrientation)
+ mask |= WL_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION;
+ if (orientations & Qt::InvertedLandscapeOrientation)
+ mask |= WL_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION;
+ wl_extended_output_set_orientation_update_mask(m_extended_output, mask);
+}
+
void QWaylandExtendedOutput::set_screen_rotation(void *data, wl_extended_output *wl_extended_output, int32_t rotation)
{
Q_UNUSED(wl_extended_output);
QWaylandExtendedOutput(QWaylandScreen *screen, struct wl_extended_output *extended_output);
Qt::ScreenOrientation currentOrientation() const;
+ void setOrientationUpdateMask(Qt::ScreenOrientations mask);
+
private:
struct wl_extended_output *m_extended_output;
QWaylandScreen *m_screen;
return mFormat;
}
+void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask)
+{
+ if (mExtendedOutput)
+ mExtendedOutput->setOrientationUpdateMask(mask);
+}
+
Qt::ScreenOrientation QWaylandScreen::orientation() const
{
if (mExtendedOutput)
int depth() const;
QImage::Format format() const;
+ void setOrientationUpdateMask(Qt::ScreenOrientations mask);
+
Qt::ScreenOrientation orientation() const;
qreal refreshRate() const;