1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the plugins of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
42 #ifndef QWAYLANDDISPLAY_H
43 #define QWAYLANDDISPLAY_H
45 #include <QtCore/QObject>
46 #include <QtCore/QRect>
48 #include <QtCore/QWaitCondition>
50 #include <wayland-client.h>
52 class QWaylandInputDevice;
53 class QSocketNotifier;
55 class QPlatformScreen;
57 class QWaylandGLIntegration;
58 class QWaylandDisplay : public QObject {
62 QWaylandDisplay(void);
63 ~QWaylandDisplay(void);
65 QList<QPlatformScreen *> screens() const { return mScreens; }
66 struct wl_surface *createSurface(void *handle);
67 struct wl_buffer *createShmBuffer(int fd, int width, int height,
69 struct wl_visual *visual);
70 struct wl_visual *rgbVisual();
71 struct wl_visual *argbVisual();
72 struct wl_visual *argbPremultipliedVisual();
74 #ifdef QT_WAYLAND_GL_SUPPORT
75 QWaylandGLIntegration *eglIntegration();
77 void setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y);
79 void syncCallback(wl_display_sync_func_t func, void *data);
80 void frameCallback(wl_display_frame_func_t func, void *data);
82 struct wl_display *wl_display() const { return mDisplay; }
84 QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
87 void createNewScreen(struct wl_output *output, QRect geometry);
92 void waitForScreens();
93 void displayHandleGlobal(uint32_t id,
94 const QByteArray &interface,
97 struct wl_display *mDisplay;
98 struct wl_compositor *mCompositor;
100 struct wl_shell *mShell;
101 QList<QPlatformScreen *> mScreens;
102 QList<QWaylandInputDevice *> mInputDevices;
104 QSocketNotifier *mReadNotifier;
106 bool mScreensInitialized;
108 uint32_t mSocketMask;
110 static const struct wl_output_listener outputListener;
111 static int sourceUpdate(uint32_t mask, void *data);
112 static void displayHandleGlobal(struct wl_display *display,
114 const char *interface,
115 uint32_t version, void *data);
116 static void outputHandleGeometry(void *data,
117 struct wl_output *output,
118 int32_t x, int32_t y,
119 int32_t width, int32_t height);
121 #ifdef QT_WAYLAND_GL_SUPPORT
122 QWaylandGLIntegration *mEglIntegration;
125 static void shellHandleConfigure(void *data, struct wl_shell *shell,
126 uint32_t time, uint32_t edges,
127 struct wl_surface *surface,
128 int32_t width, int32_t height);
130 static const struct wl_shell_listener shellListener;
133 #endif // QWAYLANDDISPLAY_H