Delay setPrimaryOutputName on X11 nativeeventfilter

if we do immediately setPrimaryOutputName, the name is still :0.0
because the app didn't have time to react yet (since here we are in the event filter,
we are just before that by definition) so the output name can still be wrong.

when we go from no outputs to one, at this point the name of the one QScreen
instane is still wrong :0.0 which will be renamed right after.

BUG:447936
wilder-5.24
Marco Martin 4 years ago
parent 7aacf049ef
commit 9c04d56236
  1. 5
      shell/primaryoutputwatcher.cpp

@ -18,6 +18,7 @@
#include <config-plasma.h>
#if HAVE_X11
#include <QTimer> //Used only in x11 case
#include <QX11Info>
#include <xcb/randr.h>
#include <xcb/xcb.h>
@ -122,7 +123,9 @@ bool PrimaryOutputWatcher::nativeEventFilter(const QByteArray &eventType, void *
const auto responseType = XCB_EVENT_RESPONSE_TYPE(ev);
if (responseType == m_xrandrExtensionOffset + XCB_RANDR_SCREEN_CHANGE_NOTIFY) {
setPrimaryOutputName(qGuiApp->primaryScreen()->name());
QTimer::singleShot(0, this, [this]() {
setPrimaryOutputName(qGuiApp->primaryScreen()->name());
});
}
#endif
return false;

Loading…
Cancel
Save