From aa293ae9a7a922908fdb653298aa82ad3b20e33c Mon Sep 17 00:00:00 2001 From: Massimo Valentini Date: Sat, 16 Jul 2016 16:28:35 +0200 Subject: [PATCH] Bug 675748: Text tool: text editor inhibits text... ...selection on the canvas if the editor dialog is active do not copy to the clipboard the text selected, copy it instead when selected with keys -left/right. --- app/tools/gimptexttool-editor.c | 37 +++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c index d4d1196d4c..b90c3fa05e 100644 --- a/app/tools/gimptexttool-editor.c +++ b/app/tools/gimptexttool-editor.c @@ -115,6 +115,9 @@ static gboolean gimp_text_tool_im_delete_surrounding static void gimp_text_tool_im_delete_preedit (GimpTextTool *text_tool); +static void gimp_text_tool_editor_copy_selection_to_clipboard + (GimpTextTool *text_tool); + /* public functions */ @@ -344,19 +347,7 @@ gimp_text_tool_editor_button_press (GimpTextTool *text_tool, void gimp_text_tool_editor_button_release (GimpTextTool *text_tool) { - GtkTextBuffer *buffer = GTK_TEXT_BUFFER (text_tool->buffer); - - if (gtk_text_buffer_get_has_selection (buffer)) - { - GimpTool *tool = GIMP_TOOL (text_tool); - GimpDisplayShell *shell = gimp_display_get_shell (tool->display); - GtkClipboard *clipboard; - - clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell), - GDK_SELECTION_PRIMARY); - - gtk_text_buffer_copy_clipboard (buffer, clipboard); - } + gimp_text_tool_editor_copy_selection_to_clipboard (text_tool); } void @@ -995,6 +986,7 @@ gimp_text_tool_move_cursor (GimpTextTool *text_tool, gimp_text_tool_reset_im_context (text_tool); gtk_text_buffer_select_range (buffer, &cursor, sel_start); + gimp_text_tool_editor_copy_selection_to_clipboard (text_tool); gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool)); } @@ -1651,3 +1643,22 @@ gimp_text_tool_im_delete_preedit (GimpTextTool *text_tool) text_tool->preedit_string = NULL; } } + +static void +gimp_text_tool_editor_copy_selection_to_clipboard (GimpTextTool *text_tool) +{ + GtkTextBuffer *buffer = GTK_TEXT_BUFFER (text_tool->buffer); + + if (! text_tool->editor_dialog && + gtk_text_buffer_get_has_selection (buffer)) + { + GimpTool *tool = GIMP_TOOL (text_tool); + GimpDisplayShell *shell = gimp_display_get_shell (tool->display); + GtkClipboard *clipboard; + + clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell), + GDK_SELECTION_PRIMARY); + + gtk_text_buffer_copy_clipboard (buffer, clipboard); + } +}