Merge remote-tracking branch 'origin/5.6' into 5.7

Change-Id: I31f4c29c985301d28d5c8d0501761c7d4fb7fda6
This commit is contained in:
Liang Qi 2016-04-08 10:24:17 +02:00
commit 17d8de6ca3
2 changed files with 24 additions and 4 deletions

View File

@ -125,13 +125,13 @@ QWaylandWindow::~QWaylandWindow()
void QWaylandWindow::initWindow() void QWaylandWindow::initWindow()
{ {
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this))); init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
if (QPlatformWindow::parent()) {
if (shouldCreateSubSurface()) {
QWaylandWindow *p = static_cast<QWaylandWindow *>(QPlatformWindow::parent()); QWaylandWindow *p = static_cast<QWaylandWindow *>(QPlatformWindow::parent());
if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) { if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) {
mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss); mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss);
} }
} else if (!(qEnvironmentVariableIsSet("QT_WAYLAND_USE_BYPASSWINDOWMANAGERHINT") && } else if (shouldCreateShellSurface()) {
window()->flags() & Qt::BypassWindowManagerHint)) {
mShellSurface = mDisplay->createShellSurface(this); mShellSurface = mDisplay->createShellSurface(this);
} }
@ -198,6 +198,25 @@ void QWaylandWindow::initWindow()
handleContentOrientationChange(window()->contentOrientation()); handleContentOrientationChange(window()->contentOrientation());
} }
bool QWaylandWindow::shouldCreateShellSurface() const
{
if (shouldCreateSubSurface())
return false;
if (window()->inherits("QShapedPixmapWindow"))
return false;
if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_BYPASSWINDOWMANAGERHINT"))
return window()->flags() & Qt::BypassWindowManagerHint;
return true;
}
bool QWaylandWindow::shouldCreateSubSurface() const
{
return QPlatformWindow::parent() != Q_NULLPTR;
}
void QWaylandWindow::reset() void QWaylandWindow::reset()
{ {
delete mShellSurface; delete mShellSurface;

View File

@ -126,7 +126,6 @@ public:
using QtWayland::wl_surface::attach; using QtWayland::wl_surface::attach;
void attach(QWaylandBuffer *buffer, int x, int y); void attach(QWaylandBuffer *buffer, int x, int y);
void attachOffset(QWaylandBuffer *buffer); void attachOffset(QWaylandBuffer *buffer);
QWaylandBuffer *attached() const;
QPoint attachOffset() const; QPoint attachOffset() const;
using QtWayland::wl_surface::damage; using QtWayland::wl_surface::damage;
@ -243,6 +242,8 @@ private:
bool setWindowStateInternal(Qt::WindowState flags); bool setWindowStateInternal(Qt::WindowState flags);
void setGeometry_helper(const QRect &rect); void setGeometry_helper(const QRect &rect);
void initWindow(); void initWindow();
bool shouldCreateShellSurface() const;
bool shouldCreateSubSurface() const;
void reset(); void reset();
void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e);