diff --git a/clients/keyboard.c b/clients/keyboard.c index 3290c2994..0687eebc9 100644 --- a/clients/keyboard.c +++ b/clients/keyboard.c @@ -243,8 +243,12 @@ static const struct layout arabic_layout = { }; #define MAX(x, y) (((x) > (y)) ? (x) : (y)) +#define MIN(x, y) (((x) < (y)) ? (x) : (y)) #define max_count MAX(MAX(sizeof(arabic_keys) / sizeof(*arabic_keys), sizeof(numeric_keys) / sizeof(*numeric_keys) ), sizeof(normal_keys) / sizeof(*normal_keys)) +#define min_columns MIN(MIN(normal_layout.columns, numeric_layout.columns), arabic_layout.columns) +#define min_rows MIN(MIN(normal_layout.rows, numeric_layout.rows), arabic_layout.rows) + static const char *style_labels[] = { "default", "none", @@ -1105,6 +1109,7 @@ keyboard_create(struct virtual_keyboard *virtual_keyboard) window_set_appid(keyboard->window, "org.freedesktop.weston.virtual-keyboard"); window_set_user_data(keyboard->window, keyboard); + window_set_min_allocation(keyboard->window, min_columns * (int32_t)key_width, min_rows * (int32_t)key_height); widget_set_redraw_handler(keyboard->widget, redraw_handler); widget_set_resize_handler(keyboard->widget, resize_handler); diff --git a/clients/window.c b/clients/window.c index 90440c114..d88576856 100644 --- a/clients/window.c +++ b/clients/window.c @@ -4871,6 +4871,12 @@ window_is_resizing(struct window *window) return window->resizing; } +void window_set_min_allocation(struct window *window, int32_t width, int32_t height) +{ + window->min_allocation.width = width; + window->min_allocation.height = height; +} + void window_set_minimized(struct window *window) { diff --git a/clients/window.h b/clients/window.h index 8b3d9d1f3..add6ef601 100644 --- a/clients/window.h +++ b/clients/window.h @@ -481,6 +481,9 @@ window_set_maximized(struct window *window, int maximized); int window_is_resizing(struct window *window); +void +window_set_min_allocation(struct window *window, int32_t width, int32_t height); + void window_set_minimized(struct window *window);