diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 32 |
1 files changed, 10 insertions, 22 deletions
@@ -66,30 +66,18 @@ on_main_paint (FooScrollArea *scroll_area, static void on_main_viewport_size_changed (FooScrollArea *scroll_area, - GdkRectangle *viewport, - GdkRectangle *old_viewport) + GdkRectangle *new_viewport, + GdkRectangle *old_viewport, + gpointer data) { - int total_height; - int nth_slide; - double old_y; - double new_y; - - /* Compute the y-coordinate of the first visible top edge of a slide */ - nth_slide = - (old_viewport->y - MARGIN) / (MARGIN + (double)slide_height) + 1; - - old_y = nth_slide * (MARGIN + (double)slide_height) + MARGIN; - - slide_width = viewport->width - 2 * MARGIN; - slide_height = slide_width / RATIO; - - new_y = nth_slide * (MARGIN + (double)slide_height) + MARGIN; - - total_height = N_SLIDES * slide_height + (N_SLIDES + 1) * MARGIN; + App *app = data; + int nth_slide = deck_get_view_slide (app->deck, old_viewport); + int old_location = deck_get_slide_location (app->deck, old_viewport, nth_slide); + int new_location = deck_get_slide_location (app->deck, new_viewport, nth_slide); + int height = deck_get_height (app->deck, new_viewport); - foo_scroll_area_set_size_fixed_y (scroll_area, viewport->width, - total_height, - old_y + 0.5, new_y + 0.5); + foo_scroll_area_set_size_fixed_y (scroll_area, new_viewport->width, + height, old_location, new_location); foo_scroll_area_invalidate (scroll_area); } |