[platforms/x11/windowed] Create output devices
Summary: Create output devices in X11 nested Wayland session. Test Plan: Started nested session in X11. KScreen showed output. Reviewers: #kwin Subscribers: kwin Tags: #kwin Maniphest Tasks: T11459 Differential Revision: https://phabricator.kde.org/D23479
This commit is contained in:
parent
d960be4b3f
commit
edb200f6bc
3 changed files with 17 additions and 6 deletions
|
@ -54,6 +54,7 @@ X11WindowedBackend::X11WindowedBackend(QObject *parent)
|
|||
{
|
||||
setSupportsPointerWarping(true);
|
||||
connect(this, &X11WindowedBackend::sizeChanged, this, &X11WindowedBackend::screenSizeChanged);
|
||||
handleOutputs();
|
||||
}
|
||||
|
||||
X11WindowedBackend::~X11WindowedBackend()
|
||||
|
@ -153,9 +154,7 @@ void X11WindowedBackend::createOutputs()
|
|||
int logicalWidthSum = 0;
|
||||
for (int i = 0; i < initialOutputCount(); ++i) {
|
||||
auto *output = new X11WindowedOutput(this);
|
||||
output->setScale(initialOutputScale());
|
||||
output->setGeometry(QPoint(logicalWidthSum, 0), QSize(pixelWidth, pixelHeight));
|
||||
output->init();
|
||||
output->init(QPoint(logicalWidthSum, 0), QSize(pixelWidth, pixelHeight));
|
||||
|
||||
m_protocols = protocolsAtom;
|
||||
m_deleteWindowProtocol = deleteWindowAtom;
|
||||
|
|
|
@ -47,8 +47,20 @@ X11WindowedOutput::~X11WindowedOutput()
|
|||
xcb_flush(m_backend->connection());
|
||||
}
|
||||
|
||||
void X11WindowedOutput::init()
|
||||
void X11WindowedOutput::init(const QPoint &logicalPosition, const QSize &pixelSize)
|
||||
{
|
||||
KWayland::Server::OutputDeviceInterface::Mode mode;
|
||||
mode.id = 0;
|
||||
mode.size = pixelSize;
|
||||
mode.flags = KWayland::Server::OutputDeviceInterface::ModeFlag::Current;
|
||||
mode.refreshRate = 60000; // TODO: get refresh rate via randr
|
||||
AbstractWaylandOutput::initWaylandOutputDevice("model_TODO", "manufacturer_TODO",
|
||||
"UUID_TODO", { mode });
|
||||
|
||||
setEnabled(true);
|
||||
setGeometry(logicalPosition, pixelSize);
|
||||
setScale(m_backend->initialOutputScale());
|
||||
|
||||
uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
|
||||
const uint32_t values[] = {
|
||||
m_backend->screen()->black_pixel,
|
||||
|
@ -67,7 +79,7 @@ void X11WindowedOutput::init()
|
|||
m_window,
|
||||
m_backend->screen()->root,
|
||||
0, 0,
|
||||
pixelSize().width(), pixelSize().height(),
|
||||
pixelSize.width(), pixelSize.height(),
|
||||
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT,
|
||||
mask, values);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
explicit X11WindowedOutput(X11WindowedBackend *backend);
|
||||
~X11WindowedOutput() override;
|
||||
|
||||
void init();
|
||||
void init(const QPoint &logicalPosition, const QSize &pixelSize);
|
||||
|
||||
xcb_window_t window() const {
|
||||
return m_window;
|
||||
|
|
Loading…
Reference in a new issue