Fixed bug: modifier keys no longer count as char input
[rodin/chimara.git] / libchimara / input.c
index ddc41d8b216fe7ba14ccdc8359f1f41b2616fe66..a4511dc57306e6fc2dec661f5496d568b11c8fbf 100644 (file)
@@ -127,7 +127,11 @@ text_grid_request_line_event_common(winid_t win, glui32 maxlen, gboolean insert,
        /* Make the entry as small as possible to fit with the text */
        gtk_entry_set_has_frame(GTK_ENTRY(win->input_entry), FALSE);
        GtkBorder border = { 0, 0, 0, 0 };
+
+       /* COMPAT: */
+#if GTK_CHECK_VERSION(2,10,0)
        gtk_entry_set_inner_border(GTK_ENTRY(win->input_entry), &border);
+#endif
     gtk_entry_set_max_length(GTK_ENTRY(win->input_entry), win->input_length);
     gtk_entry_set_width_chars(GTK_ENTRY(win->input_entry), win->input_length);
 
@@ -413,6 +417,11 @@ on_shutdown_key_press_event(GtkWidget *widget, GdkEventKey *event, winid_t win)
 gboolean
 on_char_input_key_press_event(GtkWidget *widget, GdkEventKey *event, winid_t win)
 {
+       /* Ignore modifier keys, otherwise the char input will already trigger on 
+       the shift key when the user tries to type a capital letter */
+       if(event->is_modifier)
+               return FALSE; /* don't stop the event */
+       
        glui32 keycode = keyval_to_glk_keycode(event->keyval, win->input_request_type == INPUT_REQUEST_CHARACTER_UNICODE);
 
        ChimaraGlk *glk = CHIMARA_GLK(gtk_widget_get_ancestor(widget, CHIMARA_TYPE_GLK));