sway
sway copied to clipboard
layer-shell surfaces aren't capable of constraining the pointer.
Hello there, let me start by saying this is a very exciting time to be getting aware of sway! I went through the code and is very well written! nice!
I am an experienced Linux user and I am finally trying to move away from X11 on all my devices after realizing how better things are with wayland/sway.
While trying to mush wlroots examples together, I realized the layer-shell example doesn't go well with the pointer-constraint protocol. What I would like to do is to be able to lock the cursor if it goes beyond the viewport, and subsequently release it.
I tried various approaches on how to circumvent the problem but I was finally able to make the both nonstandard protocols work together when I removed this if
statement on sway/input/cursor.c
: https://github.com/swaywm/sway/blob/master/sway/input/cursor.c#L1294
I looks like overlays never have the "proper focus"... Is this a bug, or intentionally designed? Would I be able to constrain the cursor into an overlay in a different way?
We could extend the check in handle_pointer_constraint
to lookup seat->focused_layer
in addition to seat_get_focus
.
Or introduce a new seat_get_focus_surface
that returns a wlr_surface
to simplify our logic.
I came across this behavior when trying to implement a virtual KVM using wlr-virtual-pointer-unstable-v1
, virtual-keyboard-unstable
, wlr-layer-shell-unstable-v1
and pointer-constraints-unstable-v1
. Essentially making 1px wide windows on screen borders, detecting pointer enter and then locking pointer and emitting all captured pointer movement and keyboard movement to a connected device until a 1px window gets in focus on that side. However I could not get the pointer locked on the 1px layer surface I had possibly due to this behavior.
I'll try make a PR adding support for this case so that this topic can be discussed about with concrete runnable code and possibly even merged :)
I came across this behavior when trying to implement a virtual KVM using
wlr-virtual-pointer-unstable-v1
,virtual-keyboard-unstable
,wlr-layer-shell-unstable-v1
andpointer-constraints-unstable-v1
. Essentially making 1px wide windows on screen borders, detecting pointer enter and then locking pointer and emitting all captured pointer movement and keyboard movement to a connected device until a 1px window gets in focus on that side. However I could not get the pointer locked on the 1px layer surface I had possibly due to this behavior. I'll try make a PR adding support for this case so that this topic can be discussed about with concrete runnable code and possibly even merged :)
I tried to do the same thing and here we are ... Any updates on this?