gtk_widget_get_modifier_mask (widget,
GDK_MODIFIER_INTENT_EXTEND_SELECTION));
+ if (extend_selection)
+ gtk_entry_reset_im_context (entry);
+
switch (n_press)
{
case 1:
else
gtk_entry_selection_bubble_popup_set (entry);
}
+ else if (extend_selection)
+ {
+ /* 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);
+
+ /* all done, so skip the extend_to_left stuff later */
+ extend_selection = FALSE;
+ }
else
{
- /* Click inside the selection - we'll either start a drag, or
- * clear the selection
- */
+ /* We'll either start a drag, or clear the selection */
priv->in_drag = TRUE;
priv->drag_start_x = x;
priv->drag_start_y = y;
- }
+ }
}
else
{
}
else
{
- gtk_entry_reset_im_context (entry);
-
- if (!have_selection) /* select from the current position to the clicked position */
+ /* select from the current position to the clicked position */
+ if (!have_selection)
sel_start = sel_end = priv->current_pos;
- if (tmp_pos > sel_start && tmp_pos < sel_end)
- {
- /* 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);
- }
+ gtk_entry_set_positions (entry, tmp_pos, tmp_pos);
}
}
break;
+
case 2:
priv->select_words = TRUE;
gtk_entry_select_word (entry);
if (is_touchscreen)
mode = GTK_TEXT_HANDLE_MODE_SELECTION;
break;
+
case 3:
priv->select_lines = TRUE;
gtk_entry_select_line (entry);
if (is_touchscreen)
mode = GTK_TEXT_HANDLE_MODE_SELECTION;
break;
+
default:
break;
}