When shift-clicking, keep the larger part of the selection selected.

2006-12-24  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkentry.c (gtk_entry_button_press): When
        shift-clicking, keep the larger part of the selection
        selected.  (#353709, Benjamin Otte)

        * gtk/gtkbutton.c (gtk_button_get_props): Use
        gtk_border_free when freeing borders.
This commit is contained in:
Matthias Clasen 2006-12-24 06:32:07 +00:00 committed by Matthias Clasen
parent 650fd1fd27
commit a9d25d6235
3 changed files with 16 additions and 6 deletions

View File

@ -1,5 +1,12 @@
2006-12-24 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkentry.c (gtk_entry_button_press): When
shift-clicking, keep the larger part of the selection
selected. (#353709, Benjamin Otte)
* gtk/gtkbutton.c (gtk_button_get_props): Use
gtk_border_free when freeing borders.
* gtk/gtkbutton.c (gtk_button_grab_notify): Be more
careful when faking a button release. (#323146,
Travis Abbott)

View File

@ -1057,7 +1057,7 @@ gtk_button_get_props (GtkButton *button,
if (tmp_border)
{
*default_border = *tmp_border;
g_free (tmp_border);
gtk_border_free (tmp_border);
}
else
*default_border = default_default_border;
@ -1070,7 +1070,7 @@ gtk_button_get_props (GtkButton *button,
if (tmp_border)
{
*default_outside_border = *tmp_border;
g_free (tmp_border);
gtk_border_free (tmp_border);
}
else
*default_outside_border = default_default_outside_border;
@ -1083,7 +1083,7 @@ gtk_button_get_props (GtkButton *button,
if (tmp_border)
{
*inner_border = *tmp_border;
g_free (tmp_border);
gtk_border_free (tmp_border);
}
else
*inner_border = default_inner_border;

View File

@ -1665,8 +1665,11 @@ gtk_entry_button_press (GtkWidget *widget,
if (tmp_pos > sel_start && tmp_pos < sel_end)
{
/* Truncate current selection */
gtk_entry_set_positions (entry, tmp_pos, -1);
/* Truncate current selection, but keep it as big as possible */
if (tmp_pos - sel_start > sel_end - tmp_pos)
gtk_entry_set_positions (entry, sel_start, tmp_pos);
else
gtk_entry_set_positions (entry, tmp_pos, sel_end);
}
else
{
@ -3608,7 +3611,7 @@ gtk_entry_find_position (GtkEntry *entry,
PangoLayoutLine *line;
gint index;
gint pos;
gboolean trailing;
gint trailing;
const gchar *text;
gint cursor_index;