[wayland] Add support for initial output count for nested compositors
Added to x11 backend which creates one window per output. New command line option is called --output-count=<int>.
This commit is contained in:
parent
1e3013b58c
commit
56bd1e7194
3 changed files with 72 additions and 45 deletions
|
@ -107,6 +107,12 @@ public:
|
||||||
void setOutputsEnabled(bool enabled) {
|
void setOutputsEnabled(bool enabled) {
|
||||||
m_outputsEnabled = enabled;
|
m_outputsEnabled = enabled;
|
||||||
}
|
}
|
||||||
|
int initialOutputCount() const {
|
||||||
|
return m_initialOutputCount;
|
||||||
|
}
|
||||||
|
void setInitialOutputCount(int count) {
|
||||||
|
m_initialOutputCount = count;
|
||||||
|
}
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void pointerMotion(const QPointF &position, quint32 time);
|
void pointerMotion(const QPointF &position, quint32 time);
|
||||||
|
@ -170,6 +176,7 @@ private:
|
||||||
QByteArray m_deviceIdentifier;
|
QByteArray m_deviceIdentifier;
|
||||||
bool m_pointerWarping = false;
|
bool m_pointerWarping = false;
|
||||||
bool m_outputsEnabled = true;
|
bool m_outputsEnabled = true;
|
||||||
|
int m_initialOutputCount = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@ void X11WindowedBackend::createWindow()
|
||||||
{
|
{
|
||||||
Xcb::Atom protocolsAtom(QByteArrayLiteral("WM_PROTOCOLS"), false, m_connection);
|
Xcb::Atom protocolsAtom(QByteArrayLiteral("WM_PROTOCOLS"), false, m_connection);
|
||||||
Xcb::Atom deleteWindowAtom(QByteArrayLiteral("WM_DELETE_WINDOW"), false, m_connection);
|
Xcb::Atom deleteWindowAtom(QByteArrayLiteral("WM_DELETE_WINDOW"), false, m_connection);
|
||||||
|
for (int i = 0; i < initialOutputCount(); ++i) {
|
||||||
Output o;
|
Output o;
|
||||||
o.window = xcb_generate_id(m_connection);
|
o.window = xcb_generate_id(m_connection);
|
||||||
uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
|
uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
|
||||||
|
@ -155,6 +156,7 @@ void X11WindowedBackend::createWindow()
|
||||||
xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, o.window, m_protocols, XCB_ATOM_ATOM, 32, 1, &m_deleteWindowProtocol);
|
xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, o.window, m_protocols, XCB_ATOM_ATOM, 32, 1, &m_deleteWindowProtocol);
|
||||||
|
|
||||||
m_windows << o;
|
m_windows << o;
|
||||||
|
}
|
||||||
|
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
|
|
||||||
|
|
|
@ -426,6 +426,7 @@ int main(int argc, char * argv[])
|
||||||
};
|
};
|
||||||
const bool hasWindowedOption = hasPlugin(KWin::s_x11Plugin) || hasPlugin(KWin::s_waylandPlugin);
|
const bool hasWindowedOption = hasPlugin(KWin::s_x11Plugin) || hasPlugin(KWin::s_waylandPlugin);
|
||||||
const bool hasSizeOption = hasPlugin(KWin::s_x11Plugin) || hasPlugin(KWin::s_virtualPlugin);
|
const bool hasSizeOption = hasPlugin(KWin::s_x11Plugin) || hasPlugin(KWin::s_virtualPlugin);
|
||||||
|
const bool hasOutputCountOption = hasPlugin(KWin::s_x11Plugin);
|
||||||
const bool hasX11Option = hasPlugin(KWin::s_x11Plugin);
|
const bool hasX11Option = hasPlugin(KWin::s_x11Plugin);
|
||||||
const bool hasVirtualOption = hasPlugin(KWin::s_virtualPlugin);
|
const bool hasVirtualOption = hasPlugin(KWin::s_virtualPlugin);
|
||||||
const bool hasWaylandOption = hasPlugin(KWin::s_waylandPlugin);
|
const bool hasWaylandOption = hasPlugin(KWin::s_waylandPlugin);
|
||||||
|
@ -465,6 +466,10 @@ int main(int argc, char * argv[])
|
||||||
i18n("The height for windowed mode. Default height is 768."),
|
i18n("The height for windowed mode. Default height is 768."),
|
||||||
QStringLiteral("height"));
|
QStringLiteral("height"));
|
||||||
heightOption.setDefaultValue(QString::number(768));
|
heightOption.setDefaultValue(QString::number(768));
|
||||||
|
QCommandLineOption outputCountOption(QStringLiteral("output-count"),
|
||||||
|
i18n("The number of windows to open as outputs in windowed mode. Default value is 1"),
|
||||||
|
QStringLiteral("height"));
|
||||||
|
outputCountOption.setDefaultValue(QString::number(1));
|
||||||
|
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
a.setupCommandLine(&parser);
|
a.setupCommandLine(&parser);
|
||||||
|
@ -490,6 +495,9 @@ int main(int argc, char * argv[])
|
||||||
parser.addOption(widthOption);
|
parser.addOption(widthOption);
|
||||||
parser.addOption(heightOption);
|
parser.addOption(heightOption);
|
||||||
}
|
}
|
||||||
|
if (hasOutputCountOption) {
|
||||||
|
parser.addOption(outputCountOption);
|
||||||
|
}
|
||||||
#if HAVE_LIBHYBRIS
|
#if HAVE_LIBHYBRIS
|
||||||
QCommandLineOption hwcomposerOption(QStringLiteral("hwcomposer"), i18n("Use libhybris hwcomposer"));
|
QCommandLineOption hwcomposerOption(QStringLiteral("hwcomposer"), i18n("Use libhybris hwcomposer"));
|
||||||
if (hasHwcomposerOption) {
|
if (hasHwcomposerOption) {
|
||||||
|
@ -551,6 +559,7 @@ int main(int argc, char * argv[])
|
||||||
QString pluginName;
|
QString pluginName;
|
||||||
QSize initialWindowSize;
|
QSize initialWindowSize;
|
||||||
QByteArray deviceIdentifier;
|
QByteArray deviceIdentifier;
|
||||||
|
int outputCount = 1;
|
||||||
|
|
||||||
#if HAVE_DRM
|
#if HAVE_DRM
|
||||||
if (hasDrmOption && parser.isSet(drmOption)) {
|
if (hasDrmOption && parser.isSet(drmOption)) {
|
||||||
|
@ -573,6 +582,14 @@ int main(int argc, char * argv[])
|
||||||
initialWindowSize = QSize(width, height);
|
initialWindowSize = QSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasOutputCountOption) {
|
||||||
|
bool ok = false;
|
||||||
|
const int count = parser.value(outputCountOption).toInt(&ok);
|
||||||
|
if (ok) {
|
||||||
|
outputCount = qMax(1, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hasWindowedOption && parser.isSet(windowedOption)) {
|
if (hasWindowedOption && parser.isSet(windowedOption)) {
|
||||||
if (hasX11Option && parser.isSet(x11DisplayOption)) {
|
if (hasX11Option && parser.isSet(x11DisplayOption)) {
|
||||||
deviceIdentifier = parser.value(x11DisplayOption).toUtf8();
|
deviceIdentifier = parser.value(x11DisplayOption).toUtf8();
|
||||||
|
@ -655,6 +672,7 @@ int main(int argc, char * argv[])
|
||||||
if (initialWindowSize.isValid()) {
|
if (initialWindowSize.isValid()) {
|
||||||
server->backend()->setInitialWindowSize(initialWindowSize);
|
server->backend()->setInitialWindowSize(initialWindowSize);
|
||||||
}
|
}
|
||||||
|
server->backend()->setInitialOutputCount(outputCount);
|
||||||
|
|
||||||
QObject::connect(&a, &KWin::Application::workspaceCreated, server, &KWin::WaylandServer::initWorkspace);
|
QObject::connect(&a, &KWin::Application::workspaceCreated, server, &KWin::WaylandServer::initWorkspace);
|
||||||
environment.insert(QStringLiteral("WAYLAND_DISPLAY"), server->display()->socketName());
|
environment.insert(QStringLiteral("WAYLAND_DISPLAY"), server->display()->socketName());
|
||||||
|
|
Loading…
Reference in a new issue