summaryrefslogtreecommitdiffstats
path: root/src/widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widget.cpp')
-rw-r--r--src/widget.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index 49e5285..85aacea 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -176,9 +176,13 @@ Widget::Widget(QWidget *parent) :
// TODO: GUI feedback
} else {
// GUI popup logic
- connect(Bus::inst(), &Bus::serviceConnected, [=]() {
+ connect(Bus::inst(), &Bus::serviceConnected, [=](bool isSession) {
qDebug() << "\\o/ Received DBus connect notification \\o/";
- popupGui();
+ if (isSession) { // Session bus means user triggered, show immediately
+ this->show();
+ } else { // Otherwise, systembus means udev event -- take normal route
+ popupGui();
+ }
});
}
// Xlib
@@ -506,17 +510,13 @@ bool Widget::keepResolution()
continue;
// Show a dialog asking if the res should be kept
TimeOutDialog *keepDialog = new TimeOutDialog(15, this);
- //keepDialog->setWindowModality(Qt::WindowModal);
- keepDialog->setWindowTitle(" ");
- keepDialog->setLabelText(trUtf8("Do you want to keep this resolution?"));
- keepDialog->setCancelButtonText(trUtf8("Keep"));
- keepDialog->setWindowFlag(Qt::WindowStaysOnTopHint, true);
QSize s = (geo.size() - keepDialog->size()) / 2;
QPoint tl = geo.topLeft();
tl.rx() += s.width();
tl.ry() += s.height();
keepDialog->move(tl);
keepDialog->show();
+ keepDialog->move(tl);
list.append(keepDialog);
}
@@ -526,10 +526,12 @@ bool Widget::keepResolution()
active = true;
QCoreApplication::processEvents();
for (auto win : list) {
- active = active && win->isActive();
- wasCanceled = wasCanceled || win->wasCanceled();
+ if (!win->isActive()) {
+ active = false;
+ wasCanceled = win->wasCanceled();
+ }
}
- } while (active && !wasCanceled);
+ } while (active);
for (auto win : list) {
win->deleteLater();