aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-05-24 08:24:36 +0200
committerThomas White <taw@bitwiz.org.uk>2011-05-24 08:24:36 +0200
commit7e9854982c560a11aa7fa0eee6aa2a9f9673a9d6 (patch)
treee84c910d21f4155a3e9e5190a05fea1d772beae3 /src/mainwindow.c
parent13248acdefcaa88d88cb9ef493ab3e9602abc658 (diff)
Text insertion machinery
Diffstat (limited to 'src/mainwindow.c')
-rw-r--r--src/mainwindow.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 904c69f..362bd92 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -142,6 +142,14 @@ static gint close_sig(GtkWidget *window, struct presentation *p)
static gboolean im_commit_sig(GtkIMContext *im, gchar *str,
struct presentation *p)
{
+ if ( p->editing_object == NULL ) return FALSE;
+ if ( p->editing_object->type != TEXT ) return FALSE;
+
+ insert_text(p->editing_object, str);
+
+ /* FIXME: Invalidate only the necessary region */
+ gdk_window_invalidate_rect(p->drawingarea->window, NULL, FALSE);
+
return FALSE;
}
@@ -156,9 +164,6 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event,
/* Throw the event to the IM context and let it sort things out */
gtk_im_context_filter_keypress(GTK_IM_CONTEXT(p->im_context), event);
- /* FIXME: Invalidate only the necessary region */
- gdk_window_invalidate_rect(p->drawingarea->window, NULL, FALSE);
-
return FALSE;
}