[gtk+] entry: Hide popover when touching elsewhere
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] entry: Hide popover when touching elsewhere
- Date: Mon, 8 Jun 2015 10:59:19 +0000 (UTC)
commit 3e386e0abb79c1f291adf52879e22ff1dda7499e
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 7 20:41:16 2015 -0400
entry: Hide popover when touching elsewhere
Otherwise, the popover becomes 'sticky' and hard-to-dismiss.
gtk/gtkentry.c | 33 +++++++++++++++++++--------------
1 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index de4ec31..14328ac 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -4506,24 +4506,29 @@ gtk_entry_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
priv->drag_start_y = y;
}
}
- else if (!extend_selection)
- {
- gtk_editable_set_position (editable, tmp_pos);
- }
else
{
- gtk_entry_reset_im_context (entry);
-
- if (!have_selection) /* select from the current position to the clicked position */
- sel_start = sel_end = priv->current_pos;
+ gtk_entry_selection_bubble_popup_unset (entry);
- if (tmp_pos > sel_start && tmp_pos < sel_end)
+ 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);
+ gtk_editable_set_position (editable, tmp_pos);
+ }
+ else
+ {
+ gtk_entry_reset_im_context (entry);
+
+ if (!have_selection) /* select from the current position to the clicked position */
+ 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);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]