[gimp/gimp-2-8] Bug 675748: Text tool: text editor inhibits text...



commit 95a852c433493bd3d48a8cbf2ab0ec53daf78e2e
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Sat Jul 16 16:28:35 2016 +0200

    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 <Shift>-left/right.
    
    (cherry picked from commit aa293ae9a7a922908fdb653298aa82ad3b20e33c)

 app/tools/gimptexttool-editor.c |   37 ++++++++++++++++++++++++-------------
 1 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index 2b7a3a4..ddc5748 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -103,6 +103,9 @@ static void   gimp_text_tool_im_preedit_end     (GtkIMContext    *context,
 static void   gimp_text_tool_im_preedit_changed (GtkIMContext    *context,
                                                  GimpTextTool    *text_tool);
 
+static void     gimp_text_tool_editor_copy_selection_to_clipboard
+                                                  (GimpTextTool    *text_tool);
+
 
 /*  public functions  */
 
@@ -323,19 +326,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
@@ -930,6 +921,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));
 }
@@ -1411,3 +1403,22 @@ gimp_text_tool_im_preedit_changed (GtkIMContext *context,
     gtk_label_set_text (GTK_LABEL (text_tool->preedit_label),
                         text_tool->preedit_string);
 }
+
+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);
+    }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]