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:
Kristian Høgsberg 2008-12-08 13:50:07 -05:00
parent 1584c57edc
commit 221067654c
4 changed files with 104 additions and 40 deletions

View file

@ -247,20 +247,12 @@ event_handler(struct wl_display *display,
case WINDOW_RESIZING_LOWER_RIGHT:
window->width = window->drag_x + x;
window->height = window->drag_y + y;
if (window->width < window->minimum_width)
window->width = window->minimum_width;
if (window->height < window->minimum_height)
window->height = window->minimum_height;
window_get_child_rectangle(window, &rectangle);
if (window->resize_handler)
(*window->resize_handler)(window,
&rectangle,
window->user_data);
window->width = rectangle.width + 20;
window->height = rectangle.height + 60;
break;
}
} else if (opcode == 1) {
@ -316,6 +308,14 @@ window_get_child_rectangle(struct window *window,
rectangle->height = window->height - 60;
}
void
window_set_child_size(struct window *window,
struct rectangle *rectangle)
{
window->width = rectangle->width + 20;
window->height = rectangle->height + 60;
}
void
window_copy(struct window *window,
struct rectangle *rectangle,