return 0;
return m_socket_name.constData();
}
+
+void WaylandCompositor::setScreenOrientation(qint32 orientationInDegrees)
+{
+ m_compositor->setScreenOrientation(orientationInDegrees);
+}
const char *socketName() const;
+ void setScreenOrientation(qint32 orientationInDegrees);
+
private:
static void retainedSelectionChanged(QMimeData *mimeData, void *param);
// if there is no PID, the client does not support the protocol.
surface->setProcessId(managedClient->processId());
surface->setAuthenticationToken(managedClient->authenticationToken());
+ m_windowManagerWaylandProtocol->updateOrientation(client);
}
m_qt_compositor->surfaceCreated(surface->handle());
return list;
}
+void Compositor::setScreenOrientation(qint32 orientationInDegrees)
+{
+ QList<struct wl_client*> clientList = clients();
+ for (int i = 0; i < clientList.length(); ++i) {
+ struct wl_client *client = clientList.at(i);
+ m_windowManagerWaylandProtocol->setScreenOrientation(client, orientationInDegrees);
+ }
}
+} // namespace Wayland
+
wl_input_device * Wayland::Compositor::defaultInputDevice()
{
return &m_input;
QList<struct wl_client *> clients() const;
+ void setScreenOrientation(qint32 orientationInDegrees);
+
signals:
void clientAdded(wl_client *client);
d->compositor->setInputFocus(this);
}
-}
-
-void Wayland::Surface::sendOnScreenVisibilityChange(bool visible)
+void Surface::sendOnScreenVisibilityChange(bool visible)
{
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
Q_D(Surface);
WindowManagerServerIntegration::instance()->changeScreenVisibility(d->client, visible ? 1 : 0);
#endif
}
+
+} // namespace Wayland
+
static const struct wl_message wl_windowmanager_events[] = {
{ "client_onscreen_visibility", "i", NULL },
+ { "set_screen_rotation", "i", NULL },
};
WL_EXPORT const struct wl_interface wl_windowmanager_interface = {
};
#define WL_WINDOWMANAGER_CLIENT_ONSCREEN_VISIBILITY 0
+#define WL_WINDOWMANAGER_SET_SCREEN_ROTATION 1
#ifdef __cplusplus
}
WindowManagerServerIntegration::WindowManagerServerIntegration(QObject *parent)
: QObject(parent)
+ , m_orientationInDegrees(0)
{
m_instance = this;
}
WL_WINDOWMANAGER_CLIENT_ONSCREEN_VISIBILITY, visible);
}
+void WindowManagerServerIntegration::updateOrientation(wl_client *client)
+{
+ setScreenOrientation(client, m_orientationInDegrees);
+}
+
+void WindowManagerServerIntegration::setScreenOrientation(wl_client *client, qint32 orientationInDegrees)
+{
+ m_orientationInDegrees = orientationInDegrees;
+ wl_client_post_event(client, m_windowManagerObject->base(),
+ WL_WINDOWMANAGER_SET_SCREEN_ROTATION, orientationInDegrees);
+}
WaylandManagedClient *WindowManagerServerIntegration::managedClient(wl_client *client) const
{
WaylandManagedClient::WaylandManagedClient()
: m_processId(0)
{
-
}
qint64 WaylandManagedClient::processId() const
WaylandManagedClient *managedClient(wl_client *client) const;
void changeScreenVisibility(wl_client *client, int visible);
+ void setScreenOrientation(wl_client *client, qint32 orientationInDegrees);
+ void updateOrientation(wl_client *client);
+
private:
void mapClientToProcess(wl_client *client, uint32_t processId);
void authenticateWithToken(wl_client *client, const char *token);
static WindowManagerServerIntegration *m_instance;
WindowManagerObject *m_windowManagerObject;
+ qint32 m_orientationInDegrees;
friend class WindowManagerObject;
};
qint64 processId() const;
QByteArray authenticationToken() const;
bool isVisibleOnScreen() const { return m_isVisibleOnScreen; }
+ qint32 orientation() const;
private:
qint64 m_processId;
<event name="client_onscreen_visibility">
<arg name="visible" type="int"/>
</event>
+
+ <!-- Sets screen rotation, typically based on accelerometer/orientation sensor reading data -->
+ <event name="set_screen_rotation">
+ <arg name="rotation" type="int"/>
+ </event>
</interface>
</protocol>