addClientResource(client, &surface->base()->resource, id, &wl_surface_interface,
&surface_interface, destroy_surface);
- WaylandManagedClient *managedClient = m_windowManagerWaylandProtocol->managedClient(client);
- if (managedClient) {
- // 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());
QList<struct wl_client *> prevClientList = clients();
fprintf(stderr, "wl_event_loop_dispatch error: %d\n", ret);
}
+
void Compositor::surfaceDestroyed(Surface *surface)
{
m_surfaces.removeOne(surface);
{
return &m_input;
}
+
+QList<Wayland::Surface *> Wayland::Compositor::surfacesForClient(wl_client *client)
+{
+ QList<Wayland::Surface *> ret;
+
+ for (int i=0; i < m_surfaces.count(); ++i) {
+ if (m_surfaces.at(i)->clientHandle() == client) {
+ ret.append(m_surfaces.at(i));
+ }
+ }
+ return ret;
+}
+
bool setDirectRenderSurface(Surface *surface);
Surface *directRenderSurface() const {return m_directRenderSurface;}
+ QList<Surface*> surfacesForClient(wl_client* client);
+
wl_input_device *defaultInputDevice();
WaylandCompositor *qtCompositor() const { return m_qt_compositor; }
QByteArray Surface::authenticationToken() const
{
Q_D(const Surface);
- return d->authenticationToken;
-}
-
-void Surface::setAuthenticationToken(const QByteArray &authenticationToken)
-{
- Q_D(Surface);
- d->authenticationToken = authenticationToken;
+ return WindowManagerServerIntegration::instance()->managedClient(d->client)->authenticationToken();
}
uint32_t toWaylandButton(Qt::MouseButton button)
qint64 processId() const;
void setProcessId(qint64 processId);
QByteArray authenticationToken() const;
- void setAuthenticationToken(const QByteArray &authenticationToken);
void setSurfaceCreationFinished(bool isCreated);
void mapClientToProcess(wl_client *client, uint32_t processId)
{
+ //qDebug() << "COMPOSITOR:" << Q_FUNC_INFO << client << processId;
WindowManagerServerIntegration::instance()->mapClientToProcess(client, processId);
}
void authenticateWithToken(wl_client *client, const char *authenticationToken)
{
+ //qDebug() << "COMPOSITOR:" << Q_FUNC_INFO << client << authenticationToken;
WindowManagerServerIntegration::instance()->authenticateWithToken(client, authenticationToken);
}
void WindowManagerServerIntegration::authenticateWithToken(wl_client *client, const char *token)
{
+ Q_ASSERT(token != 0 && *token != 0);
+
WaylandManagedClient *managedClient = m_managedClients.value(client, new WaylandManagedClient);
managedClient->m_authenticationToken = QByteArray(token);
m_managedClients.insert(client, managedClient);
+
+ emit clientAuthenticated(client);
}
void WindowManagerServerIntegration::changeScreenVisibility(wl_client *client, int visible)
#include <qwindowdefs.h>
#include <stdint.h>
-#include "wayland_wrapper/wldisplay.h"
#include <QObject>
#include <QMap>
struct wl_client;
+namespace Wayland {
+ class Display;
+}
+
class WindowManagerObject;
class WaylandManagedClient;
void setScreenOrientation(wl_client *client, qint32 orientationInDegrees);
void updateOrientation(wl_client *client);
+
+signals:
+ void clientAuthenticated(wl_client *client);
+
private:
void mapClientToProcess(wl_client *client, uint32_t processId);
void authenticateWithToken(wl_client *client, const char *token);