gtk+ r21582 - in trunk: . gtk



Author: matthiasc
Date: Fri Oct  3 02:01:58 2008
New Revision: 21582
URL: http://svn.gnome.org/viewvc/gtk+?rev=21582&view=rev

Log:
2008-10-02  Matthias Clasen <mclasen redhat com>

        Bug 96431 â Can't cut and paste / DND within invisible entry

        * gtk/gtkentry.c: Disable cut, copy and drag out of an invisible
        entry. Proposed by Owen Taylor



Modified:
   trunk/ChangeLog
   trunk/gtk/gtkentry.c

Modified: trunk/gtk/gtkentry.c
==============================================================================
--- trunk/gtk/gtkentry.c	(original)
+++ trunk/gtk/gtkentry.c	Fri Oct  3 02:01:58 2008
@@ -2082,7 +2082,8 @@
 
   if (entry->in_drag)
     {
-      if (gtk_drag_check_threshold (widget,
+      if (entry->visible &&
+          gtk_drag_check_threshold (widget,
                                     entry->drag_start_x, entry->drag_start_y,
                                     event->x + entry->scroll_offset, event->y))
         {
@@ -2094,11 +2095,8 @@
 
           gtk_target_list_add_text_targets (target_list, 0);
 
-          if (entry->visible)
-            {
-              text = _gtk_entry_get_selected_text (entry);
-              pixmap = _gtk_text_util_create_drag_icon (widget, text, -1);
-            }
+          text = _gtk_entry_get_selected_text (entry);
+          pixmap = _gtk_text_util_create_drag_icon (widget, text, -1);
 
           context = gtk_drag_begin (widget, target_list, actions,
                                     entry->button, (GdkEvent *)event);
@@ -3127,6 +3125,12 @@
 
   if (gtk_editable_get_selection_bounds (editable, &start, &end))
     {
+      if (!entry->visible)
+        {
+          gtk_widget_error_bell (GTK_WIDGET (entry));
+          return;
+        }
+
       gchar *str = gtk_entry_get_public_chars (entry, start, end);
       gtk_clipboard_set_text (gtk_widget_get_clipboard (GTK_WIDGET (entry),
 							GDK_SELECTION_CLIPBOARD),
@@ -3141,6 +3145,12 @@
   GtkEditable *editable = GTK_EDITABLE (entry);
   gint start, end;
 
+  if (!entry->visible)
+    {
+      gtk_widget_error_bell (GTK_WIDGET (entry));
+      return;
+    }
+
   gtk_entry_copy_clipboard (entry);
 
   if (entry->editable)
@@ -5480,9 +5490,9 @@
 				 popup_menu_detach);
       
       append_action_signal (entry, entry->popup_menu, GTK_STOCK_CUT, "cut-clipboard",
-			    entry->editable && entry->current_pos != entry->selection_bound);
+			    entry->editable && entry->visible && entry->current_pos != entry->selection_bound);
       append_action_signal (entry, entry->popup_menu, GTK_STOCK_COPY, "copy-clipboard",
-			    entry->current_pos != entry->selection_bound);
+			    entry->visible && entry->current_pos != entry->selection_bound);
       append_action_signal (entry, entry->popup_menu, GTK_STOCK_PASTE, "paste-clipboard",
 			    entry->editable && clipboard_contains_text);
       



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