diff --git a/shell/screenpool.h b/shell/screenpool.h --- a/shell/screenpool.h +++ b/shell/screenpool.h @@ -65,6 +65,7 @@ QHash m_idForConnector; QTimer m_configSaveTimer; + int m_xrandrExtensionOffset; }; #endif // SCREENPOOL_H diff --git a/shell/screenpool.cpp b/shell/screenpool.cpp --- a/shell/screenpool.cpp +++ b/shell/screenpool.cpp @@ -40,6 +40,9 @@ connect(&m_configSaveTimer, &QTimer::timeout, this, [this](){ m_configGroup.sync(); }); + + const xcb_query_extension_reply_t* reply = xcb_get_extension_data(QX11Info::connection(), &xcb_randr_id); + m_xrandrExtensionOffset = reply->first_event; } void ScreenPool::load() @@ -185,9 +188,8 @@ const auto responseType = XCB_EVENT_RESPONSE_TYPE(ev); - const xcb_query_extension_reply_t* reply = xcb_get_extension_data(QX11Info::connection(), &xcb_randr_id); - if (responseType == reply->first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY) { + if (responseType == m_xrandrExtensionOffset + XCB_RANDR_SCREEN_CHANGE_NOTIFY) { if (qGuiApp->primaryScreen()->name() != primaryConnector()) { //new screen? if (id(qGuiApp->primaryScreen()->name()) < 0) {