swaylock
                                
                                 swaylock copied to clipboard
                                
                                    swaylock copied to clipboard
                            
                            
                            
                        Swaylock hangs on typing unless output scale is equal to 1
Versions:
- 1.5.r12.g9d3da72-1
- 1.4 (Arch community repo states that it's 1.5-1 though)
Steps to reproduce:
- Set output scale to 1.25.
- Run WAYLAND_DEBUG=1 swaylock -dwith default config. Output: https://gist.github.com/gmykhailiuta/4945d84bdd60f04784a001e4c6300f14.
- Start typing.
- UI displays "Verifying", "Wrong", or stays empty. Does not react on user input. If password is entered correctly, session gets unlocked.
Notes:
- Works fine on the outputs with scale 1.
- sway version: r6610.2ad14b37-1
- wlroots vresion: 0.12.0.r344.g641c223d-1
There's an option to switch to waylock as a temporary solution.
I ran into this.
As already mentioned above you still can enter the password and unlock the screen, you "just" don't see any input indication, caps-lock warnings or anything but the background color. At least in my case I never saw any hung input indicator. It was always missing.
It also happens with other option sets, e.g. show-failed-attemps will also not work.
I looked more into it:
- using indicator-idle-visibledoes make the indicator show initial, then when you start typing it disappears
- using indicator-radius 100(or similar) fixes this problem and as such is a usable workaround (@gmykhailiuta )
- but setting it to indicator-radius 50does not work?? Butindicator-radius 10does work, same for49and51...?? EDIT: With an output scaling of 2. EDIT: And same for scaling 3. EDIT: 55,56,60,61 also do not work. 62 works?? Also to be clear I tried all this values multiple times.
Interestingly using a indicator-radius with a size which causes that bug (e.g. 50 for me) with a custom font size of > 1 will not cause this bug to appear as far as I can tell.
On the other hand setting a font size of 1 will always make the bug appear.
@rustonaut, workaround with indicator-radius 100 works for me as well. Now I can switch back to swaylock. Thank you!
Here's my current config for reference:
show-failed-attempts
show-keyboard-layout
indicator-caps-lock
color=000000
indicator-radius=100
Tested with output scale factor 1.25
Versions:
- sway 1.5.r12.g9d3da72-1
- swaylock 1.5.r12.g9d3da72-1
- wlroots 0.13.0.r15.g3c5cc02b-1
Hmm the indicator-radius=100 workaround doesn't seem to work for me, with a 1.25 scaled output.
My versions are:
- sway-git r6671.ecfd6879-1
- wlroots-git 0.13.0.r38.g3432ab2b-1
I just realized GitHub or Mail eat a comment from mine:
- 
This also seems to be related to the font/font size, try setting a specific font size, or try alternate radius's. (I sadly forgot what I wrote before, I think it was that setting the font size to <2 will also make the indicator disappear, I can check on it later today/this week. Also setting a custom font size did make it work even with radius's which otherwise didn't work as far as I remember.) 
- 
I did take a look at the code, and that it happens is supper strange, and might not be a bug in swaylock but the rendering library it uses. But without running gdb I can't say for sure. 
@rustonaut, as far as I remember, first time this bug appeared after some wlroots/sway update, presumably after the one described in https://github.com/swaywm/sway/issues/6014. Later on https://github.com/swaywm/sway/issues/6014 was fixed, but swaylock kept misbehaving.
I tried to figure out the cause of this but gave up after a while. Here's my work.
Here's the output of swaylock when I run with a scaling factor of 1:
[1592245.383]  -> [email protected](nil, 0, 0)
[1592245.408]  -> [email protected]()
[1592247.927]  -> [email protected]_buffer_scale(1)
[1592247.963]  -> [email protected](wl_buffer@20, 0, 0)
[1592247.997]  -> [email protected]_buffer(0, 0, 2147483647, 2147483647)
[1592248.042]  -> [email protected]()
[1592248.055]  -> [email protected]()
[1592248.075]  -> [email protected]_buffer_scale(1)
[1592248.095]  -> [email protected](wl_buffer@20, 0, 0)
[1592248.133]  -> [email protected]_buffer(0, 0, 2147483647, 2147483647)
[1592248.170]  -> [email protected]()
[1592248.184]  -> [email protected]()
[1592250.025] [email protected]_id(23)
[1592250.066] [email protected]_id(19)
[1592250.082] [email protected]_id(22)
[1592250.095] [email protected]()
[1592250.109] [email protected]()
[1592250.132] [email protected](129583538)
[1592290.991] [email protected](139542, 129583578, 39, 0)
[1592394.083] [email protected](139543, 129583681, 25, 1)
[1592394.170]  -> [email protected](new id wl_callback@22)
[1592394.197]  -> [email protected]()
[1592395.129] [email protected]_id(22)
[1592395.176] [email protected](129583683)
[1592395.194]  -> [email protected](new id wl_callback@22)
[1592395.212]  -> [email protected]_position(880, 480)
And here's swaylock with a scaling factor of 2:
[1651186.655]  -> [email protected](nil, 0, 0)
[1651186.689]  -> [email protected]()
[1651191.060]  -> [email protected]_buffer_scale(2)
[1651191.097]  -> [email protected](wl_buffer@20, 0, 0)
[1651191.119]  -> [email protected]_buffer(0, 0, 2147483647, 2147483647)
[1651191.141]  -> [email protected]()
[1651191.153]  -> [email protected]()
[1651191.165]  -> [email protected]_buffer_scale(2)
[1651191.178]  -> [email protected](wl_buffer@20, 0, 0)
[1651191.204]  -> [email protected]_buffer(0, 0, 2147483647, 2147483647)
[1651191.231]  -> [email protected]()
[1651191.242]  -> [email protected]()
[1651192.105] [email protected]_id(23)
[1651192.144] [email protected]_id(19)
[1651192.159] [email protected]_id(22)
[1651192.174] [email protected](129642480)
[1651245.532] [email protected](140081, 129642533, 39, 0)
[1651372.500] [email protected](140082, 129642660, 25, 1)
[1651372.582]  -> [email protected](new id wl_callback@22)
[1651372.608]  -> [email protected]()
[1651373.378] [email protected]_id(22)
[1651373.425] [email protected](129642661)
[1651373.447]  -> [email protected](new id wl_callback@22)
[1651373.469]  -> [email protected]_position(880, 480)
The only difference in the logs (besides timestamps) is that the buffers aren't released when the scaling factor is 2. This means that render_frame's call to get_next_buffer() returns null, setting surface->current_buffer to null. After that, nothing ever gets re-rendered again.
If I had to guess, https://github.com/swaywm/wlroots/blob/a9e5df44d898e6145ad126622ce557587acf3288/types/wlr_surface.c#L189 might be the cause of this. It's the only code I could find in wlroots that looked suspicious, and it was committed around the time this bug started appearing. I'd have to rebuild wlroots and sway to be sure, and I really should be focused on other things right now, so I stopped there.
I also ran into this with an output scale of 2, and could not find any indicator-radius that worked with my existing font-size setting of 9. Changing font-size to any even value worked, without setting indicator-radius at all. This is with font=Iosevka Sparkle.
Assuming that the indicator's buffer size is calculated based on indicator-radius, font-size, and the font metrics, but isn't forced to be a multiple of the scale, the change @ggreer pointed to does look like it could be causing the problem.
The rings are back for me with https://github.com/swaywm/sway/commit/4832fc937fae5a5e2af8828a7092c9026bd300e0, https://github.com/swaywm/wlroots/commit/a48e569d3860e91428c74e876a5d886314767c7b and swaylock https://github.com/swaywm/swaylock/commit/7ac62ebda1858875fc5f2de4ed694072aa739eb7.
However the font size are not quite right yet... (left has scale=1.4, right has scale=1, font size is 50)
