Changeset View
Changeset View
Standalone View
Standalone View
shell/screenpool.cpp
Show All 37 Lines | 37 | { | |||
---|---|---|---|---|---|
38 | 38 | | |||
39 | m_configSaveTimer.setSingleShot(true); | 39 | m_configSaveTimer.setSingleShot(true); | ||
40 | connect(&m_configSaveTimer, &QTimer::timeout, this, [this](){ | 40 | connect(&m_configSaveTimer, &QTimer::timeout, this, [this](){ | ||
41 | m_configGroup.sync(); | 41 | m_configGroup.sync(); | ||
42 | }); | 42 | }); | ||
43 | 43 | | |||
44 | #if HAVE_X11 | 44 | #if HAVE_X11 | ||
45 | if (KWindowSystem::isPlatformX11()) { | 45 | if (KWindowSystem::isPlatformX11()) { | ||
46 | qApp->installNativeEventFilter(this); | 46 | qApp->installNativeEventFilter(this); | ||
broulik: How about not installing the event filter in this case in the first place? | |||||
47 | const xcb_query_extension_reply_t* reply = xcb_get_extension_data(QX11Info::connection(), &xcb_randr_id); | 47 | const xcb_query_extension_reply_t* reply = xcb_get_extension_data(QX11Info::connection(), &xcb_randr_id); | ||
48 | if (reply) { | ||||
48 | m_xrandrExtensionOffset = reply->first_event; | 49 | m_xrandrExtensionOffset = reply->first_event; | ||
50 | m_haveXrandr = true; | ||||
51 | } | ||||
49 | } | 52 | } | ||
50 | #endif | 53 | #endif | ||
51 | } | 54 | } | ||
52 | 55 | | |||
53 | void ScreenPool::load() | 56 | void ScreenPool::load() | ||
54 | { | 57 | { | ||
55 | m_primaryConnector = QString(); | 58 | m_primaryConnector = QString(); | ||
56 | m_connectorForId.clear(); | 59 | m_connectorForId.clear(); | ||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Line(s) | 195 | #if HAVE_X11 | |||
193 | // a particular edge case: when we switch the only enabled screen | 196 | // a particular edge case: when we switch the only enabled screen | ||
194 | // we don't have any signal about it, the primary screen changes but we have the same old QScreen* getting recycled | 197 | // we don't have any signal about it, the primary screen changes but we have the same old QScreen* getting recycled | ||
195 | // see https://bugs.kde.org/show_bug.cgi?id=373880 | 198 | // see https://bugs.kde.org/show_bug.cgi?id=373880 | ||
196 | // if this slot will be invoked many times, their//second time on will do nothing as name and primaryconnector will be the same by then | 199 | // if this slot will be invoked many times, their//second time on will do nothing as name and primaryconnector will be the same by then | ||
197 | if (eventType[0] != 'x') { | 200 | if (eventType[0] != 'x') { | ||
198 | return false; | 201 | return false; | ||
199 | } | 202 | } | ||
200 | 203 | | |||
204 | if (!m_haveXrandr) { | ||||
205 | return false; | ||||
206 | } | ||||
207 | | ||||
201 | xcb_generic_event_t *ev = static_cast<xcb_generic_event_t *>(message); | 208 | xcb_generic_event_t *ev = static_cast<xcb_generic_event_t *>(message); | ||
202 | 209 | | |||
203 | const auto responseType = XCB_EVENT_RESPONSE_TYPE(ev); | 210 | const auto responseType = XCB_EVENT_RESPONSE_TYPE(ev); | ||
204 | 211 | | |||
205 | 212 | | |||
206 | if (responseType == m_xrandrExtensionOffset + XCB_RANDR_SCREEN_CHANGE_NOTIFY) { | 213 | if (responseType == m_xrandrExtensionOffset + XCB_RANDR_SCREEN_CHANGE_NOTIFY) { | ||
207 | if (qGuiApp->primaryScreen()->name() != primaryConnector()) { | 214 | if (qGuiApp->primaryScreen()->name() != primaryConnector()) { | ||
208 | //new screen? | 215 | //new screen? | ||
Show All 14 Lines |
How about not installing the event filter in this case in the first place?