Try harder not to beep on events which are not meant to insert stuff in

2007-01-02  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtktextbuffer.c (gtk_text_view_key_press_event):
        Try harder not to beep on events which are not meant to
        insert stuff in the buffer.  (#390514, Yevgen Muntyan)



svn path=/trunk/; revision=17020
This commit is contained in:
Matthias Clasen 2007-01-02 15:49:31 +00:00 committed by Matthias Clasen
parent 2af1bc2b35
commit 2b267db6db
2 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2007-01-02 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextbuffer.c (gtk_text_view_key_press_event):
Try harder not to beep on events which are not meant to
insert stuff in the buffer. (#390514, Yevgen Muntyan)
2007-01-02 Matthias Clasen <mclasen@redhat.com> 2007-01-02 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextbufferrichtext.c: Small documentation fixes. * gtk/gtktextbufferrichtext.c: Small documentation fixes.

View File

@ -3901,7 +3901,8 @@ gtk_text_view_key_press_event (GtkWidget *widget, GdkEventKey *event)
} }
/* Pass through Tab as literal tab, unless Control is held down */ /* Pass through Tab as literal tab, unless Control is held down */
else if ((event->keyval == GDK_Tab || else if ((event->keyval == GDK_Tab ||
event->keyval == GDK_KP_Tab) && event->keyval == GDK_KP_Tab ||
event->keyval == GDK_ISO_Left_Tab) &&
!(event->state & GDK_CONTROL_MASK)) !(event->state & GDK_CONTROL_MASK))
{ {
/* If the text widget isn't editable overall, or if the application /* If the text widget isn't editable overall, or if the application
@ -3929,8 +3930,17 @@ gtk_text_view_key_press_event (GtkWidget *widget, GdkEventKey *event)
gtk_text_view_reset_blink_time (text_view); gtk_text_view_reset_blink_time (text_view);
gtk_text_view_pend_cursor_blink (text_view); gtk_text_view_pend_cursor_blink (text_view);
if (!retval && event->length) if (!retval)
gtk_widget_error_bell (widget); {
/* We only want to beep if we are reasonably sure
* the event was meant to insert some character into
* the buffer, but failed. We don't beep on events
* which look like attempts to activate an accelerator.
*/
if (!event->is_modifier &&
((event->state & (gtk_accelerator_get_default_mod_mask () & ~GDK_SHIFT_MASK)) == 0))
gtk_widget_error_bell (widget);
}
return retval; return retval;
} }