wvkbd adapt its height, and layout depending on if the screen
is in landscape mode or not.
The only realiable way to know which outputs our surface is
rendered on is the wl_surface->enter(wl_output) event. But we receive
this event very late in the flow. After the first frame rendering, and
commit to the surface.
There already is some code to guess the best initial tentative, on the
most simple situations, to try to avoid an immediate re-creation of the
Wayland objects, buffer, and re-rendering of the layout.
But two issues was present:
First, we need a second roundtrip of the events, after the global
handle. This make the compositor to send the wl_outputs events earlier,
giving their geometry before our first show().
Then, the code that loop on them, if we don't already know the
current_output, was wrong. Because we changed the default state to
landscaped a while ago.
We also change how this code behave, we use the very first wl_output we
know about. Every behaviors are somehow wrong at this point, this one is
the simplest.
Now when starting wvkbd with only one screen, we don't need a second
loop anymore.
On situation where multiple screens are present, it will eventually need
a second one.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
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>
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>
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>
- The full layout now squashes less keys in a row, to accomplish this
the semicolon/colon, equal/plus and alt keys had to be sacrificed
from the full layout (they're on the special/symbols layout still).
- The half-keys in the simple layout are removed, giving a bit more
space.
- The default total keyboard height has been slightly enlarged (10px)
- The compose key moved down, it was too close to the 'a' (accidental
presses). The tab key moved to the top-right.
- The spacing between the buttons is slightly larger (aesthetic only)
- The key for layer switching is now labelled more consistently with an icon, and indicates direction of switching with an arrow
- An extra "index" layout was added that can be activated by pressing
Compose + the next/prev layout button. It has a key for each layout,
even those not specified at start. This special layout does not appear
in the normal layer cycling.
- The "Abc" key on secondary layers returns to the last alphabetical layout
- The compose layouts automatically hide when the user presses the space
where there are no keys, no need to explicitly press the "Abc" key.
Add a new parameter `--landscape-layers` as well as an environment
variable `WVKBD_LANDSCAPE_LAYERS` that allows the user to override the
default set of layers in landscape mode. This complements the existing
`-l` parameter and `WVKBD_LAYERS` environment variable, which do the
equivalent for non-landscape mode.
Furthermore, add documentation for the new switch. Move the `-l`
parameter to the bottom so we don't have to realign all parameters and
so all layer-related parameters are grouped together.
To get a list of available layers for the -l option.
Signed-off-by: Emmanuel LE TRONG <emmanuel.le-trong@cnrs-orleans.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Previously wvkbd would commit an (usually) unchanged surface at the
framerate of the compositor, this only commits the buffer when we render
something new.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Switch to using signalfds because using the signal syscall was causing
problems without the frame callbacks (the change in the next commit), I
think this is because it would end up with multiple tasks polling the
same wayland file descriptor.
Previously this would exit after the second SIGPIPE signal. I checked
with earboxer on irc, and confirmed that handling all occurrences is the
correct behavior.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
If there are more layers in one orientation than the other this can
cause wvkbd to overshoot the end of the layer list when switching
layers. It also means that switching layers after rotating will jump to
the next layer in the list, which is somewhat unexpected.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Since layer_surface_configure was changed to only call kbd_resize when
an output dimension changed, kbd_resize doesn't get called if the
keyboard was hidden and is being shown again, meaning it doesn't tell
the compositor about the scale.
This causes it to only output the top-right quarter of the keybaord
stretched to the entire window size after a SIGUSR1 + SIGUSR2 cycle with
the display scale set to 2.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Most displays are in landscape mode by default, so checking to see if
it's rotated will produce the exact opposite of the expected results.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>