xcb: fix unresponsive mouse clicks after VT switch

This patch amends d67214302f.

The issue was caused by mistakenly interchanging
m_hasXRender <-> m_hasXRandr. Also renamed
selectXRandrEvents() -> xrandrSelectEvents() to be more
consistent with xi2Select*() API. And moved the xrandrSelectEvents()
to QXcbConnection ctor for the same reason.

Fixes: QTBUG-71305
Change-Id: I26f9bac3ae1f997f53134eb97f3569fb6d3c13fe
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Gatis Paeglis 2018-10-24 11:11:21 +02:00
parent 88fe7c8cad
commit 8e1c807628
4 changed files with 8 additions and 7 deletions

View File

@ -105,6 +105,9 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
m_xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toLower();
if (hasXRandr())
xrandrSelectEvents();
initializeScreens();
#if QT_CONFIG(xcb_xinput)

View File

@ -250,7 +250,7 @@ protected:
bool event(QEvent *e) override;
private:
void selectXRandrEvents();
void xrandrSelectEvents();
QXcbScreen* findScreenForCrtc(xcb_window_t rootWindow, xcb_randr_crtc_t crtc) const;
QXcbScreen* findScreenForOutput(xcb_window_t rootWindow, xcb_randr_output_t output) const;
QXcbVirtualDesktop* virtualDesktopForRootWindow(xcb_window_t rootWindow) const;

View File

@ -308,7 +308,7 @@ void QXcbBasicConnection::initializeXRandr()
return;
}
m_hasXRender = true;
m_hasXRandr = true;
m_xrenderVersion.first = xrenderQuery->major_version;
m_xrenderVersion.second = xrenderQuery->minor_version;
#endif
@ -358,7 +358,7 @@ void QXcbBasicConnection::initializeXRender()
return;
}
m_hasXRandr = true;
m_hasXRender = true;
m_xrandrFirstEvent = reply->first_event;
}

View File

@ -46,7 +46,7 @@
#include <xcb/xinerama.h>
void QXcbConnection::selectXRandrEvents()
void QXcbConnection::xrandrSelectEvents()
{
xcb_screen_iterator_t rootIter = xcb_setup_roots_iterator(setup());
for (; rootIter.rem; xcb_screen_next(&rootIter)) {
@ -270,8 +270,6 @@ void QXcbConnection::destroyScreen(QXcbScreen *screen)
void QXcbConnection::initializeScreens()
{
selectXRandrEvents();
xcb_screen_iterator_t it = xcb_setup_roots_iterator(setup());
int xcbScreenNumber = 0; // screen number in the xcb sense
QXcbScreen *primaryScreen = nullptr;
@ -284,7 +282,7 @@ void QXcbConnection::initializeScreens()
QXcbVirtualDesktop *virtualDesktop = new QXcbVirtualDesktop(this, xcbScreen, xcbScreenNumber);
m_virtualDesktops.append(virtualDesktop);
QList<QPlatformScreen *> siblings;
if (hasXRender()) {
if (hasXRandr()) {
// RRGetScreenResourcesCurrent is fast but it may return nothing if the
// configuration is not initialized wrt to the hardware. We should call
// RRGetScreenResources in this case.