aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-05-24 23:48:02 +0200
committerThomas White <taw@bitwiz.org.uk>2011-05-24 23:48:02 +0200
commitbcbdceef6e1be59a6ca1d653b6a54bf9009b4143 (patch)
tree8fc7b7ab999ffdcff0418132bc1d87fd9d7c88bc /src/mainwindow.c
parentb0770e263f6b94386aa0818b0c0f79ca486cf1b2 (diff)
Make backspace work
Diffstat (limited to 'src/mainwindow.c')
-rw-r--r--src/mainwindow.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 48740cd..44fed9e 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <gtk/gtk.h>
#include <assert.h>
+#include <gdk/gdkkeysyms.h>
#include "presentation.h"
#include "mainwindow.h"
@@ -157,10 +158,25 @@ static gboolean im_commit_sig(GtkIMContext *im, gchar *str,
static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event,
struct presentation *p)
{
+ gboolean r;
+
if ( p->editing_object == NULL ) return FALSE;
/* 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);
+ r = gtk_im_context_filter_keypress(GTK_IM_CONTEXT(p->im_context),
+ event);
+
+ if ( r ) return FALSE; /* IM ate it */
+
+ if ( event->keyval == GDK_KEY_BackSpace ) {
+ if ( (p->editing_object != NULL)
+ && (p->editing_object->type == TEXT) ) {
+ handle_text_backspace(p->editing_object);
+ }
+ }
+
+ /* FIXME: Invalidate only the necessary region */
+ gdk_window_invalidate_rect(p->drawingarea->window, NULL, FALSE);
return FALSE;
}