From 48cbffa2da42612a242f96fa0fd09683e9d1442b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 4 Oct 2011 23:57:01 +0200 Subject: Move key press stuff into tool callbacks --- src/mainwindow.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'src/mainwindow.c') diff --git a/src/mainwindow.c b/src/mainwindow.c index d115ec3..b98ed00 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -557,7 +557,7 @@ static gboolean im_commit_sig(GtkIMContext *im, gchar *str, if ( p->editing_object == NULL ) return FALSE; if ( p->editing_object->type != TEXT ) return FALSE; - insert_text(p->editing_object, str); + p->cur_tool->im_commit(p->editing_object, str, p->cur_tool); redraw_object(p->editing_object); @@ -573,31 +573,9 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, /* 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 */ - if ( (p->editing_object != NULL) - && (p->editing_object->type == TEXT) ) - { - switch ( event->keyval ) { - - case GDK_KEY_BackSpace : - handle_text_backspace(p->editing_object); - redraw_object(p->editing_object); - break; - - case GDK_KEY_Left : - move_cursor_left(p->editing_object); - redraw_object(p->editing_object); - break; - - case GDK_KEY_Right : - move_cursor_right(p->editing_object); - redraw_object(p->editing_object); - break; - - } - } + p->cur_tool->key_pressed(p->editing_object, event->keyval, p->cur_tool); switch ( event->keyval ) { -- cgit v1.2.3