diff options
author | Thomas White <taw@bitwiz.org.uk> | 2011-10-17 22:31:21 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2011-10-17 22:31:21 +0100 |
commit | 39ebcd75c7f63221e3af95175cee150f0c9bb0c4 (patch) | |
tree | 261529518facb26ff93cd9bd73dc5ae7a49a41e0 /src | |
parent | a11196f4e47c312ff787d3990e0aa8edefa3e395 (diff) |
Fit slideshow to screen
Diffstat (limited to 'src')
-rw-r--r-- | src/slideshow.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/slideshow.c b/src/slideshow.c index d702513..acee256 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -61,10 +61,14 @@ static gboolean ss_expose_sig(GtkWidget *da, GdkEventExpose *event, if ( !p->ss_blank ) { + int h; + + h = p->proj_slide_width * p->slide_height / p->slide_width; + /* Get the overall size */ gtk_widget_get_allocation(da, &allocation); - xoff = (allocation.width - p->slide_width)/2.0; - yoff = (allocation.height - p->slide_height)/2.0; + xoff = (allocation.width - p->proj_slide_width)/2.0; + yoff = (allocation.height - h)/2.0; /* Draw the slide from the cache */ cairo_rectangle(cr, event->area.x, event->area.y, @@ -208,11 +212,17 @@ void try_start_slideshow(struct presentation *p) for ( i=0; i<n_monitors; i++ ) { GdkRectangle rect; + int w; gdk_screen_get_monitor_geometry(screen, i, &rect); snprintf(p->ss_geom, 255, "%ix%i+%i+%i", rect.width, rect.height, rect.x, rect.y); - } + + w = rect.height * p->slide_width/p->slide_height; + if ( w > rect.width ) w = rect.width; + p->proj_slide_width = w; + + } /* FIXME: Sensible (configurable) choice of monitor */ p->slideshow = n; gtk_window_fullscreen(GTK_WINDOW(n)); |