In some situations, wl_touch_* events come between layer_surface_configure and xdg_popup_surface_configure.
It causes the keyboard to be drawn before the popup surf is configured, leading to "error 3: xdg_surface has never been configured".
This commit fixes this.
Even if the user is focusing another output while the geometry change.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Most of the time, the first frame have to be rendered without knowing
which output is the current one. It means the first window could have
incorrect dimensions. This cause other program surface to shrink,
then grow back.
Let's try a smoother approach:
If we don't know the current output, we could check if one of them is
landscaped. If this is the case, we start landscaped to minimise the
visual glitch.
Also, the compositor might choose to not send any output geometry
information before the first surface role is assigned (sway master
829c75b9). Meaning after our initial set_size request. So we have to start
landscaped, and eventually flip to horizontal.
Thanks to the patch "Skip the first resize when landscaped while
starting", we do not draw multiple time on the buffer when we switch to vertical
mode.
This should cover most of the cases, and produce a more discrete
start.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Before 1920*1080 scaled 1.40 was giving a buffer width of 1919 pixels.
The buffer dimensions have to be ceiled here, instead of rounded.
The rest of the dimensions have to stay the same, here 1371x120.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
there is no need to do so, because this event is followed by layer_surface_configure.
sway-HEAD(020a572) complains "A configure is scheduled for an uninitialized xdg_surface",
but it works anyway.
fix#50
Add the members font and font_descriptor to struct clr_scheme, so that
it is possible to specify a font for each scheme.
During initialization create the font descriptors for each scheme.
Instead of initially setting the font descriptor when setting up the
buffer, set the font descriptor when drawing the text.
Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This cleanup a bit how we store and use the preferred_scale and
preferred_fractional_scale.
This rename some methods to make their behavior more explicit.
When triggering show() on kill USR2, everything works as expected, but
the keyboard attributes are the same as before. So in
layer_surface_configure, we don't match the condition.
Checking hidden, and resetting it from inside this scope is enough to
solve the problem.
The goal is to minimize startup redraws.
It looks like the surface must enter the output for us to finaly know
which one it is. We need this to use the correct scale value. It make
the surface to be blurry at first, but I can not find a better way.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This is unoticeable without fractional scaling, but becore a real
problem with it. It add transparency arround rectangles, and so cause
drawing problems.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
seat_handle_capabilities may be called more than once with different caps.
In the current implementation, wl_{pointer,touch}_add_listener can be
called multiple times for the same seat, causing the buttons to be pressed
more than once in a single tap.
This commit implements seat_handle_capabilities correctly and
avoids setting duplicate handlers, and also handles the removal of capabilities.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This isn't a good way to solve this, and cause restrictions and
breakages.
We should find a better way to enforce text inside of keys, probably
using a second buffer to write into.
This is a bit hacky. The main problem is that there is no way to tell
cairo to limit the width. It will wrap text accordingly to width and
height, it will add ellipsizes if it overlow the box, but if a word
width is larger than the box width, it will write it.
To avoid that, I make sure we don't go too much to the left, and I
redraw the background at the right of the keys. This is not visible
cause we damage track correctly the updated buffer coordinates.
I also moved the damage tracking from do_rectangle and draw_text to
higher draw_key and draw_layout.