diff options
author | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2016-08-14 13:28:30 +0200 |
---|---|---|
committer | Pier Luigi Fiorini <pierluigi.fiorini@hawaiios.org> | 2016-09-30 09:38:56 +0000 |
commit | 9e585fc849c80b04c02c671d908fb5ade6c441b0 (patch) | |
tree | 0eeb11777d59012f8298f1a5d05e0176fda48eb6 /src/compositor/extensions/qwaylandwlshellintegration.cpp | |
parent | 079b260e42cf394a8dbe823763ec455929fba091 (diff) |
Compositor: Base shell class
Standard shell class with focus policy shared by all protocol
implementations.
The automatic focus policy gives focus to windows automatically as they
are created, while the manual policy allows a compositor to decide
what to do.
Change-Id: Ica71271174b30e28217e31c53f1c8dd576752c5e
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/compositor/extensions/qwaylandwlshellintegration.cpp')
-rw-r--r-- | src/compositor/extensions/qwaylandwlshellintegration.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp index ba2fe5fb4..882db0d0d 100644 --- a/src/compositor/extensions/qwaylandwlshellintegration.cpp +++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp @@ -57,6 +57,8 @@ WlShellIntegration::WlShellIntegration(QWaylandQuickShellSurfaceItem *item) connect(m_shellSurface, &QWaylandWlShellSurface::startResize, this, &WlShellIntegration::handleStartResize); connect(m_shellSurface->surface(), &QWaylandSurface::offsetForNextFrame, this, &WlShellIntegration::adjustOffsetForNextFrame); connect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged, this, &WlShellIntegration::handleSurfaceHasContentChanged); + connect(m_shellSurface, &QWaylandWlShellSurface::setDefaultToplevel, this, &WlShellIntegration::handleSetDefaultTopLevel); + connect(m_shellSurface, &QWaylandWlShellSurface::setTransient, this, &WlShellIntegration::handleSetTransient); connect(m_shellSurface, &QWaylandWlShellSurface::setPopup, this, &WlShellIntegration::handleSetPopup); connect(m_shellSurface, &QWaylandWlShellSurface::destroyed, this, &WlShellIntegration::handleShellSurfaceDestroyed); } @@ -78,6 +80,23 @@ void WlShellIntegration::handleStartResize(QWaylandSeat *seat, QWaylandWlShellSu resizeState.initialized = false; } +void WlShellIntegration::handleSetDefaultTopLevel() +{ + // Take focus if the policy allows + if (m_shellSurface->shell()->focusPolicy() == QWaylandShell::AutomaticFocus) + m_item->takeFocus(); +} + +void WlShellIntegration::handleSetTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, bool inactive) +{ + Q_UNUSED(parentSurface) + Q_UNUSED(relativeToParent) + + // Take focus if the policy allows and it's not inactive + if (m_shellSurface->shell()->focusPolicy() == QWaylandShell::AutomaticFocus && !inactive) + m_item->takeFocus(); +} + void WlShellIntegration::handleSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent) { Q_UNUSED(seat); |