wl_client_add_object(client,&wl_shell_interface,&shell_interface,id,data);
}
-void Shell::shell_move(struct wl_client *client,
- struct wl_resource *shell,
- struct wl_resource *surface,
+void Shell::get_shell_surface(struct wl_client *client,
+ struct wl_resource *shell_resource,
+ uint32_t id,
+ struct wl_resource *surface)
+{
+ Q_UNUSED(surface);
+ wl_client_add_object(client,&wl_shell_surface_interface,&shell_surface_interface,id,shell_resource->data);
+}
+
+const struct wl_shell_interface Shell::shell_interface = {
+ Shell::get_shell_surface
+};
+
+void Shell::shell_surface_move(struct wl_client *client,
+ struct wl_resource *shell_surface_resource,
struct wl_resource *input_device,
uint32_t time)
{
Q_UNUSED(client);
- Q_UNUSED(shell);
- Q_UNUSED(surface);
+ Q_UNUSED(shell_surface_resource);
Q_UNUSED(input_device);
Q_UNUSED(time);
- qDebug() << "shellMove";
}
-void Shell::shell_resize(struct wl_client *client,
- struct wl_resource *shell,
- struct wl_resource *surface,
+void Shell::shell_surface_resize(struct wl_client *client,
+ struct wl_resource *shell_surface_resource,
struct wl_resource *input_device,
uint32_t time,
uint32_t edges)
{
Q_UNUSED(client);
- Q_UNUSED(shell);
- Q_UNUSED(surface);
+ Q_UNUSED(shell_surface_resource);
Q_UNUSED(input_device);
Q_UNUSED(time);
Q_UNUSED(edges);
- qDebug() << "shellResize";
}
-void Shell::set_toplevel(struct wl_client *client,
- struct wl_resource *wl_shell,
- struct wl_resource *surface)
+void Shell::shell_surface_set_toplevel(struct wl_client *client,
+ struct wl_resource *shell_surface_resource)
{
Q_UNUSED(client);
- Q_UNUSED(wl_shell);
- Q_UNUSED(surface);
+ Q_UNUSED(shell_surface_resource);
}
-void Shell::set_transient(struct wl_client *client,
- struct wl_resource *wl_shell,
- struct wl_resource *surface,
+void Shell::shell_surface_set_transient(struct wl_client *client,
+ struct wl_resource *shell_surface_resource,
struct wl_resource *parent,
int x,
int y,
uint32_t flags)
{
+
Q_UNUSED(client);
- Q_UNUSED(wl_shell);
- Q_UNUSED(surface);
+ Q_UNUSED(shell_surface_resource);
Q_UNUSED(parent);
Q_UNUSED(x);
Q_UNUSED(y);
Q_UNUSED(flags);
}
-void Shell::set_fullscreen(struct wl_client *client,
- struct wl_resource *wl_shell,
- struct wl_resource *surface)
+
+void Shell::shell_surface_set_fullscreen(struct wl_client *client,
+ struct wl_resource *shell_surface_resource)
{
Q_UNUSED(client);
- Q_UNUSED(wl_shell);
- Q_UNUSED(surface);
+ Q_UNUSED(shell_surface_resource);
}
-const struct wl_shell_interface Shell::shell_interface = {
- shell_move,
- shell_resize,
- set_toplevel,
- set_transient,
- set_fullscreen
+const struct wl_shell_surface_interface Shell::shell_surface_interface = {
+ Shell::shell_surface_move,
+ Shell::shell_surface_resize,
+ Shell::shell_surface_set_toplevel,
+ Shell::shell_surface_set_transient,
+ Shell::shell_surface_set_fullscreen
};
}
Shell(Compositor *compositor);
static void bind_func(struct wl_client *client, void *data,
- uint32_t version, uint32_t id);
- static void shell_move(struct wl_client *client,
- struct wl_resource *shell,
- struct wl_resource *surface,
+ uint32_t version, uint32_t id);
+private:
+ static void get_shell_surface(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id,
+ struct wl_resource *surface);
+ static const struct wl_shell_interface shell_interface;
+
+ static void shell_surface_move(struct wl_client *client,
+ struct wl_resource *shell_surface_resource,
struct wl_resource *input_device,
uint32_t time);
- static void shell_resize(struct wl_client *client,
- struct wl_resource *shell,
- struct wl_resource *surface,
+ static void shell_surface_resize(struct wl_client *client,
+ struct wl_resource *shell_surface_resource,
struct wl_resource *input_device,
uint32_t time,
uint32_t edges);
- static void set_toplevel(struct wl_client *client,
- struct wl_resource *shell,
- struct wl_resource *surface);
- static void set_transient(struct wl_client *client,
- struct wl_resource *shell,
- struct wl_resource *surface,
+ static void shell_surface_set_toplevel(struct wl_client *client,
+ struct wl_resource *shell_surface_resource);
+ static void shell_surface_set_transient(struct wl_client *client,
+ struct wl_resource *shell_surface_resource,
struct wl_resource *parent,
int x,
int y,
uint32_t flags);
- static void set_fullscreen(struct wl_client *client,
- struct wl_resource *shell,
- struct wl_resource *surface);
- const static struct wl_shell_interface shell_interface;
+ static void shell_surface_set_fullscreen(struct wl_client *client,
+ struct wl_resource *shell_surface_resource);
+
+ static const struct wl_shell_surface_interface shell_surface_interface;
+
};
}
#include "qwaylandinputdevice.h"
#include "qwaylandclipboard.h"
#include "qwaylanddatadevicemanager.h"
+#include "qwaylandshell.h"
#ifdef QT_WAYLAND_GL_SUPPORT
#include "gl_integration/qwaylandglintegration.h"
mLastKeyboardFocusInputDevice = device;
}
-void QWaylandDisplay::shellHandleConfigure(void *data, struct wl_shell *shell,
- uint32_t time, uint32_t edges,
- struct wl_surface *surface,
- int32_t width, int32_t height)
-{
- Q_UNUSED(data);
- Q_UNUSED(shell);
- Q_UNUSED(time);
- Q_UNUSED(edges);
- QWaylandWindow *ww = (QWaylandWindow *) wl_surface_get_user_data(surface);
-
- ww->configure(time, edges, 0, 0, width, height);
-}
-
-const struct wl_shell_listener QWaylandDisplay::shellListener = {
- QWaylandDisplay::shellHandleConfigure,
-};
-
static QWaylandDisplay *display = 0;
QWaylandDisplay::QWaylandDisplay(void)
} else if (interface == "wl_shm") {
mShm = static_cast<struct wl_shm *>(wl_display_bind(mDisplay, id, &wl_shm_interface));
} else if (interface == "wl_shell"){
- mShell = static_cast<struct wl_shell *>(wl_display_bind(mDisplay, id, &wl_shell_interface));
- wl_shell_add_listener(mShell, &shellListener, this);
+ mShell = new QWaylandShell(this,id,version);
} else if (interface == "wl_input_device") {
QWaylandInputDevice *inputDevice =
new QWaylandInputDevice(this, id);
class QWaylandGLIntegration;
class QWaylandWindowManagerIntegration;
class QWaylandDataDeviceManager;
+class QWaylandShell;
class QWaylandDisplay : public QObject {
Q_OBJECT
void setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y);
struct wl_display *wl_display() const { return mDisplay; }
- struct wl_shell *wl_shell() const { return mShell; }
+
+ QWaylandShell *shell() const { return mShell; }
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler; }
- struct wl_shell *shell() const {return mShell; }
struct wl_shm *shm() const { return mShm; }
static uint32_t currentTimeMillisec();
struct wl_display *mDisplay;
struct wl_compositor *mCompositor;
struct wl_shm *mShm;
- struct wl_shell *mShell;
+ QWaylandShell *mShell;
QList<QPlatformScreen *> mScreens;
QList<QWaylandInputDevice *> mInputDevices;
QWaylandInputDevice *mLastKeyboardFocusInputDevice;
static void force_roundtrip_sync_callback(void *data, struct wl_callback *wl_callback, uint32_t time);
static const struct wl_callback_listener force_roundtrip_sync_callback_listener;
-
- static const struct wl_shell_listener shellListener;
};
#endif // QWAYLANDDISPLAY_H
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwaylandshell.h"
+
+#include "qwaylandshellsurface.h"
+#include "qwaylandwindow.h"
+
+QWaylandShell::QWaylandShell(QWaylandDisplay *display, uint32_t id, uint32_t version)
+ : m_display(display)
+{
+ Q_UNUSED(version)
+ m_shell = static_cast<struct wl_shell *>(wl_display_bind(m_display->wl_display(), id, &wl_shell_interface));
+}
+
+QWaylandShellSurface *QWaylandShell::createShellSurface(QWaylandWindow *window)
+{
+ Q_ASSERT(window->wl_surface());
+ struct wl_shell_surface *shell_surface = wl_shell_get_shell_surface(m_shell,window->wl_surface());
+ return new QWaylandShellSurface(shell_surface,window);
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWAYLANDSHELL_H
+#define QWAYLANDSHELL_H
+
+#include "qwaylanddisplay.h"
+
+class QWaylandWindow;
+class QWaylandShellSurface;
+
+class QWaylandShell
+{
+public:
+ QWaylandShell(QWaylandDisplay *display, uint32_t id, uint32_t version);
+
+ QWaylandShellSurface *createShellSurface(QWaylandWindow *window);
+
+private:
+ struct wl_shell *m_shell;
+
+ QWaylandDisplay *m_display;
+};
+
+#endif // QWAYLANDSHELL_H
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwaylandshellsurface.h"
+
+#include "qwaylanddisplay.h"
+#include "qwaylandwindow.h"
+
+QWaylandShellSurface::QWaylandShellSurface(struct wl_shell_surface *shell_surface, QWaylandWindow *window)
+ : m_shell_surface(shell_surface)
+ , m_window(window)
+{
+ wl_shell_surface_add_listener(m_shell_surface,&m_shell_surface_listener,this);
+}
+
+
+void QWaylandShellSurface::configure(void *data,
+ wl_shell_surface *wl_shell_surface,
+ uint32_t time,
+ uint32_t edges,
+ int32_t width,
+ int32_t height)
+{
+ Q_UNUSED(wl_shell_surface);
+ QWaylandShellSurface *shell_surface = static_cast<QWaylandShellSurface *>(data);
+ shell_surface->m_window->configure(time,edges,0,0,width,height);
+}
+
+const wl_shell_surface_listener QWaylandShellSurface::m_shell_surface_listener = {
+ QWaylandShellSurface::configure
+};
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWAYLANDSHELLSURFACE_H
+#define QWAYLANDSHELLSURFACE_H
+
+#include <inttypes.h>
+
+class QWaylandWindow;
+
+class QWaylandShellSurface
+{
+public:
+ QWaylandShellSurface(struct wl_shell_surface *shell_surface, QWaylandWindow *window);
+
+ struct wl_shell_surface *handle() const { return m_shell_surface; }
+private:
+ struct wl_shell_surface *m_shell_surface;
+ QWaylandWindow *m_window;
+
+ static void configure(void *data,
+ struct wl_shell_surface *wl_shell_surface,
+ uint32_t time,
+ uint32_t edges,
+ int32_t width,
+ int32_t height);
+ static const struct wl_shell_surface_listener m_shell_surface_listener;
+};
+
+#endif // QWAYLANDSHELLSURFACE_H
#include "qwaylanddisplay.h"
#include "qwaylandinputdevice.h"
#include "qwaylandscreen.h"
+#include "qwaylandshell.h"
+#include "qwaylandshellsurface.h"
#include <QtGui/QWindow>
QWaylandWindow::QWaylandWindow(QWindow *window)
: QPlatformWindow(window)
, mSurface(0)
+ , mShellSurface(0)
, mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display())
, mBuffer(0)
, mWaitingForFrameSync(false)
QWaylandWindow::~QWaylandWindow()
{
- if (mSurface)
+ if (mSurface) {
+ delete mShellSurface;
wl_surface_destroy(mSurface);
+ }
QList<QWaylandInputDevice *> inputDevices = mDisplay->inputDevices();
for (int i = 0; i < inputDevices.size(); ++i)
{
if (!mSurface && visible) {
mSurface = mDisplay->createSurface(this);
+ mShellSurface = mDisplay->shell()->createShellSurface(this);
newSurfaceCreated();
- wl_shell_set_toplevel(mDisplay->shell(),mSurface);
+ wl_shell_surface_set_toplevel(mShellSurface->handle());
}
if (!visible) {
class QWaylandDisplay;
class QWaylandBuffer;
+class QWaylandShellSurface;
struct wl_egl_window;
class QWaylandWindow : public QPlatformWindow
struct wl_surface *wl_surface() const { return mSurface; }
+ QWaylandShellSurface *shellSurface() const;
protected:
struct wl_surface *mSurface;
+ QWaylandShellSurface *mShellSurface;
virtual void newSurfaceCreated();
QWaylandDisplay *mDisplay;
QWaylandBuffer *mBuffer;
static const wl_callback_listener callbackListener;
static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time);
-
};
qwaylanddnd.cpp \
qwaylanddataoffer.cpp \
qwaylanddatadevicemanager.cpp \
- qwaylanddatasource.cpp
+ qwaylanddatasource.cpp \
+ qwaylandshell.cpp \
+ qwaylandshellsurface.cpp
HEADERS = qwaylandintegration.h \
qwaylandnativeinterface.h \
qwaylanddnd.h \
qwaylanddataoffer.h \
qwaylanddatadevicemanager.h \
- qwaylanddatasource.h
+ qwaylanddatasource.h \
+ qwaylandshell.h \
+ qwaylandshellsurface.h
INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND
LIBS += $$QMAKE_LIBS_WAYLAND
This version of Qt-Compositor is checked against the following sha1 from the
Wayland repository:
-eae3bcb4ccb80ef1c4dcd2f71987c1187aeb9e73
+58bb064afa3bfc706e3b30dd170804235aa272ea