summaryrefslogtreecommitdiffstats
path: root/src/dialog.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2019-07-04 15:04:58 +0200
committerSimon Rettberg2019-07-04 15:04:58 +0200
commit65a4fff11c84c886bce97e103f6177becd34c879 (patch)
treefd0e639b21c1663f73db05b683b192ac2d6cc7b5 /src/dialog.cpp
parentGive 'last lectures' a section as it's expected everywhere (diff)
downloadvmchooser2-65a4fff11c84c886bce97e103f6177becd34c879.tar.gz
vmchooser2-65a4fff11c84c886bce97e103f6177becd34c879.tar.xz
vmchooser2-65a4fff11c84c886bce97e103f6177becd34c879.zip
Change WM spawning once again to hopefully fix invisible chooser
Now we wait until the chooser window is actually visible and only then try to spawn openbox. This leads to the problem of vmchooser not having focus in case we really didn't have a WM before. For that reason, try to give focus to vmchooser again by calling wmctrl...........
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r--src/dialog.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 56860f2..a0b9a47 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -29,9 +29,6 @@ static bool isProcessRunning(const QString &binary);
Dialog::Dialog(QWidget *parent)
: QDialog(parent), ui(new Ui::Dialog) {
- // Make sure a window manager is running, so any modals or other popups work properly
- WindowManager::ensureRunning();
-
model_[TAB_NATIVE] = new SessionTreeModel(parent);
model_[TAB_RECENT_COURSES] = new SessionTreeModel(parent, true);
model_[TAB_ALL_VMS] = new SessionTreeModel(parent);
@@ -732,7 +729,7 @@ void Dialog::onTabButtonChanged(int tab) {
}
// Update pressed status of buttons
- for (int i = 0; i < 3; ++i) {
+ for (int i = 0; i < TAB_COUNT; ++i) {
tabs_[i]->setChecked(tab == i);
}
@@ -871,6 +868,7 @@ void Dialog::selectFirstElement() {
QModelIndex newIndex = QModelIndex(model_[activeTab_]->index(0, 0, section));
ui->treeView->selectionModel()->setCurrentIndex(newIndex, QItemSelectionModel::Select);
+
ui->treeView->setFocus();
}
@@ -917,6 +915,15 @@ void Dialog::checkAutostart() {
}
}
+void Dialog::showEvent(QShowEvent *e)
+{
+ QDialog::showEvent(e);
+ // Make sure a window manager is running, so any modals or other popups work properly
+ QTimer::singleShot(10, []() {
+ WindowManager::ensureRunning();
+ });
+}
+
static bool isProcessRunning(const QString &binary)
{
bool full = binary.contains('/');