Merge remote-tracking branch 'origin/5.4' into 5.5

Conflicts:
	src/client/qwaylandshmbackingstore.cpp
	src/client/qwaylandwindow.cpp

Change-Id: I795fd08f0fc5d3cb5ed55bf16e724f66b7567723
This commit is contained in:
Liang Qi 2015-04-15 09:19:39 +02:00
commit cd7c9b50f6
10 changed files with 43 additions and 24 deletions

View File

@ -5,8 +5,6 @@ QT += waylandclient-private
include(../../../../hardwareintegration/client/brcm-egl/brcm-egl.pri) include(../../../../hardwareintegration/client/brcm-egl/brcm-egl.pri)
LIBS += -lEGL
OTHER_FILES += \ OTHER_FILES += \
brcm-egl.json brcm-egl.json

View File

@ -8,8 +8,6 @@ QT += waylandclient-private
include(../../../../hardwareintegration/client/drm-egl-server/drm-egl-server.pri) include(../../../../hardwareintegration/client/drm-egl-server/drm-egl-server.pri)
LIBS += -lEGL
OTHER_FILES += \ OTHER_FILES += \
drm-egl-server.json drm-egl-server.json

View File

@ -5,8 +5,6 @@ QT += waylandclient-private
include(../../../../hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri) include(../../../../hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri)
LIBS += -lEGL
OTHER_FILES += \ OTHER_FILES += \
libhybris-egl-server.json libhybris-egl-server.json

View File

