From 7e9854982c560a11aa7fa0eee6aa2a9f9673a9d6 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 24 May 2011 08:24:36 +0200 Subject: Text insertion machinery --- src/mainwindow.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/mainwindow.c') 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; } -- cgit v1.2.3