summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2020-08-07 10:24:22 +0200
committerSimon Rettberg2020-08-07 10:24:22 +0200
commit46b2a99bf2d8882c01e445b7e808e10dae6f6d55 (patch)
tree005dac83a3e49f4b467c438161381b6e70414b5e /src
parentClean up loginform UI (diff)
downloadslxgreeter-46b2a99bf2d8882c01e445b7e808e10dae6f6d55.tar.gz
slxgreeter-46b2a99bf2d8882c01e445b7e808e10dae6f6d55.tar.xz
slxgreeter-46b2a99bf2d8882c01e445b7e808e10dae6f6d55.zip
More agressive delay and retry after screen layout changed
We still sometimes end up with an improper layout after running xrandr on X11 startup. I suspect this is a race condition between xrandr setting the resolutions and scren geometry, and Qt receiving this event too early, still omehow reading stale information when querying X for the current setup. So we now wait 300ms instead of 100, and additionally retry again after a second. If this doesn't fix the issues, the root cause must be something else.
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 50816ec..c25d7df 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -86,8 +86,11 @@ int main(int argc, char *argv[])
QObject::connect(&setupDelay, &QTimer::timeout, []() {
setupScreens();
+ QTimer::singleShot(1000, []() {
+ setupScreens();
+ });
});
- setupDelay.setInterval(100);
+ setupDelay.setInterval(300);
setupDelay.setSingleShot(true);
setupDelay.start();
@@ -119,7 +122,10 @@ int main(int argc, char *argv[])
static void watch(const QScreen *scrn)
{
- QObject::connect(scrn, &QScreen::geometryChanged, [](const QRect &geom) {
+ QObject::connect(scrn, &QScreen::geometryChanged, [](const QRect &) {
+ setupDelay.start();
+ });
+ QObject::connect(scrn, &QScreen::virtualGeometryChanged, [](const QRect &) {
setupDelay.start();
});
}