[User Switcher] Ungrab keyboard before trying to lock the screen

Otherwise it fails to lock the screen and since it waits for the lock screen to show up before switching, it never does it.

BUG: 375941
FIXED-IN: 5.9.1

Differential Revision: https://phabricator.kde.org/D4470
wilder-5.14
Kai Uwe Broulik 9 years ago
parent a0374d8fff
commit 8bf479e358
  1. 4
      components/sessionsprivate/sessionsmodel.cpp
  2. 1
      components/sessionsprivate/sessionsmodel.h
  3. 7
      ksmserver/switchuserdialog.cpp
  4. 3
      ksmserver/switchuserdialog.h
  5. 3
      lookandfeel/contents/userswitcher/UserSwitcher.qml

@ -98,6 +98,8 @@ void SessionsModel::switchUser(int vt, bool shouldLock)
} else {
m_pendingReserve = false;
m_pendingVt = vt;
emit aboutToLockScreen();
m_screensaverInterface->Lock();
}
});
@ -123,6 +125,8 @@ void SessionsModel::startNewSession(bool shouldLock)
} else {
m_pendingReserve = true;
m_pendingVt = 0;
emit aboutToLockScreen();
m_screensaverInterface->Lock();
}
});

@ -95,6 +95,7 @@ signals:
void switchedUser(int vt);
void startedNewSession();
void aboutToLockScreen();
private:
void checkScreenLocked(const std::function<void (bool)> &cb);

@ -112,6 +112,7 @@ void KSMSwitchUserDialog::init()
}
connect(rootObject(), SIGNAL(dismissed()), this, SIGNAL(dismissed()));
connect(rootObject(), SIGNAL(ungrab()), this, SLOT(ungrab()));
connect(screen(), &QScreen::geometryChanged, this, [this] {
setGeometry(screen()->geometry());
@ -122,6 +123,7 @@ void KSMSwitchUserDialog::init()
KWindowSystem::setState(winId(), NET::SkipTaskbar|NET::SkipPager);
// in case you change this make sure to adjust ungrab() also
setKeyboardGrabEnabled(true);
}
@ -163,3 +165,8 @@ void KSMSwitchUserDialog::setupWaylandIntegration()
// maybe we need a dedicated type for it?
m_shellSurface->setPosition(geometry().topLeft());
}
void KSMSwitchUserDialog::ungrab()
{
setKeyboardGrabEnabled(false);
}

@ -50,6 +50,9 @@ signals:
protected:
bool event(QEvent *e) override;
private slots:
void ungrab();
private:
void setupWaylandIntegration();

@ -33,6 +33,7 @@ PlasmaCore.ColorScope {
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
signal dismissed
signal ungrab
height:screenGeometry.height
width: screenGeometry.width
@ -52,6 +53,8 @@ PlasmaCore.ColorScope {
// returned leaving us do nothing (Bug 356945)
onStartedNewSession: root.dismissed()
onSwitchedUser: root.dismissed()
onAboutToLockScreen: root.ungrab()
}
Controls.Action {

Loading…
Cancel
Save