Commit b08b6c6a authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

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

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


svn path=/trunk/; revision=21582
parent 3a4fea33
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
2008-10-02 Matthias Clasen <mclasen@redhat.com> 2008-10-02 Matthias Clasen <mclasen@redhat.com>
Bug 530575 – GtkEntry with invisible chars has a confused cursor in Bug 530575 – GtkEntry with invisible chars has a confused cursor in
......
...@@ -2082,7 +2082,8 @@ gtk_entry_motion_notify (GtkWidget *widget, ...@@ -2082,7 +2082,8 @@ gtk_entry_motion_notify (GtkWidget *widget,
if (entry->in_drag) 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, entry->drag_start_x, entry->drag_start_y,
event->x + entry->scroll_offset, event->y)) event->x + entry->scroll_offset, event->y))
{ {
...@@ -2094,11 +2095,8 @@ gtk_entry_motion_notify (GtkWidget *widget, ...@@ -2094,11 +2095,8 @@ gtk_entry_motion_notify (GtkWidget *widget,
gtk_target_list_add_text_targets (target_list, 0); 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, context = gtk_drag_begin (widget, target_list, actions,
entry->button, (GdkEvent *)event); entry->button, (GdkEvent *)event);
...@@ -3127,6 +3125,12 @@ gtk_entry_copy_clipboard (GtkEntry *entry) ...@@ -3127,6 +3125,12 @@ gtk_entry_copy_clipboard (GtkEntry *entry)
if (gtk_editable_get_selection_bounds (editable, &start, &end)) 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); gchar *str = gtk_entry_get_public_chars (entry, start, end);
gtk_clipboard_set_text (gtk_widget_get_clipboard (GTK_WIDGET (entry), gtk_clipboard_set_text (gtk_widget_get_clipboard (GTK_WIDGET (entry),
GDK_SELECTION_CLIPBOARD), GDK_SELECTION_CLIPBOARD),
...@@ -3141,6 +3145,12 @@ gtk_entry_cut_clipboard (GtkEntry *entry) ...@@ -3141,6 +3145,12 @@ gtk_entry_cut_clipboard (GtkEntry *entry)
GtkEditable *editable = GTK_EDITABLE (entry); GtkEditable *editable = GTK_EDITABLE (entry);
gint start, end; gint start, end;
if (!entry->visible)
{
gtk_widget_error_bell (GTK_WIDGET (entry));
return;
}
gtk_entry_copy_clipboard (entry); gtk_entry_copy_clipboard (entry);
if (entry->editable) if (entry->editable)
...@@ -5480,9 +5490,9 @@ popup_targets_received (GtkClipboard *clipboard, ...@@ -5480,9 +5490,9 @@ popup_targets_received (GtkClipboard *clipboard,
popup_menu_detach); popup_menu_detach);
append_action_signal (entry, entry->popup_menu, GTK_STOCK_CUT, "cut-clipboard", 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", 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", append_action_signal (entry, entry->popup_menu, GTK_STOCK_PASTE, "paste-clipboard",
entry->editable && clipboard_contains_text); entry->editable && clipboard_contains_text);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment