Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging

* 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging:
  Wayland: send surface id + process id pairs to compositor
This commit is contained in:
Qt Continuous Integration System 2011-05-19 22:53:06 +10:00
commit a813d7c24a
9 changed files with 324 additions and 1 deletions

View File

@ -51,6 +51,10 @@
#include "gl_integration/qwaylandglintegration.h"
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
#include "windowmanager_integration/qwaylandwindowmanagerintegration.h"
#endif
#include <QtCore/QAbstractEventDispatcher>
#include <QtGui/QApplication>
#include <QtGui/private/qapplication_p.h>
@ -97,6 +101,13 @@ QWaylandGLIntegration * QWaylandDisplay::eglIntegration()
}
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration()
{
return mWindowManagerIntegration;
}
#endif
void QWaylandDisplay::shellHandleConfigure(void *data, struct wl_shell *shell,
uint32_t time, uint32_t edges,
struct wl_surface *surface,
@ -136,6 +147,10 @@ QWaylandDisplay::QWaylandDisplay(void)
mEglIntegration->initialize();
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
mWindowManagerIntegration = QWaylandWindowManagerIntegration::createIntegration(this);
#endif
connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()), this, SLOT(flushRequests()));
mFd = wl_display_get_fd(mDisplay, sourceUpdate, this);

View File

