Esempio n. 1
0
static void
resize_handler(struct widget *widget,
	       int32_t width, int32_t height, void *data)
{
	struct demoapp *app = data;
	struct rectangle area;
	int side, h;

	widget_get_allocation(widget, &area);

	side = area.width < area.height ? area.width / 2 : area.height / 2;
	h = area.height - side;

	widget_set_allocation(app->subsurface,
			      area.x + area.width - side,
			      area.y,
			      side, h);

	if (app->triangle) {
		widget_set_allocation(app->triangle->widget,
				      area.x + area.width - side,
				      area.y + h,
				      side, side);
	}

	DBG("green %dx%d, red %dx%d, GL %dx%d\n",
	    area.width, area.height, side, h, side, side);
}
Esempio n. 2
0
static void
text_entry_allocate(struct text_entry *entry, int32_t x, int32_t y,
		    int32_t width, int32_t height)
{
	widget_set_allocation(entry->widget, x, y, width, height);
}