[gimp] app: request and process key_release events
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: request and process key_release events
- Date: Thu, 18 Feb 2010 19:52:48 +0000 (UTC)
commit 7e3b090c320acb4661c341d218104bb6053f1321
Author: Michael Natterer <mitch gimp org>
Date: Thu Feb 18 20:50:37 2010 +0100
app: request and process key_release events
Feed them into the text editor's IM context and into the proxy text
view's key bindings. Fixes input methods (e.g. entering of unicode
sequences seems to work flawlessly now).
app/tools/gimptexttool-editor.c | 25 +++++++++++++++++++++++++
app/tools/gimptexttool-editor.h | 19 +++++++++++--------
app/tools/gimptexttool.c | 17 +++++++++++++++++
3 files changed, 53 insertions(+), 8 deletions(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index 7fc4b87..22c6b32 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -235,6 +235,31 @@ gimp_text_tool_editor_key_press (GimpTextTool *text_tool,
return retval;
}
+gboolean
+gimp_text_tool_editor_key_release (GimpTextTool *text_tool,
+ GdkEventKey *kevent,
+ GimpDisplay *display)
+{
+ if (gtk_im_context_filter_keypress (text_tool->im_context, kevent))
+ {
+ text_tool->needs_im_reset = TRUE;
+
+ return TRUE;
+ }
+
+ gimp_text_tool_ensure_proxy (text_tool);
+
+ if (gtk_bindings_activate_event (GTK_OBJECT (text_tool->proxy_text_view),
+ kevent))
+ {
+ GIMP_LOG (TEXT_EDITING, "binding handled event");
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
gchar *
gimp_text_tool_editor_get_text (GimpTextTool *text_tool)
{
diff --git a/app/tools/gimptexttool-editor.h b/app/tools/gimptexttool-editor.h
index 2b2c60a..6e243eb 100644
--- a/app/tools/gimptexttool-editor.h
+++ b/app/tools/gimptexttool-editor.h
@@ -24,17 +24,20 @@
#define __GIMP_TEXT_TOOL_EDITOR_H__
-void gimp_text_tool_editor_init (GimpTextTool *text_tool);
-void gimp_text_tool_editor_finalize (GimpTextTool *text_tool);
+void gimp_text_tool_editor_init (GimpTextTool *text_tool);
+void gimp_text_tool_editor_finalize (GimpTextTool *text_tool);
-void gimp_text_tool_editor_start (GimpTextTool *text_tool);
-void gimp_text_tool_editor_halt (GimpTextTool *text_tool);
+void gimp_text_tool_editor_start (GimpTextTool *text_tool);
+void gimp_text_tool_editor_halt (GimpTextTool *text_tool);
-gboolean gimp_text_tool_editor_key_press (GimpTextTool *text_tool,
- GdkEventKey *kevent,
- GimpDisplay *display);
+gboolean gimp_text_tool_editor_key_press (GimpTextTool *text_tool,
+ GdkEventKey *kevent,
+ GimpDisplay *display);
+gboolean gimp_text_tool_editor_key_release (GimpTextTool *text_tool,
+ GdkEventKey *kevent,
+ GimpDisplay *display);
-gchar * gimp_text_tool_editor_get_text (GimpTextTool *text_tool);
+gchar * gimp_text_tool_editor_get_text (GimpTextTool *text_tool);
#endif /* __GIMP_TEXT_TOOL_EDITOR_H__ */
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 5f5991d..096f4b4 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -101,6 +101,9 @@ static void gimp_text_tool_motion (GimpTool *tool,
static gboolean gimp_text_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *display);
+static gboolean gimp_text_tool_key_release (GimpTool *tool,
+ GdkEventKey *kevent,
+ GimpDisplay *display);
static void gimp_text_tool_oper_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
@@ -211,6 +214,7 @@ gimp_text_tool_class_init (GimpTextToolClass *klass)
tool_class->motion = gimp_text_tool_motion;
tool_class->button_release = gimp_text_tool_button_release;
tool_class->key_press = gimp_text_tool_key_press;
+ tool_class->key_release = gimp_text_tool_key_release;
tool_class->oper_update = gimp_text_tool_oper_update;
tool_class->cursor_update = gimp_text_tool_cursor_update;
tool_class->get_popup = gimp_text_tool_get_popup;
@@ -710,6 +714,19 @@ gimp_text_tool_key_press (GimpTool *tool,
return FALSE;
}
+static gboolean
+gimp_text_tool_key_release (GimpTool *tool,
+ GdkEventKey *kevent,
+ GimpDisplay *display)
+{
+ GimpTextTool *text_tool = GIMP_TEXT_TOOL (tool);
+
+ if (display == tool->display)
+ return gimp_text_tool_editor_key_release (text_tool, kevent, display);
+
+ return FALSE;
+}
+
static void
gimp_text_tool_oper_update (GimpTool *tool,
const GimpCoords *coords,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]