mirror of
https://github.com/debauchee/barrier.git
synced 2026-06-30 08:56:21 +08:00
fixed handling of jumping to primary when screen saver starts
and back to secondary when it stops. also now redirecting keyboard input to root window when screen saver starts; this allows the user to type in the lock dialog and also effectively discards any input used to deactivate the screen saver.
This commit is contained in:
@@ -323,20 +323,27 @@ CXWindowsPrimaryScreen::close()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::enter(SInt32 x, SInt32 y)
|
||||
CXWindowsPrimaryScreen::enter(SInt32 x, SInt32 y, bool forScreenSaver)
|
||||
{
|
||||
log((CLOG_INFO "entering primary at %d,%d", x, y));
|
||||
log((CLOG_INFO "entering primary at %d,%d%s", x, y, forScreenSaver ? " for screen saver" : ""));
|
||||
assert(m_active == true);
|
||||
assert(m_window != None);
|
||||
|
||||
CDisplayLock display(this);
|
||||
|
||||
// warp to requested location
|
||||
XWarpPointer(display, None, m_window, 0, 0, 0, 0, x, y);
|
||||
if (!forScreenSaver) {
|
||||
XWarpPointer(display, None, m_window, 0, 0, 0, 0, x, y);
|
||||
}
|
||||
|
||||
// unmap the grab window. this also ungrabs the mouse and keyboard.
|
||||
XUnmapWindow(display, m_window);
|
||||
|
||||
// redirect input to root window
|
||||
if (forScreenSaver) {
|
||||
XSetInputFocus(display, PointerRoot, PointerRoot, CurrentTime);
|
||||
}
|
||||
|
||||
// remove all input events for grab window
|
||||
XEvent event;
|
||||
while (XCheckWindowEvent(display, m_window,
|
||||
|
||||
Reference in New Issue
Block a user