@ -55,6 +55,8 @@ class QWaylandBuffer;
class QPlatformScreen;
class QWaylandScreen;
class QWaylandGLIntegration;
class QWaylandWindowManagerIntegration;
class QWaylandDisplay : public QObject {
Q_OBJECT
@ -74,6 +76,11 @@ public:
#ifdef QT_WAYLAND_GL_SUPPORT
QWaylandGLIntegration *eglIntegration();
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
QWaylandWindowManagerIntegration *windowManagerIntegration();
#endif
void setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y);
void syncCallback(wl_display_sync_func_t func, void *data);
@ -124,6 +131,10 @@ private:
QWaylandGLIntegration *mEglIntegration;
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
QWaylandWindowManagerIntegration *mWindowManagerIntegration;
#endif
static void shellHandleConfigure(void *data, struct wl_shell *shell,
uint32_t time, uint32_t edges,
struct wl_surface *surface,

View File

@ -46,6 +46,11 @@
#include "qwaylandinputdevice.h"
#include "qwaylandscreen.h"
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
#include "windowmanager_integration/qwaylandwindowmanagerintegration.h"
#endif
#include <QCoreApplication>
#include <QtGui/QWidget>
#include <QtGui/QWindowSystemInterface>
@ -60,6 +65,10 @@ QWaylandWindow::QWaylandWindow(QWidget *window)
static WId id = 1;
mWindowId = id++;
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
mDisplay->windowManagerIntegration()->mapClientToProcess(qApp->applicationPid());
#endif
mSurface = mDisplay->createSurface(this);
}
@ -120,7 +129,6 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer)
}
}
void QWaylandWindow::damage(const QRegion &region)
{
//We have to do sync stuff before calling damage, or we might

View File

@ -40,8 +40,10 @@ QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND
INCLUDEPATH += $$PWD
include ($$PWD/gl_integration/gl_integration.pri)
include ($$PWD/windowmanager_integration/windowmanager_integration.pri)
include (../fontdatabases/genericunix/genericunix.pri)
target.path += $$[QT_INSTALL_PLUGINS]/platforms
INSTALLS += target

View File

@ -0,0 +1,82 @@
/*
* Copyright © 2010 Kristian Høgsberg
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H
#define WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stddef.h>
#include "wayland-util.h"
struct wl_client;
struct wl_windowmanager;
extern const struct wl_interface wl_windowmanager_interface;
#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0
static inline struct wl_windowmanager *
wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t /*version*/)
{
// ### does not run without latest wayland. must be enabled later
//wl_display_bind(display, id, "wl_windowmanager", version);
return (struct wl_windowmanager *)
wl_proxy_create_for_id(display, &wl_windowmanager_interface, id);
}
static inline void
wl_windowmanager_set_user_data(struct wl_windowmanager *wl_windowmanager, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) wl_windowmanager, user_data);
}
static inline void *
wl_windowmanager_get_user_data(struct wl_windowmanager *wl_windowmanager)
{
return wl_proxy_get_user_data((struct wl_proxy *) wl_windowmanager);
}
static inline void
wl_windowmanager_destroy(struct wl_windowmanager *wl_windowmanager)
{
wl_proxy_destroy((struct wl_proxy *) wl_windowmanager);
}
static inline void
wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid)
{
wl_proxy_marshal((struct wl_proxy *) wl_windowmanager,
WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid);
}
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,84 @@
/****************************************************************************
**
** 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 plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, 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.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qwaylandwindowmanagerintegration.h"
#include "qwaylandwindowmanager-client-protocol.h"
#include <stdint.h>
QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::createIntegration(QWaylandDisplay *waylandDisplay)
{
return new QWaylandWindowManagerIntegration(waylandDisplay);
}
QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay)
: mWaylandDisplay(waylandDisplay)
, mWaylandWindowManager(0)
{
wl_display_add_global_listener(mWaylandDisplay->wl_display(),
QWaylandWindowManagerIntegration::wlHandleListenerGlobal,
this);
}
QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration()
{
}
struct wl_windowmanager *QWaylandWindowManagerIntegration::windowManager() const
{
return mWaylandWindowManager;
}
void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface,
uint32_t version, void *data)
{
if (strcmp(interface, "wl_windowmanager") == 0) {
QWaylandWindowManagerIntegration *integration = static_cast<QWaylandWindowManagerIntegration *>(data);
integration->mWaylandWindowManager = wl_windowmanager_create(display,id, version);
}
}
void QWaylandWindowManagerIntegration::mapClientToProcess(long long processId)
{
wl_windowmanager_map_client_to_process(mWaylandWindowManager, (uint32_t) processId);
}

View File

@ -0,0 +1,69 @@
/****************************************************************************
**
** 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 plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, 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.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWAYLANDWINDOWMANAGERINTEGRATION_H
#define QWAYLANDWINDOWMANAGERINTEGRATION_H
#include <QObject>
#include "wayland-client.h"
#include "qwaylanddisplay.h"
class QWaylandWindowManagerIntegration
{
public:
explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay);
virtual ~QWaylandWindowManagerIntegration();
static QWaylandWindowManagerIntegration *createIntegration(QWaylandDisplay *waylandDisplay);
struct wl_windowmanager *windowManager() const;
void mapSurfaceToProcess(struct wl_surface *surface, long long processId);
void mapClientToProcess(long long processId);
private:
static void wlHandleListenerGlobal(wl_display *display, uint32_t id,
const char *interface, uint32_t version, void *data);
private:
QWaylandDisplay *mWaylandDisplay;
struct wl_windowmanager *mWaylandWindowManager;
};
#endif // QWAYLANDWINDOWMANAGERINTEGRATION_H

View File

@ -0,0 +1,36 @@
/*
* Copyright © 2010 Kristian Høgsberg
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdlib.h>
#include <stdint.h>
#include "wayland-util.h"
static const struct wl_message wl_windowmanager_requests[] = {
{ "map_client_to_process", "u", NULL },
};
WL_EXPORT const struct wl_interface wl_windowmanager_interface = {
"wl_windowmanager", 1,
ARRAY_LENGTH(wl_windowmanager_requests), wl_windowmanager_requests,
0, NULL,
};

View File

@ -0,0 +1,16 @@
DEFINES += QT_WAYLAND_WINDOWMANAGER_SUPPORT
contains(DEFINES, QT_WAYLAND_WINDOWMANAGER_SUPPORT) {
HEADERS += \
$$PWD/qwaylandwindowmanager-client-protocol.h \
$$PWD/qwaylandwindowmanagerintegration.h
SOURCES += \
$$PWD/qwaylandwindowmanagerintegration.cpp \
$$PWD/wayland-windowmanager-protocol.c
}