backends/x11: Start reading host X11 events in initialize()
There's no reason to wait until the workspace is created.
This commit is contained in:
parent
28baea1c29
commit
b4441cd502
2 changed files with 14 additions and 17 deletions
|
@ -196,7 +196,7 @@ bool X11WindowedBackend::initialize()
|
||||||
initXInput();
|
initXInput();
|
||||||
XRenderUtils::init(m_connection, m_screen->root);
|
XRenderUtils::init(m_connection, m_screen->root);
|
||||||
createOutputs();
|
createOutputs();
|
||||||
connect(kwinApp(), &Application::workspaceCreated, this, &X11WindowedBackend::startEventReading);
|
|
||||||
m_pointerDevice = std::make_unique<X11WindowedInputDevice>();
|
m_pointerDevice = std::make_unique<X11WindowedInputDevice>();
|
||||||
m_pointerDevice->setPointer(true);
|
m_pointerDevice->setPointer(true);
|
||||||
m_keyboardDevice = std::make_unique<X11WindowedInputDevice>();
|
m_keyboardDevice = std::make_unique<X11WindowedInputDevice>();
|
||||||
|
@ -205,6 +205,19 @@ bool X11WindowedBackend::initialize()
|
||||||
m_touchDevice = std::make_unique<X11WindowedInputDevice>();
|
m_touchDevice = std::make_unique<X11WindowedInputDevice>();
|
||||||
m_touchDevice->setTouch(true);
|
m_touchDevice->setTouch(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_eventNotifier = std::make_unique<QSocketNotifier>(xcb_get_file_descriptor(m_connection), QSocketNotifier::Read);
|
||||||
|
auto processXcbEvents = [this] {
|
||||||
|
while (auto event = xcb_poll_for_event(m_connection)) {
|
||||||
|
handleEvent(event);
|
||||||
|
free(event);
|
||||||
|
}
|
||||||
|
xcb_flush(m_connection);
|
||||||
|
};
|
||||||
|
connect(m_eventNotifier.get(), &QSocketNotifier::activated, this, processXcbEvents);
|
||||||
|
connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, processXcbEvents);
|
||||||
|
connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, processXcbEvents);
|
||||||
|
|
||||||
Q_EMIT outputsQueried();
|
Q_EMIT outputsQueried();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -282,21 +295,6 @@ void X11WindowedBackend::createOutputs()
|
||||||
xcb_flush(m_connection);
|
xcb_flush(m_connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void X11WindowedBackend::startEventReading()
|
|
||||||
{
|
|
||||||
m_eventNotifier = std::make_unique<QSocketNotifier>(xcb_get_file_descriptor(m_connection), QSocketNotifier::Read);
|
|
||||||
auto processXcbEvents = [this] {
|
|
||||||
while (auto event = xcb_poll_for_event(m_connection)) {
|
|
||||||
handleEvent(event);
|
|
||||||
free(event);
|
|
||||||
}
|
|
||||||
xcb_flush(m_connection);
|
|
||||||
};
|
|
||||||
connect(m_eventNotifier.get(), &QSocketNotifier::activated, this, processXcbEvents);
|
|
||||||
connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, processXcbEvents);
|
|
||||||
connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, processXcbEvents);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if HAVE_X11_XINPUT
|
#if HAVE_X11_XINPUT
|
||||||
|
|
||||||
static inline qreal fixed1616ToReal(FP1616 val)
|
static inline qreal fixed1616ToReal(FP1616 val)
|
||||||
|
|
|
@ -142,7 +142,6 @@ Q_SIGNALS:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createOutputs();
|
void createOutputs();
|
||||||
void startEventReading();
|
|
||||||
void grabKeyboard(xcb_timestamp_t time);
|
void grabKeyboard(xcb_timestamp_t time);
|
||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
void handleEvent(xcb_generic_event_t *event);
|
void handleEvent(xcb_generic_event_t *event);
|
||||||
|
|
Loading…
Reference in a new issue