Show notification when pointer gets confined/locked

Summary: Inform user how the pointer constraint can be ended.

Reviewers: #plasma, #kwin

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3780
This commit is contained in:
Martin Gräßlin 2016-12-21 19:55:48 +01:00
parent 444ce02d8d
commit 696ce96e9b

View file

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "platform.h"
#include "effects.h"
#include "input_event.h"
#include "osd.h"
#include "screens.h"
#include "shell_client.h"
#include "wayland_cursor_theme.h"
@ -41,6 +42,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// screenlocker
#include <KScreenLocker/KsldApp>
#include <KLocalizedString>
#include <QHoverEvent>
#include <QWindow>
// Wayland
@ -596,7 +599,9 @@ void PointerInputRedirection::enablePointerConstraints()
}
}
);
// TODO: show notification
OSD::show(i18nc("notification about mouse pointer confined",
"Pointer motion confined to the current window.\nTo release pointer hold Escape for 3 seconds."),
QStringLiteral("preferences-desktop-mouse"), 5000);
return;
}
} else {
@ -611,7 +616,9 @@ void PointerInputRedirection::enablePointerConstraints()
if (r.contains(m_pos.toPoint())) {
lock->setLocked(true);
m_locked = true;
// TODO: show notification
OSD::show(i18nc("notification about mouse pointer locked",
"Pointer locked to current position.\nTo end pointer lock hold Escape for 3 seconds."),
QStringLiteral("preferences-desktop-mouse"), 5000);
// TODO: connect to region change - is it needed at all? If the pointer is locked it's always in the region
}
}