From b7576621ab8df6d6303f9b05b87d5e229f7ffdd5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 11 Dec 2011 14:57:11 +0100 Subject: Remote control magic --- src/mainwindow.c | 32 +++++++++++++++++++++++++------- src/presentation.c | 4 ++++ src/presentation.h | 8 ++++++++ src/slideshow.c | 22 +++++++++++++++++++--- 4 files changed, 56 insertions(+), 10 deletions(-) diff --git a/src/mainwindow.c b/src/mainwindow.c index 2562c69..1201667 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -668,10 +668,17 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, { gboolean r; - /* Throw the event to the IM context and let it sort things out */ - r = gtk_im_context_filter_keypress(GTK_IM_CONTEXT(p->im_context), - event); - if ( r ) return FALSE; /* IM ate it */ + /* FIXME: Only if doing sensible text input */ + if ( p->editing_object != NULL ) { + + /* Throw the event to the IM context and let it sort things + * out */ + r = gtk_im_context_filter_keypress( + GTK_IM_CONTEXT(p->im_context), + event); + if ( r ) return FALSE; /* IM ate it */ + + } p->cur_tool->key_pressed(p->editing_object, event->keyval, p->cur_tool); @@ -692,10 +699,21 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, break; case GDK_KEY_B : - p->slideshow_linked = 1 - p->slideshow_linked; - if ( p->slideshow_linked ) { + case GDK_KEY_b : + if ( p->slideshow != NULL ) { + if ( p->prefs->b_splits ) { + p->slideshow_linked = 1 - p->slideshow_linked; + if ( p->slideshow_linked ) { + p->cur_proj_slide = p->cur_edit_slide; + notify_slideshow_slide_changed(p); + } + } else { + p->ss_blank = 1-p->ss_blank; + gdk_window_invalidate_rect( + p->ss_drawingarea->window, + NULL, FALSE); + } } - redraw_overlay(p); break; } diff --git a/src/presentation.c b/src/presentation.c index 7cce628..cdb4a14 100644 --- a/src/presentation.c +++ b/src/presentation.c @@ -280,6 +280,10 @@ struct presentation *new_presentation() new->titlebar = NULL; get_titlebar_string(new); + /* FIXME: Should be just one of these */ + new->prefs = calloc(1, sizeof(struct prefs)); + new->prefs->b_splits = 1; + new->window = NULL; new->ui = NULL; new->action_group = NULL; diff --git a/src/presentation.h b/src/presentation.h index addcf7c..efe9d5c 100644 --- a/src/presentation.h +++ b/src/presentation.h @@ -103,6 +103,12 @@ struct toolinfo }; +struct prefs +{ + int b_splits; +}; + + struct presentation { char *titlebar; @@ -110,6 +116,8 @@ struct presentation int completely_empty; int *num_presentations; + struct prefs *prefs; + struct toolinfo *select_tool; struct toolinfo *text_tool; struct toolinfo *image_tool; diff --git a/src/slideshow.c b/src/slideshow.c index 8e3b8ca..950c5c5 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -104,6 +104,10 @@ static gint prev_slide_sig(GtkWidget *widget, struct presentation *p) notify_slideshow_slide_changed(p); + /* Editor always follows slideshow, even if "unlinked" */ + p->cur_edit_slide = p->cur_proj_slide; + notify_slide_changed(p); + return FALSE; } @@ -121,6 +125,10 @@ static gint next_slide_sig(GtkWidget *widget, struct presentation *p) notify_slideshow_slide_changed(p); + /* Editor always follows slideshow, even if "unlinked" */ + p->cur_edit_slide = p->cur_proj_slide; + notify_slide_changed(p); + return FALSE; } @@ -142,9 +150,17 @@ static gboolean ss_key_press_sig(GtkWidget *da, GdkEventKey *event, 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); + if ( p->prefs->b_splits ) { + p->slideshow_linked = 1 - p->slideshow_linked; + if ( p->slideshow_linked ) { + p->cur_proj_slide = p->cur_edit_slide; + notify_slideshow_slide_changed(p); + } + } else { + p->ss_blank = 1-p->ss_blank; + gdk_window_invalidate_rect(p->ss_drawingarea->window, + NULL, FALSE); + } break; case GDK_KEY_Page_Up : -- cgit v1.2.3