summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2022-07-27 16:34:27 +0200
committerSimon Rettberg2022-07-27 16:34:27 +0200
commit6fdb21b83d8a232376544e1c1015ee2023a94278 (patch)
tree4fcce6a8483da19082df8632fe2355b9ef48337e /src
parentFix msg window overlapping login, fix browser widget resizing (diff)
downloadslxgreeter-6fdb21b83d8a232376544e1c1015ee2023a94278.tar.gz
slxgreeter-6fdb21b83d8a232376544e1c1015ee2023a94278.tar.xz
slxgreeter-6fdb21b83d8a232376544e1c1015ee2023a94278.zip
Warn if X11 is not accelerated/running on llvmpipe
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp62
1 files changed, 42 insertions, 20 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index a7bdb58..525242b 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -302,31 +302,53 @@ QSize MainWindow::createDistro(const QRect &max)
bool MainWindow::createLogWindow()
{
+ // HACK HACK: This doesn't really belong here at all :-/
+ // But we can only check this when X is running, so....
+ QProcess p;
+ p.start(QLatin1String("/usr/bin/glxinfo"), QStringList() << QLatin1String("-B"));
+ p.waitForFinished(1500);
+ QString str = QString::fromLocal8Bit(p.readAllStandardOutput());
+ if (str.contains("Device: llvmpipe") || str.contains("Accelerated: no")) {
+ int i = str.indexOf("Device: ");
+ int j = str.indexOf("\n", i);
+ str = QLatin1String("SLOW Graphics! ") + str.mid(i, j - i);
+ } else {
+ str = "";
+ }
QString path = Settings::logMessageFile();
- if (path.isEmpty())
- return false;
- QFile f(path);
- if (f.size() == 0 || !f.open(QFile::ReadOnly))
+ if (path.isEmpty() && str.isEmpty())
return false;
- m_messages = new QTextEdit(this);
- QTextStream stream(&f);
- const QColor black(Qt::black);
- while (!stream.atEnd()) {
- bool ok = false;
- QString line(stream.readLine());
- int i = line.indexOf(' ');
- if (i > 0) {
- QString scol(line.left(i));
- uint col = scol.toUInt(&ok, 16);
- if (ok) {
- m_messages->setTextColor(QColor(QRgb(col)));
- line = line.mid(i + 1);
+ if (!path.isEmpty()) {
+ QFile f(path);
+ if ((f.size() == 0 || !f.open(QFile::ReadOnly)) && str.isEmpty())
+ return false;
+ m_messages = new QTextEdit(this);
+ QTextStream stream(&f);
+ const QColor black(Qt::black);
+ while (!stream.atEnd()) {
+ bool ok = false;
+ QString line(stream.readLine());
+ int i = line.indexOf(' ');
+ if (i > 0) {
+ QString scol(line.left(i));
+ uint col = scol.toUInt(&ok, 16);
+ if (ok) {
+ m_messages->setTextColor(QColor(QRgb(col)));
+ line = line.mid(i + 1);
+ }
}
+ if (!ok) {
+ m_messages->setTextColor(black);
+ }
+ m_messages->append(line);
}
- if (!ok) {
- m_messages->setTextColor(black);
+ }
+ if (!str.isEmpty()) {
+ if (m_messages == nullptr) {
+ m_messages = new QTextEdit(this);
}
- m_messages->append(line);
+ m_messages->setTextColor(Qt::red);
+ m_messages->append(str);
}
m_messages->setReadOnly(true);
m_messages->setStyleSheet("border:none; background:rgba(255,255,255,.33); border-radius:5px");