diff options
author | Thomas White <taw@bitwiz.org.uk> | 2011-05-29 20:37:01 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2011-05-29 20:37:01 +0200 |
commit | 9a00aaa654a698a9068da7544ab7123e50defa6d (patch) | |
tree | ce1eb657885fc341a0148eb8a8e169e403bc7c1e /src | |
parent | e429ea1b576e7e660bf9bf97c856fecdef59dfac (diff) |
"B" key blanks slideshow display
Diffstat (limited to 'src')
-rw-r--r-- | src/presentation.h | 3 | ||||
-rw-r--r-- | src/slideshow.c | 34 |
2 files changed, 27 insertions, 10 deletions
diff --git a/src/presentation.h b/src/presentation.h index ba4dd90..b6736b3 100644 --- a/src/presentation.h +++ b/src/presentation.h @@ -55,9 +55,12 @@ struct presentation GtkUIManager *ui; GtkActionGroup *action_group; GtkIMContext *im_context; + + /* Slideshow stuff */ GtkWidget *slideshow; GtkWidget *ss_drawingarea; GdkCursor *blank_cursor; + int ss_blank; double slide_width; double slide_height; diff --git a/src/slideshow.c b/src/slideshow.c index e18b1fa..7e4019e 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -61,17 +61,22 @@ static gboolean ss_expose_sig(GtkWidget *da, GdkEventExpose *event, cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); cairo_fill(cr); - /* 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; - p->border_offs_x = xoff; p->border_offs_y = yoff; + if ( !p->ss_blank ) { - /* Draw the slide from the cache */ - cairo_rectangle(cr, event->area.x, event->area.y, - event->area.width, event->area.height); - cairo_set_source_surface(cr, p->view_slide->render_cache, xoff, yoff); - cairo_fill(cr); + /* 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; + p->border_offs_x = xoff; p->border_offs_y = yoff; + + /* Draw the slide from the cache */ + cairo_rectangle(cr, event->area.x, event->area.y, + event->area.width, event->area.height); + cairo_set_source_surface(cr, p->view_slide->render_cache, + xoff, yoff); + cairo_fill(cr); + + } cairo_destroy(cr); @@ -114,6 +119,13 @@ static gboolean ss_key_press_sig(GtkWidget *da, GdkEventKey *event, { switch ( event->keyval ) { + case GDK_KEY_B : + case GDK_KEY_b : + p->ss_blank = 1-p->ss_blank; + gdk_window_invalidate_rect(p->ss_drawingarea->window, + NULL, FALSE); + break; + case GDK_KEY_Page_Up : prev_slide_sig(NULL, p); break; @@ -149,6 +161,8 @@ void try_start_slideshow(struct presentation *p) /* Presentation already running? */ if ( p->slideshow != NULL ) return; + p->ss_blank = 0; + n = gtk_window_new(GTK_WINDOW_TOPLEVEL); p->ss_drawingarea = gtk_drawing_area_new(); |