X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Finput.c;h=43ed0453ddcc56a43394809eac0af3e916371884;hb=441fcc88b3dfe63ca59faf77c00caf7504497c35;hp=ddc41d8b216fe7ba14ccdc8359f1f41b2616fe66;hpb=02dacdfeec2bb204aff8dae862ece880c58f5e0c;p=rodin%2Fchimara.git diff --git a/libchimara/input.c b/libchimara/input.c index ddc41d8..43ed045 100644 --- a/libchimara/input.c +++ b/libchimara/input.c @@ -1,6 +1,7 @@ #include "charset.h" #include "magic.h" #include "input.h" +#include "pager.h" #include "chimara-glk-private.h" extern GPrivate *glk_data_key; @@ -32,6 +33,12 @@ request_char_event_common(winid_t win, gboolean unicode) /* Emit the "waiting" signal to let listeners know we are ready for input */ g_signal_emit_by_name(glk_data->self, "waiting"); + + /* Schedule a check for the pager */ + /* + if(win->type == wintype_TextBuffer) + g_idle_add(pager_check, win); + */ } /** @@ -127,7 +134,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); @@ -192,6 +203,11 @@ text_buffer_request_line_event_common(winid_t win, glui32 maxlen, gboolean inser gtk_widget_grab_focus(win->widget); gdk_threads_leave(); + + /* Schedule a check for the pager */ + /* + g_idle_add(pager_check, win); + */ } /** @@ -289,6 +305,8 @@ glk_request_line_event_uni(winid_t win, glui32 *buf, glui32 maxlen, glui32 initl if(glk_data->register_arr) win->buffer_rock = (*glk_data->register_arr)(buf, maxlen, "&+#!Iu"); + + win->input_request_type = INPUT_REQUEST_LINE_UNICODE; win->line_input_buffer_unicode = buf; win->line_input_buffer_max_len = maxlen; @@ -413,6 +431,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));