From 65a4fff11c84c886bce97e103f6177becd34c879 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 4 Jul 2019 15:04:58 +0200 Subject: 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........... --- src/dialog.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/dialog.cpp') 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('/'); -- cgit v1.2.3-55-g7522