Method

GtkTextViewim_context_filter_keypress

Declaration [src]

gboolean
gtk_text_view_im_context_filter_keypress (
  GtkTextView* text_view,
  GdkEvent* event
)

Description [src]

Allow the GtkTextView input method to internally handle key press and release events.

If this function returns TRUE, then no further processing should be done for this key event. See gtk_im_context_filter_keypress().

Note that you are expected to call this function from your handler when overriding key event handling. This is needed in the case when you need to insert your own key handling between the input method and the default key event handling of the GtkTextView.

static gboolean
gtk_foo_bar_key_press_event (GtkWidget *widget,
                             GdkEvent  *event)
{
  guint keyval;

  gdk_event_get_keyval ((GdkEvent*)event, &keyval);

  if (keyval == GDK_KEY_Return || keyval == GDK_KEY_KP_Enter)
    {
      if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (widget), event))
        return TRUE;
    }

  // Do some stuff

  return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event);
}

Parameters

event

Type: GdkEvent

The key event.

The data is owned by the caller of the method.

Return value

Type: gboolean

TRUE if the input method handled the key event.