Introduce an OperationMode enum
This enum describes how KWin is operating with the available windowing systems. By default KWin is using the OperationModeX11, but if the Wayland backend gets started KWin is using the OperationModeWaylandAndX11 This will be extended in future when XWayland and Wayland only become viable options.
This commit is contained in:
parent
dda4f32e09
commit
6eb104b32a
4 changed files with 47 additions and 0 deletions
11
main.cpp
11
main.cpp
|
@ -189,6 +189,7 @@ Application::Application(int &argc, char **argv)
|
|||
, m_eventFilter(new XcbEventFilter())
|
||||
, m_replace(false)
|
||||
, m_configLock(false)
|
||||
, m_operationMode(OperationModeWaylandAndX11)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -202,6 +203,16 @@ void Application::setReplace(bool replace)
|
|||
m_replace = replace;
|
||||
}
|
||||
|
||||
Application::OperationMode Application::operationMode() const
|
||||
{
|
||||
return m_operationMode;
|
||||
}
|
||||
|
||||
void Application::setOperationMode(OperationMode mode)
|
||||
{
|
||||
m_operationMode = mode;
|
||||
}
|
||||
|
||||
void Application::start()
|
||||
{
|
||||
setQuitOnLastWindowClosed(false);
|
||||
|
|
25
main.h
25
main.h
|
@ -55,6 +55,23 @@ class Application : public QApplication
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief This enum provides the various operation modes of KWin depending on the available
|
||||
* Windowing Systems at startup. For example whether KWin only talks to X11 or also to a Wayland
|
||||
* Compositor.
|
||||
*
|
||||
*/
|
||||
enum OperationMode {
|
||||
/**
|
||||
* @brief KWin uses only X11 for managing windows and compositing
|
||||
*/
|
||||
OperationModeX11,
|
||||
/**
|
||||
* @brief KWin uses X11 for managing windows, but renders to a Wayland compositor.
|
||||
* Input is received from the Wayland compositor.
|
||||
*/
|
||||
OperationModeWaylandAndX11
|
||||
};
|
||||
Application(int &argc, char **argv);
|
||||
~Application();
|
||||
|
||||
|
@ -62,6 +79,13 @@ public:
|
|||
void setConfigLock(bool lock);
|
||||
|
||||
void start();
|
||||
/**
|
||||
* @brief The operation mode used by KWin.
|
||||
*
|
||||
* @return OperationMode
|
||||
*/
|
||||
OperationMode operationMode() const;
|
||||
void setOperationMode(OperationMode mode);
|
||||
|
||||
static void setCrashCount(int count);
|
||||
static bool wasCrash();
|
||||
|
@ -80,6 +104,7 @@ private:
|
|||
QScopedPointer<XcbEventFilter> m_eventFilter;
|
||||
bool m_replace;
|
||||
bool m_configLock;
|
||||
OperationMode m_operationMode;
|
||||
static int crashes;
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "wayland_backend.h"
|
||||
// KWin
|
||||
#include "cursor.h"
|
||||
#include "main.h"
|
||||
// Qt
|
||||
#include <QDebug>
|
||||
#include <QImage>
|
||||
|
@ -645,6 +646,7 @@ WaylandBackend::WaylandBackend(QObject *parent)
|
|||
, m_shm()
|
||||
{
|
||||
qDebug() << "Created Wayland display";
|
||||
kwinApp()->setOperationMode(Application::OperationModeWaylandAndX11);
|
||||
// setup the registry
|
||||
wl_registry_add_listener(m_registry, &s_registryListener, this);
|
||||
wl_display_dispatch(m_display);
|
||||
|
|
|
@ -1417,6 +1417,15 @@ QString Workspace::supportInformation() const
|
|||
support.append(QStringLiteral("Qt Version: "));
|
||||
support.append(QString::fromUtf8(qVersion()));
|
||||
support.append(QStringLiteral("\n\n"));
|
||||
support.append(QStringLiteral("Operation Mode: "));
|
||||
switch (kwinApp()->operationMode()) {
|
||||
case Application::OperationModeX11:
|
||||
support.append(QStringLiteral("X11 only"));
|
||||
break;
|
||||
case Application::OperationModeWaylandAndX11:
|
||||
support.append(QStringLiteral("Wayland and X11"));
|
||||
break;
|
||||
}
|
||||
support.append(QStringLiteral("Options\n"));
|
||||
support.append(QStringLiteral("=======\n"));
|
||||
const QMetaObject *metaOptions = options->metaObject();
|
||||
|
|
Loading…
Reference in a new issue