mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-07 18:58:06 +02:00
clients: window & keyboard: Be able to set the minimum allocation
Function added to be able to set the minimum allocation of the window. Set the minimum allocation of the keyboard window manually. Otherwise, the first call to 'window_schedule_resize' sets 'min_allocation' to the size of the current layout. This means that a layout that requires less space no longer has the chance to use the correct allocation size. Signed-off-by: Joscha.Wloch <Joscha.Wloch@bruker.com>
This commit is contained in:
parent
90e54338d7
commit
366d11c3ee
3 changed files with 14 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue