summaryrefslogtreecommitdiffstats
path: root/src/compositor/extensions/qwaylandshell.cpp
diff options
context:
space:
mode:
authorPier Luigi Fiorini <pierluigi.fiorini@gmail.com>2016-08-14 13:28:30 +0200
committerPier Luigi Fiorini <pierluigi.fiorini@hawaiios.org>2016-09-30 09:38:56 +0000
commit9e585fc849c80b04c02c671d908fb5ade6c441b0 (patch)
tree0eeb11777d59012f8298f1a5d05e0176fda48eb6 /src/compositor/extensions/qwaylandshell.cpp
parent079b260e42cf394a8dbe823763ec455929fba091 (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/qwaylandshell.cpp')
-rw-r--r--src/compositor/extensions/qwaylandshell.cpp100
1 files changed, 100 insertions, 0 deletions
diff --git a/src/compositor/extensions/qwaylandshell.cpp b/src/compositor/extensions/qwaylandshell.cpp
new file mode 100644
index 000000000..7811a1c2a
--- /dev/null
+++ b/src/compositor/extensions/qwaylandshell.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwaylandshell.h"
+#include "qwaylandshell_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QWaylandShellPrivate::QWaylandShellPrivate()
+ : focusPolicy(QWaylandShell::AutomaticFocus)
+{
+}
+
+QWaylandShell::QWaylandShell()
+ : QWaylandCompositorExtension()
+{
+}
+
+QWaylandShell::QWaylandShell(QWaylandObject *waylandObject)
+ : QWaylandCompositorExtension(waylandObject, *new QWaylandShellPrivate())
+{
+}
+
+/*!
+ * \qmlproperty enum QtWaylandCompositor::Shell::focusPolicy
+ *
+ * This property holds the focus policy of the Shell.
+ */
+
+/*!
+ * \enum QWaylandShell::FocusPolicy
+ *
+ * This enum type is used to specify the focus policy for shell surfaces.
+ *
+ * \value AutomaticFocus Shell surfaces will automatically get keyboard focus when they are created.
+ * \value ManualFocus The compositor will decide whether shell surfaces should get keyboard focus or not.
+ */
+
+/*!
+ * \qmlproperty object QtWaylandCompositor::Shell::focusPolicy
+ *
+ * This property holds the focus policy of the Shell.
+ */
+
+/*!
+ * \property QWaylandShell::focusPolicy
+ *
+ * This property holds the focus policy of the QWaylandShell.
+ */
+QWaylandShell::FocusPolicy QWaylandShell::focusPolicy() const
+{
+ Q_D(const QWaylandShell);
+ return d->focusPolicy;
+}
+
+void QWaylandShell::setFocusPolicy(QWaylandShell::FocusPolicy focusPolicy)
+{
+ Q_D(QWaylandShell);
+
+ if (d->focusPolicy == focusPolicy)
+ return;
+
+ d->focusPolicy = focusPolicy;
+ emit focusPolicyChanged();
+}
+
+QT_END_NAMESPACE