[gimp] app: make Tab, Shift+Tab and Escape move the focus back to text editing
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: make Tab, Shift+Tab and Escape move the focus back to text editing
- Date: Fri, 9 Nov 2012 21:13:45 +0000 (UTC)
commit 76b05c2afcfb58c1cf00020d39cce23de91af6a5
Author: Michael Natterer <mitch gimp org>
Date: Fri Nov 9 22:06:51 2012 +0100
app: make Tab, Shift+Tab and Escape move the focus back to text editing
when it was in the floating text style editor. While this doesn't fix
anything by itself, it enables fixing text style setting to behave
reasonably when there is no selection.
app/tools/gimptexttool-editor.c | 34 +++++++++++++++++++++++++++-------
1 files changed, 27 insertions(+), 7 deletions(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index 1533245..c4e950e 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -415,18 +415,38 @@ gboolean
gimp_text_tool_editor_key_press (GimpTextTool *text_tool,
GdkEventKey *kevent)
{
- GtkTextBuffer *buffer = GTK_TEXT_BUFFER (text_tool->buffer);
- GtkTextIter cursor;
- GtkTextIter selection;
- gint x_pos = -1;
- gboolean retval = TRUE;
+ GimpTool *tool = GIMP_TOOL (text_tool);
+ GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
+ GtkTextBuffer *buffer = GTK_TEXT_BUFFER (text_tool->buffer);
+ GtkTextIter cursor;
+ GtkTextIter selection;
+ gboolean retval = TRUE;
+
+ if (! gtk_widget_has_focus (shell->canvas))
+ {
+ /* The focus is in the floating style editor, and the event
+ * was not handled there, focus the canvas.
+ */
+ switch (kevent->keyval)
+ {
+ case GDK_KEY_Tab:
+ case GDK_KEY_KP_Tab:
+ case GDK_KEY_ISO_Left_Tab:
+ case GDK_KEY_Escape:
+ gtk_widget_grab_focus (shell->canvas);
+ return TRUE;
+
+ default:
+ break;
+ }
+ }
if (gtk_im_context_filter_keypress (text_tool->im_context, kevent))
{
text_tool->needs_im_reset = TRUE;
text_tool->x_pos = -1;
- return TRUE;
+ return TRUE;
}
gimp_text_tool_ensure_proxy (text_tool);
@@ -470,7 +490,7 @@ gimp_text_tool_editor_key_press (GimpTextTool *text_tool,
retval = FALSE;
}
- text_tool->x_pos = x_pos;
+ text_tool->x_pos = -1;
return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]