@ -48,7 +48,10 @@ namespace QtWaylandClient {
class Q_WAYLAND_CLIENT_EXPORT QWaylandBuffer { class Q_WAYLAND_CLIENT_EXPORT QWaylandBuffer {
public: public:
QWaylandBuffer() { } QWaylandBuffer()
: mBuffer(0)
{
}
virtual ~QWaylandBuffer() { } virtual ~QWaylandBuffer() { }
wl_buffer *buffer() {return mBuffer;} wl_buffer *buffer() {return mBuffer;}
virtual QSize size() const = 0; virtual QSize size() const = 0;

View File

@ -198,7 +198,6 @@ private:
QSocketNotifier *mReadNotifier; QSocketNotifier *mReadNotifier;
int mFd; int mFd;
int mWritableNotificationFd; int mWritableNotificationFd;
bool mScreensInitialized;
QList<RegistryGlobal> mGlobals; QList<RegistryGlobal> mGlobals;
int mCompositorVersion; int mCompositorVersion;
uint32_t mLastInputSerial; uint32_t mLastInputSerial;

View File

@ -35,6 +35,7 @@
#define QWAYLANDSHELLSURFACE_H #define QWAYLANDSHELLSURFACE_H
#include <QtCore/QSize> #include <QtCore/QSize>
#include <QObject>
#include <wayland-client.h> #include <wayland-client.h>
@ -51,8 +52,9 @@ namespace QtWaylandClient {
class QWaylandWindow; class QWaylandWindow;
class QWaylandInputDevice; class QWaylandInputDevice;
class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QObject
{ {
Q_OBJECT
public: public:
explicit QWaylandShellSurface(QWaylandWindow *window); explicit QWaylandShellSurface(QWaylandWindow *window);
virtual ~QWaylandShellSurface() {} virtual ~QWaylandShellSurface() {}

View File

@ -55,7 +55,8 @@ namespace QtWaylandClient {
QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
const QSize &size, QImage::Format format, int scale) const QSize &size, QImage::Format format, int scale)
: mMarginsImage(0) : mShmPool(0)
, mMarginsImage(0)
{ {
int stride = size.width() * 4; int stride = size.width() * 4;
int alloc = stride * size.height(); int alloc = stride * size.height();
@ -97,8 +98,11 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
QWaylandShmBuffer::~QWaylandShmBuffer(void) QWaylandShmBuffer::~QWaylandShmBuffer(void)
{ {
delete mMarginsImage; delete mMarginsImage;
if (mImage.constBits())
munmap((void *) mImage.constBits(), mImage.byteCount()); munmap((void *) mImage.constBits(), mImage.byteCount());
if (mBuffer)
wl_buffer_destroy(mBuffer); wl_buffer_destroy(mBuffer);
if (mShmPool)
wl_shm_pool_destroy(mShmPool); wl_shm_pool_destroy(mShmPool);
} }

View File

@ -102,10 +102,24 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
// Set initial surface title // Set initial surface title
mShellSurface->setTitle(window->title()); mShellSurface->setTitle(window->title());
// Set surface class to the .desktop file name (obtained from executable name) // The appId is the desktop entry identifier that should follow the
QFileInfo exeFileInfo(qApp->applicationFilePath()); // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html),
QString className = exeFileInfo.baseName() + QLatin1String(".desktop"); // use the application domain if available, otherwise the executable base name.
mShellSurface->setAppId(className); // According to xdg-shell the appId is only the name, without the .desktop suffix.
QFileInfo fi = QCoreApplication::instance()->applicationFilePath();
QStringList domainName =
QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'),
QString::SkipEmptyParts);
if (domainName.isEmpty()) {
mShellSurface->setAppId(fi.baseName());
} else {
QString appId;
for (int i = 0; i < domainName.count(); ++i)
appId.prepend(QLatin1Char('.')).prepend(domainName.at(i));
appId.append(fi.baseName());
mShellSurface->setAppId(appId);
}
} }
if (QPlatformWindow::parent() && mSubSurfaceWindow) { if (QPlatformWindow::parent() && mSubSurfaceWindow) {
@ -234,7 +248,7 @@ void QWaylandWindow::setVisible(bool visible)
parent = mDisplay->lastInputWindow(); parent = mDisplay->lastInputWindow();
} }
if (parent) { if (parent) {
QWaylandWlShellSurface *wlshellSurface = dynamic_cast<QWaylandWlShellSurface*>(mShellSurface); QWaylandWlShellSurface *wlshellSurface = qobject_cast<QWaylandWlShellSurface*>(mShellSurface);
if (wlshellSurface) if (wlshellSurface)
wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial());
} }
@ -500,7 +514,7 @@ bool QWaylandWindow::createDecoration()
{ {
// so far only xdg-shell support this "unminimize" trick, may be moved elsewhere // so far only xdg-shell support this "unminimize" trick, may be moved elsewhere
if (mState == Qt::WindowMinimized) { if (mState == Qt::WindowMinimized) {
QWaylandXdgSurface *xdgSurface = dynamic_cast<QWaylandXdgSurface *>(mShellSurface); QWaylandXdgSurface *xdgSurface = qobject_cast<QWaylandXdgSurface *>(mShellSurface);
if ( xdgSurface ) { if ( xdgSurface ) {
if (xdgSurface->isFullscreen()) { if (xdgSurface->isFullscreen()) {
setWindowStateInternal(Qt::WindowFullScreen); setWindowStateInternal(Qt::WindowFullScreen);
@ -639,7 +653,8 @@ bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const
void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e)
{ {
if (mWindowDecoration->handleMouse(inputDevice, e.local, e.global, e.buttons, e.modifiers)) { if (mMousePressedInContentArea == Qt::NoButton &&
mWindowDecoration->handleMouse(inputDevice, e.local, e.global, e.buttons, e.modifiers)) {
if (mMouseEventsInContentArea) if (mMouseEventsInContentArea)
QWindowSystemInterface::handleLeaveEvent(window()); QWindowSystemInterface::handleLeaveEvent(window());
return; return;

View File

@ -52,9 +52,10 @@ class QWaylandWindow;
class QWaylandInputDevice; class QWaylandInputDevice;
class QWaylandExtendedSurface; class QWaylandExtendedSurface;
class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QtWayland::wl_shell_surface class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurface
, public QWaylandShellSurface , public QtWayland::wl_shell_surface
{ {
Q_OBJECT
public: public:
QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window); QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window);
virtual ~QWaylandWlShellSurface(); virtual ~QWaylandWlShellSurface();

View File

@ -53,9 +53,10 @@ class QWaylandWindow;
class QWaylandInputDevice; class QWaylandInputDevice;
class QWaylandExtendedSurface; class QWaylandExtendedSurface;
class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QtWayland::xdg_surface class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface
, public QWaylandShellSurface , public QtWayland::xdg_surface
{ {
Q_OBJECT
public: public:
QWaylandXdgSurface(struct ::xdg_surface *shell_surface, QWaylandWindow *window); QWaylandXdgSurface(struct ::xdg_surface *shell_surface, QWaylandWindow *window);
virtual ~QWaylandXdgSurface(); virtual ~QWaylandXdgSurface();