Commit ceb80248 authored by Sebastian Kügler's avatar Sebastian Kügler
Browse files

clean up osd more aggressively

in particular, hide OSD when the secondary display is unplugged
before the dialog is dismissed.
parent 0dfb1d77
......@@ -218,10 +218,12 @@ void KScreenDaemon::applyOsdAction(KScreen::OsdAction *self, KScreen::OsdAction:
void KScreenDaemon::applyIdealConfig()
{
if (m_monitoredConfig->connectedOutputs().count() < 2) {
KScreen::OsdManager::self()->hideOsd();
doApplyConfig(Generator::self()->idealConfig(m_monitoredConfig));
} else {
qCDebug(KSCREEN_KDED) << "Getting ideal config from user...";
qCDebug(KSCREEN_KDED) << "Getting ideal config from user via OSD...";
auto action = KScreen::OsdManager::self()->showActionSelector();
connect(action, &KScreen::OsdAction::selected,
this, &KScreenDaemon::applyOsdAction);
......
......@@ -63,8 +63,7 @@ OsdManager::OsdManager(QObject *parent)
m_cleanupTimer->setInterval(60000);
m_cleanupTimer->setSingleShot(true);
connect(m_cleanupTimer, &QTimer::timeout, this, [this]() {
qDeleteAll(m_osds);
m_osds.clear();
hideOsd();
});
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.kscreen.osdService"));
if (!QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/kscreen/osdService"), this, QDBusConnection::ExportAllSlots)) {
......@@ -72,6 +71,12 @@ OsdManager::OsdManager(QObject *parent)
}
}
void OsdManager::hideOsd()
{
qDeleteAll(m_osds);
m_osds.clear();
}
OsdManager::~OsdManager()
{
}
......@@ -146,8 +151,7 @@ void OsdManager::showOsd(const QString& icon, const QString& text)
OsdAction *OsdManager::showActionSelector()
{
qDeleteAll(m_osds);
m_osds.clear();
hideOsd();
OsdActionImpl *action = new OsdActionImpl(this);
connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished,
......
......@@ -65,6 +65,7 @@ public:
public Q_SLOTS:
void showOutputIdentifiers();
void showOsd(const QString &icon, const QString &text);
void hideOsd();
OsdAction *showActionSelector();
private:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment