Skip to content
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

Implement ext-session-lock-v1 #6879

Merged
merged 1 commit into from
Apr 29, 2022
Merged

Conversation

danieldg
Copy link
Contributor

@danieldg danieldg commented Mar 9, 2022

This prevents input from bypassing a lockscreen if the lockscreen crashes or has other problems (for example, swaywm/swaylock#204). Swaylock support is already present as of 1.6 (swaywm/swaylock#219).

sway/lock.c Outdated Show resolved Hide resolved
include/sway/lock.h Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
include/sway/lock.h Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/desktop/render.c Outdated Show resolved Hide resolved
Copy link
Member

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch! Here's a first round of comments.

@danieldg danieldg force-pushed the session-lock branch 2 times, most recently from 294c069 to 0149515 Compare March 11, 2022 00:58
sway/lock.c Outdated Show resolved Hide resolved
@danieldg danieldg force-pushed the session-lock branch 2 times, most recently from c2645e0 to 68a3c06 Compare March 12, 2022 16:04
@danieldg
Copy link
Contributor Author

68a3c06 adds support for output resolution changes.

@danieldg
Copy link
Contributor Author

https://github.com/danieldg/sway/tree/lock-scene-graph is a rebase of this on top of #6844 - once that is merged, I'll update the branch this request references.

@L-as
Copy link
Contributor

L-as commented Apr 24, 2022

Just wanted to note that I'm daily-driving https://github.com/danieldg/sway/tree/lock-scene-graph (ae6ff23 right now) with wlroots d3a2ea and it works without any problems at all as far as I've noticed. swaylock works fine too, albeit I haven't tested the functionality of the protocol really.

@L-as
Copy link
Contributor

L-as commented Apr 24, 2022

Thank you @danieldg

@L-as L-as mentioned this pull request Apr 24, 2022
5 tasks
@WhyNotHugo
Copy link
Contributor

Just wanted to note that I'm daily-driving https://github.com/danieldg/sway/tree/lock-scene-graph (ae6ff23 right now) with wlroots d3a2ea and it works without any problems at all as far as I've noticed. swaylock works fine too, albeit I haven't tested the functionality of the protocol really.

I've been using the same version for a while and notice a mildly annoying issue. After unlocking the screen, no window has focus.

Steps to repro:

  • Open a single terminal.
  • Run swaylock on it.
  • Type your password to unlock

At this point, the terminal is unfocused. It seems the only ways to focus it are:

  • Switch to another workspace and back, or...
  • Click on the terminal itself (this is not very practical; my hands are on the keyboard from typing the password, and my next action is to type on the terminal).

@danieldg
Copy link
Contributor Author

@WhyNotHugo:

I've been using the same version for a while and notice a mildly annoying issue. After unlocking the screen, no window has focus.

See if the latest commit on that branch fixes this for you; it more closely matches how the layer-shell/input-manager locking works.

include/sway/server.h Outdated Show resolved Hide resolved
include/sway/lock.h Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/lock.c Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
output_damage_surface(surf->output, 0, 0, surf->surface, false);
}

static void handle_output_mode(struct wl_listener *listener, void *data) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logical size of the output can change even if the mode doesn't, for instance when the scale or transform changes. We should listen for output.events.commit instead and check the committed bitfield in the event struct.

Copy link
Contributor Author

@danieldg danieldg Apr 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to hook that event; I didn't notice that it was the right one due to https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3418.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm right, to work correctly with current wlroots we probably need to listen to both.

sway/desktop/output.c Outdated Show resolved Hide resolved
sway/lock.c Outdated Show resolved Hide resolved
sway/lock.c Show resolved Hide resolved
@danieldg danieldg force-pushed the session-lock branch 2 times, most recently from 13b8112 to 528a72f Compare April 27, 2022 23:54
@danieldg
Copy link
Contributor Author

danieldg commented Apr 27, 2022

I found some additional cases when the input grab would get re-assigned from the screenlock to the desktop, I think c0dd00f covers that now.


struct wlr_session_lock_surface_v1 *lock_surface;
wl_list_for_each(lock_surface, &server.session_lock.lock->surfaces, link) {
if (lock_surface->output != wlr_output)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: missing braces

@emersion
Copy link
Member

Apart from these last two remaining comments, LGTM!

Copy link
Member

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@emersion emersion merged commit 519038a into swaywm:master Apr 29, 2022
@danieldg danieldg deleted the session-lock branch April 29, 2022 14:11
@WhyNotHugo
Copy link
Contributor

I've been using this for a few weeks now and it's pretty solid. The usual glitches that used to appear when unplugging/plugging/resuming are gone. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants