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.
This commit is contained in:
Michael Natterer 2012-11-09 22:06:51 +01:00
parent e1e32a03a9
commit 76b05c2afc
1 changed files with 27 additions and 7 deletions

View File

@ -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;
}