Commit c74fa4b5 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

backends/x11: Port windowed backend from Screens

parent c414efc3
......@@ -11,7 +11,6 @@
#include "basiceglsurfacetexture_internal.h"
#include "basiceglsurfacetexture_wayland.h"
#include "main.h"
#include "screens.h"
#include "softwarevsyncmonitor.h"
#include "x11windowed_backend.h"
#include "x11windowed_output.h"
......
......@@ -8,7 +8,6 @@
*/
#include "scene_qpainter_x11_backend.h"
#include "main.h"
#include "screens.h"
#include "softwarevsyncmonitor.h"
#include "x11windowed_backend.h"
#include "x11windowed_output.h"
......@@ -52,8 +51,13 @@ X11WindowedQPainterBackend::X11WindowedQPainterBackend(X11WindowedBackend *backe
: QPainterBackend()
, m_backend(backend)
{
connect(screens(), &Screens::changed, this, &X11WindowedQPainterBackend::createOutputs);
createOutputs();
const auto outputs = m_backend->enabledOutputs();
for (Output *output : outputs) {
addOutput(output);
}
connect(backend, &X11WindowedBackend::outputEnabled, this, &X11WindowedQPainterBackend::addOutput);
connect(backend, &X11WindowedBackend::outputDisabled, this, &X11WindowedQPainterBackend::removeOutput);
}
X11WindowedQPainterBackend::~X11WindowedQPainterBackend()
......@@ -64,13 +68,14 @@ X11WindowedQPainterBackend::~X11WindowedQPainterBackend()
}
}
void X11WindowedQPainterBackend::createOutputs()
void X11WindowedQPainterBackend::addOutput(Output *output)
{
m_outputs.clear();
const auto &outputs = m_backend->outputs();
for (const auto &x11Output : outputs) {
m_outputs[x11Output] = std::make_shared<X11WindowedQPainterOutput>(x11Output, m_backend->windowForScreen(x11Output));
}
m_outputs[output] = std::make_shared<X11WindowedQPainterOutput>(output, m_backend->windowForScreen(output));
}
void X11WindowedQPainterBackend::removeOutput(Output *output)
{
m_outputs.remove(output);
}
void X11WindowedQPainterBackend::present(Output *output)
......
......@@ -50,7 +50,9 @@ public:
OutputLayer *primaryLayer(Output *output) override;
private:
void createOutputs();
void addOutput(Output *output);
void removeOutput(Output *output);
xcb_gcontext_t m_gc = XCB_NONE;
X11WindowedBackend *m_backend;
QMap<Output *, std::shared_ptr<X11WindowedQPainterOutput>> m_outputs;
......
......@@ -13,7 +13,6 @@
#include "egl_x11_backend.h"
#include "logging.h"
#include "scene_qpainter_x11_backend.h"
#include "screens.h"
#include "session.h"
#include "utils/xcbutils.h"
#include "wayland_server.h"
......@@ -516,7 +515,7 @@ void X11WindowedBackend::handleClientMessage(xcb_client_message_event_t *event)
Q_EMIT outputDisabled(removedOutput);
Q_EMIT outputRemoved(removedOutput);
delete removedOutput;
QMetaObject::invokeMethod(screens(), "updateCount");
Q_EMIT screensQueried();
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment