From a369ff52739e8bca84faa6de9c4115f3e84ef818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 30 Oct 2012 15:09:49 -0400 Subject: [PATCH] image: Set resize handler and center view on resize/fullscreen --- clients/image.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clients/image.c b/clients/image.c index 14f05507..2804dbf1 100644 --- a/clients/image.c +++ b/clients/image.c @@ -160,6 +160,15 @@ redraw_handler(struct widget *widget, void *data) cairo_surface_destroy(surface); } +static void +resize_handler(struct widget *widget, + int32_t width, int32_t height, void *data) +{ + struct image *image = data; + + center_view(image); +} + static void keyboard_focus_handler(struct window *window, struct input *device, void *data) @@ -363,6 +372,7 @@ image_create(struct display *display, const char *filename, window_set_user_data(image->window, image); widget_set_redraw_handler(image->widget, redraw_handler); + widget_set_resize_handler(image->widget, resize_handler); window_set_keyboard_focus_handler(image->window, keyboard_focus_handler); window_set_fullscreen_handler(image->window, fullscreen_handler);