Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] session: Add "Abort" button to select WM dialog #181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions lxqt-session/src/lxqtmodman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ void LXQtModuleManager::startup(LXQt::Settings& s)
startConfUpdate();

// Start window manager
startWm(&s);
if (!startWm(&s))
return;

startAutostartApps();

Expand Down Expand Up @@ -175,14 +176,14 @@ void LXQtModuleManager::themeChanged()
}
}

void LXQtModuleManager::startWm(LXQt::Settings *settings)
bool LXQtModuleManager::startWm(LXQt::Settings *settings)
{
// if the WM is active do not run WM.
// all window managers must set their name according to the spec
if (!QString::fromUtf8(NETRootInfo(QX11Info::connection(), NET::SupportingWMCheck).wmName()).isEmpty())
{
mWmStarted = true;
return;
return true;
}

if (mWindowManager.isEmpty())
Expand All @@ -194,6 +195,8 @@ void LXQtModuleManager::startWm(LXQt::Settings *settings)
if (mWindowManager.isEmpty() || ! findProgram(mWindowManager.split(QL1C(' '))[0]))
{
mWindowManager = showWmSelectDialog();
if (mWindowManager.isEmpty())
return false;
settings->setValue(QL1S("window_manager"), mWindowManager);
settings->sync();
}
Expand Down Expand Up @@ -222,6 +225,7 @@ void LXQtModuleManager::startWm(LXQt::Settings *settings)
// FIXME: blocking is a bad idea. We need to start as many apps as possible and
// only wait for the start of WM when it's absolutely needed.
// Maybe we can add a X-Wait-WM=true key in the desktop entry file?
return true;
}

void LXQtModuleManager::startProcess(const XdgDesktopFile& file)
Expand Down Expand Up @@ -395,7 +399,11 @@ QString LXQtModuleManager::showWmSelectDialog()

WmSelectDialog dlg(availableWM);
dlg.exec();
return dlg.windowManager();
if (dlg.result() == QDialog::Accepted)
return dlg.windowManager();

QCoreApplication::exit(1);
return QString{};
}

void LXQtModuleManager::resetCrashReport()
Expand Down
2 changes: 1 addition & 1 deletion lxqt-session/src/lxqtmodman.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public slots:

private:
//! \brief Start Window Manager
void startWm(LXQt::Settings *settings);
bool startWm(LXQt::Settings *settings);
void wmStarted();

void startAutostartApps();
Expand Down
3 changes: 2 additions & 1 deletion lxqt-session/src/wmselectdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <QApplication>
#include <QCloseEvent>
#include <QFileDialog>
#include <QPushButton>
#include <QDebug>

#define TYPE_ROLE Qt::UserRole + 1
Expand Down Expand Up @@ -136,5 +137,5 @@ void WmSelectDialog::selectFileDialog(const QModelIndex &/*index*/)
void WmSelectDialog::changeBtnStatus(const QModelIndex &/*index*/)
{
QString wm = windowManager();
ui->buttonBox->setEnabled(!wm.isEmpty() && findProgram(wm));
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!wm.isEmpty() && findProgram(wm));
}
2 changes: 1 addition & 1 deletion lxqt-session/src/wmselectdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Abort|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
Expand Down