-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cursor events on screen lock/unlock #8374
base: master
Are you sure you want to change the base?
Conversation
sway/input/cursor.c
Outdated
@@ -63,6 +63,11 @@ struct sway_node *node_at_coords( | |||
} | |||
} | |||
|
|||
if (server.session_lock.lock) { | |||
*surface = server.session_lock.lock->focused; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
focused
represents the keyboard focus, but this codepath is about the pointer. Moreover, the surface-local coordinates sx
/sy
are left unset.
The session lock surfaces are added to output->layers.session_lock
, so I wonder why this doesn't work?
cc @Nefsen402
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last time I checked, when screen is just locked(without any cursor movement), node_at_coords
would get a WLR_SCENE_NODE_RECT
instead of a WLR_SCENE_NODE_BUFFER
, which is probably the red surface created to show when session lock crashed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related: #8343
Maybe wlr_scene_node_at
can only get the lock surface after it's committed(not mapped)?
It seems that during |
Hmm, this is a bit of an event ordering issue with The order of events here is:
Dealing with this would require an "initial commit" sort of commit handler... :/ |
8ae2b1b
to
a394522
Compare
@kennylevinsen
Though we still need |
I've been pondering for a while if we should get rid of all the cursor rebase stuff and add some sort of callback or just go through with |
It could be useful, but there are some caveats. One is that the effect of Another is that, even if scene have a helper, there should preferably still be a way for compositors to do things on their own. |
a394522
to
8eed156
Compare
It seems that Labwc has a fix for the same problem: labwc/labwc#1858 |
8eed156
to
6cd51ff
Compare
Just fixed another edge case. I think this PR is ready. |
Gentle ping. |
See labwc/labwc#1858 Delay refocus operations because only the role-specific surface commit/map handler has been processed in wlroots at this moment and node_at_coords returns the WLR_SCENE_NODE_RECT as a buffer has not been actually attached to the surface.
199e59e
to
814e88e
Compare
Any update on this? @emersion @kennylevinsen @Nefsen402 |
In general the approach of delaying the focus updates are more of a workaround than a proper fix. However it's not clear what the proper fix could look like. |
How about: #8374 (comment) |
Before this commit, if the cursor is at screen center, and the lock is swaylock, the cursor would be at swaylock's subsurface(the indicator). Since it's not the lock surface, `handle_rebase` would refuse to rebase the cursor to there. Thereby the cursor enter event won't be sent to swaylock. This commit fix the issue.
814e88e
to
97c2204
Compare
After the scene graph refactor, node_at_coords no longer return the lock surface after the screen is locked, thereby cursor_rebase_all in handle_surface_map won't work.
This commit make node_at_coords return lock surface when locked.
I also found that the cursor would disappear after screen is unlocked, thereby adding a cursor_rebase_all in handle_unlock.