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

Change-Id: I6784a53fcc2f0f68b8e916181cb8cdef263782b8
This commit is contained in:
Paul Olav Tvete 2016-08-26 19:14:40 +02:00
commit b47f89bb39
4 changed files with 26 additions and 8 deletions

View File

@ -409,13 +409,16 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic
{ {
QWaylandWindow *keyboardFocus = inputDevice->keyboardFocus(); QWaylandWindow *keyboardFocus = inputDevice->keyboardFocus();
if (!keyboardFocus->shellSurface()->shellManagesActiveState() && mLastKeyboardFocus != keyboardFocus) { if (mLastKeyboardFocus == keyboardFocus)
if (keyboardFocus) return;
handleWindowActivated(keyboardFocus);
if (mLastKeyboardFocus) if (keyboardFocus && !keyboardFocus->shellManagesActiveState())
handleWindowDeactivated(mLastKeyboardFocus); handleWindowActivated(keyboardFocus);
}
mLastKeyboardFocus = inputDevice->keyboardFocus(); if (mLastKeyboardFocus && !mLastKeyboardFocus->shellManagesActiveState())
handleWindowDeactivated(mLastKeyboardFocus);
mLastKeyboardFocus = keyboardFocus;
} }
void QWaylandDisplay::handleWaylandSync() void QWaylandDisplay::handleWaylandSync()

View File

@ -527,6 +527,11 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const
return mSubSurfaceWindow; return mSubSurfaceWindow;
} }
bool QWaylandWindow::shellManagesActiveState() const
{
return mShellSurface && mShellSurface->shellManagesActiveState();
}
void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
{ {
if (mDisplay->compositorVersion() < 2) if (mDisplay->compositorVersion() < 2)

View File

@ -142,6 +142,8 @@ public:
QWaylandSubSurface *subSurfaceWindow() const; QWaylandSubSurface *subSurfaceWindow() const;
QWaylandScreen *screen() const { return mScreen; } QWaylandScreen *screen() const { return mScreen; }
bool shellManagesActiveState() const;
void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE; void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE;
void setOrientationMask(Qt::ScreenOrientations mask); void setOrientationMask(Qt::ScreenOrientations mask);

View File

@ -157,6 +157,13 @@ void QWaylandWlShellSurface::setTopLevel()
set_toplevel(); set_toplevel();
} }
static inline bool testShowWithoutActivating(const QWindow *window)
{
// QWidget-attribute Qt::WA_ShowWithoutActivating.
const QVariant showWithoutActivating = window->property("_q_showWithoutActivating");
return showWithoutActivating.isValid() && showWithoutActivating.toBool();
}
void QWaylandWlShellSurface::updateTransientParent(QWindow *parent) void QWaylandWlShellSurface::updateTransientParent(QWindow *parent)
{ {
QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle()); QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle());
@ -174,7 +181,8 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent)
uint32_t flags = 0; uint32_t flags = 0;
Qt::WindowFlags wf = m_window->window()->flags(); Qt::WindowFlags wf = m_window->window()->flags();
if (wf.testFlag(Qt::ToolTip) if (wf.testFlag(Qt::ToolTip)
|| wf.testFlag(Qt::WindowTransparentForInput)) || wf.testFlag(Qt::WindowTransparentForInput)
|| testShowWithoutActivating(m_window->window()))
flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE; flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE;
set_transient(parent_wayland_window->object(), set_transient(parent_wayland_window->object(),