clients: keyboard: fix resize on layput change

If the content type changes, then the layout also changes, which means
that the size must be adapted to the new layout and the widget must
be redrawn.

Signed-off-by: Joscha.Wloch <Joscha.Wloch@bruker.com>
This commit is contained in:
Joscha.Wloch 2024-05-13 15:10:00 +02:00 committed by Joscha Wloch
parent 74a7484ae6
commit e0bfeb4f8f

View file

@ -894,8 +894,28 @@ handle_content_type(void *data,
{
struct virtual_keyboard *keyboard = data;
keyboard->content_hint = hint;
keyboard->content_purpose = purpose;
if ((keyboard->content_hint != hint) || (keyboard->content_purpose != purpose))
{
keyboard->content_hint = hint;
keyboard->content_purpose = purpose;
// A change of the content type means a new layout.
// So we have to update.
const struct layout *layout = get_current_layout(keyboard);
zwp_input_method_context_v1_language(context,
keyboard->serial,
layout->language);
zwp_input_method_context_v1_text_direction(context,
keyboard->serial,
layout->text_direction);
window_schedule_resize(keyboard->keyboard->window,
layout->columns * key_width,
layout->rows * key_height);
widget_schedule_redraw(keyboard->keyboard->widget);
}
}
static void