mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-26 06:14:45 +00:00
kscreen: Make async calls and nullptr check
Don't block plasmashell when doing kscreen calls (make them async). Also add a nullptr check to rotationplugin, which potentially could be a fix for crashes on the PinePhone.
This commit is contained in:
parent
a74fa5593b
commit
ca79509706
2 changed files with 12 additions and 9 deletions
|
|
@ -56,6 +56,9 @@ RotationUtil::RotationUtil(QObject *parent)
|
||||||
{
|
{
|
||||||
connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, [this](auto *op) {
|
connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, [this](auto *op) {
|
||||||
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
||||||
|
if (!m_config) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
KScreen::ConfigMonitor::instance()->addConfig(m_config);
|
KScreen::ConfigMonitor::instance()->addConfig(m_config);
|
||||||
|
|
||||||
// update all screens with event connect
|
// update all screens with event connect
|
||||||
|
|
@ -95,9 +98,9 @@ void RotationUtil::rotateToSuggestedRotation()
|
||||||
}
|
}
|
||||||
|
|
||||||
auto setop = new KScreen::SetConfigOperation(m_config, this);
|
auto setop = new KScreen::SetConfigOperation(m_config, this);
|
||||||
setop->exec();
|
connect(setop, &KScreen::SetConfigOperation::finished, this, [this]() {
|
||||||
|
|
||||||
updateShowRotationButton();
|
updateShowRotationButton();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RotationUtil::showRotationButton() const
|
bool RotationUtil::showRotationButton() const
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ void ScreenRotationUtil::actuallySetAutoScreenRotationEnabled(bool value)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto setop = new KScreen::SetConfigOperation(m_config, this);
|
auto setop = new KScreen::SetConfigOperation(m_config, this);
|
||||||
setop->exec();
|
connect(setop, &KScreen::SetConfigOperation::finished, this, [this]() {
|
||||||
|
|
||||||
Q_EMIT autoScreenRotationEnabledChanged();
|
Q_EMIT autoScreenRotationEnabledChanged();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue