mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-12 13:29:55 -05:00
Let clients override the suggested size on resize.
This lets gears enforce a square aspect ration and minimum size of 300x300 and the terminal now properly resizes in steps of character cells.
This commit is contained in:
parent
1584c57edc
commit
221067654c
4 changed files with 104 additions and 40 deletions
15
gears.c
15
gears.c
|
|
@ -243,8 +243,19 @@ draw_gears(struct gears *gears)
|
|||
static void
|
||||
resize_window(struct gears *gears)
|
||||
{
|
||||
window_draw(gears->window);
|
||||
/* Constrain child size to be square and at least 300x300 */
|
||||
window_get_child_rectangle(gears->window, &gears->rectangle);
|
||||
if (gears->rectangle.width > gears->rectangle.height)
|
||||
gears->rectangle.height = gears->rectangle.width;
|
||||
else
|
||||
gears->rectangle.width = gears->rectangle.height;
|
||||
if (gears->rectangle.width < 300) {
|
||||
gears->rectangle.width = 300;
|
||||
gears->rectangle.height = 300;
|
||||
}
|
||||
window_set_child_size(gears->window, &gears->rectangle);
|
||||
|
||||
window_draw(gears->window);
|
||||
|
||||
if (gears->buffer != NULL)
|
||||
buffer_destroy(gears->buffer, gears->fd);
|
||||
|
|
@ -269,7 +280,7 @@ resize_window(struct gears *gears)
|
|||
}
|
||||
|
||||
static void
|
||||
resize_handler(struct window *window, struct rectangle *rectangle, void *data)
|
||||
resize_handler(struct window *window, void *data)
|
||||
{
|
||||
struct gears *gears = data;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue