summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp51
1 files changed, 28 insertions, 23 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 769c570..ece6b87 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -36,7 +36,7 @@ static inline int size(const QRect& r)
int main(int argc, char *argv[])
{
//dup2(2, 1)
- // I have no idea why, but Qt's stock qDebug() output never makes it
+ // I have no idea why, but Qt's stock qWarning() output never makes it
// to /var/log/lightdm/x-0-greeter.log, so we use std::cerr instead..
qInstallMessageHandler(messageHandler);
@@ -55,28 +55,34 @@ int main(int argc, char *argv[])
entire = QImage(desktopSize, QImage::Format_RGB32);
QPainter painter(&entire);
+ const bool testMode = argc > 1 && QString(argv[1]) == QString("--test");
+
// Get a list of non-overlapping screens, as this might lead to a broken
// greeter with main windows covering other login forms
QMap<int, QRect> screens;
- for (int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
- QRect r = QApplication::desktop()->screenGeometry(i);
- QMutableMapIterator<int, QRect>it(screens);
- while (it.hasNext()) {
- it.next();
- if (!it.value().intersects(r))
- continue;
- // Overlap, bigger wins
- if (size(it.value()) >= size(r)) {
- // Existing is bigger
- goto skip_rect;
- }
- // New is bigger, remove existing and keep going
- it.remove();
- }
- // We reached here, so add new window
- screens.insert(i, r);
- skip_rect: ; // Do nothing
- }
+ if (testMode) {
+ screens.insert(0, QRect(0, 0, 1024, 768));
+ } else {
+ for (int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
+ QRect r = QApplication::desktop()->screenGeometry(i);
+ QMutableMapIterator<int, QRect>it(screens);
+ while (it.hasNext()) {
+ it.next();
+ if (!it.value().intersects(r))
+ continue;
+ // Overlap, bigger wins
+ if (size(it.value()) >= size(r)) {
+ // Existing is bigger
+ goto skip_rect;
+ }
+ // New is bigger, remove existing and keep going
+ it.remove();
+ }
+ // We reached here, so add new window
+ screens.insert(i, r);
+ skip_rect: ; // Do nothing
+ }
+ }
// Determine primary screen
int primary;
if (screens.contains(QApplication::desktop()->primaryScreen())) {
@@ -87,8 +93,7 @@ int main(int argc, char *argv[])
primary = screens.begin().key();
}
- // Now set up all the screens
- bool testMode = argc > 1 && QString(argv[1]) == QString("--test");
+ // Now set up all the screens
MainWindow *focusWindow = 0;
QMapIterator<int, QRect> it(screens);
while (it.hasNext()) {
@@ -105,7 +110,7 @@ int main(int argc, char *argv[])
}
if (!entire.isNull()) {
- qDebug() << "Setting x background";
+ qWarning() << "Setting x background";
AddPixmapToBackground(entire.constBits(), entire.width(), entire.height(), 24, entire.bytesPerLine(), entire.byteCount());
}