flower: Dont allow resizing
This commit is contained in:
@@ -105,6 +105,16 @@ draw_stuff(cairo_surface_t *surface, int width, int height)
|
|||||||
cairo_destroy(cr);
|
cairo_destroy(cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
resize_handler(struct widget *widget,
|
||||||
|
int32_t width, int32_t height, void *data)
|
||||||
|
{
|
||||||
|
struct flower *flower = data;
|
||||||
|
|
||||||
|
/* Dont resize me */
|
||||||
|
widget_set_size(flower->widget, flower->width, flower->height);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
redraw_handler(struct widget *widget, void *data)
|
redraw_handler(struct widget *widget, void *data)
|
||||||
{
|
{
|
||||||
@@ -173,6 +183,7 @@ int main(int argc, char *argv[])
|
|||||||
flower.window = window_create(d, flower.width, flower.height);
|
flower.window = window_create(d, flower.width, flower.height);
|
||||||
flower.widget = window_add_widget(flower.window, &flower);
|
flower.widget = window_add_widget(flower.window, &flower);
|
||||||
|
|
||||||
|
widget_set_resize_handler(flower.widget, resize_handler);
|
||||||
widget_set_redraw_handler(flower.widget, redraw_handler);
|
widget_set_redraw_handler(flower.widget, redraw_handler);
|
||||||
widget_set_motion_handler(flower.widget, motion_handler);
|
widget_set_motion_handler(flower.widget, motion_handler);
|
||||||
widget_set_button_handler(flower.widget, button_handler);
|
widget_set_button_handler(flower.widget, button_handler);
|
||||||
|
|||||||
+5
-3
@@ -2038,9 +2038,11 @@ window_resize(struct window *window, int32_t width, int32_t height)
|
|||||||
allocation.height,
|
allocation.height,
|
||||||
widget->user_data);
|
widget->user_data);
|
||||||
|
|
||||||
window->allocation = widget->allocation;
|
if (window->allocation.width != widget->allocation.width ||
|
||||||
|
window->allocation.height != widget->allocation.height) {
|
||||||
window_schedule_redraw(window);
|
window->allocation = widget->allocation;
|
||||||
|
window_schedule_redraw(window);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user