[gtk+/gestures] entry: Improve touch popover interaction
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gestures] entry: Improve touch popover interaction
- Date: Fri, 16 May 2014 15:48:27 +0000 (UTC)
commit 4e53298b17f68d50c036e9ea54ebe74813169c04
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri May 16 17:35:53 2014 +0200
entry: Improve touch popover interaction
Presses alternatively show and dismiss the popover, the popover is still
always shown invariably after any dragging happens (either text selection,
or dragging a text handle)
gtk/gtkentry.c | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 62144b7..7680137 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -4387,8 +4387,6 @@ gtk_entry_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
guint button;
gint tmp_pos;
- gtk_entry_selection_bubble_popup_unset (entry);
-
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), current);
@@ -4585,6 +4583,8 @@ gtk_entry_drag_gesture_update (GtkGestureDrag *gesture,
const GdkEvent *event;
gint x, y;
+ gtk_entry_selection_bubble_popup_unset (entry);
+
gesture_get_current_point (GTK_GESTURE_SINGLE (gesture), entry, &x, &y);
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
@@ -4741,15 +4741,21 @@ gtk_entry_drag_gesture_end (GtkGestureDrag *gesture,
if (priv->magnifier_popover)
gtk_widget_hide (priv->magnifier_popover);
- /* Check whether the drag was cancelled rather than finished */
- if (!gtk_gesture_handles_sequence (GTK_GESTURE (gesture), sequence))
- return;
-
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
source = gdk_event_get_source_device (event);
is_touchscreen = (test_touchscreen ||
gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN);
+ if (priv->selection_bubble &&
+ gtk_widget_get_visible (priv->selection_bubble))
+ gtk_entry_selection_bubble_popup_unset (entry);
+ else if (is_touchscreen)
+ gtk_entry_selection_bubble_popup_set (entry);
+
+ /* Check whether the drag was cancelled rather than finished */
+ if (!gtk_gesture_handles_sequence (GTK_GESTURE (gesture), sequence))
+ return;
+
if (in_drag)
{
gint tmp_pos = gtk_entry_find_position (entry, priv->drag_start_x);
@@ -4759,10 +4765,6 @@ gtk_entry_drag_gesture_end (GtkGestureDrag *gesture,
if (is_touchscreen)
gtk_entry_update_handles (entry, GTK_TEXT_HANDLE_MODE_CURSOR);
}
- else if (is_touchscreen)
- {
- gtk_entry_selection_bubble_popup_set (entry);
- }
gtk_entry_update_primary_selection (entry);
}
@@ -6661,7 +6663,11 @@ gtk_entry_handle_drag_finished (GtkTextHandle *handle,
GtkTextHandlePosition pos,
GtkEntry *entry)
{
- gtk_entry_selection_bubble_popup_set (entry);
+ if (entry->priv->selection_bubble &&
+ gtk_widget_get_visible (entry->priv->selection_bubble))
+ gtk_entry_selection_bubble_popup_unset (entry);
+ else
+ gtk_entry_selection_bubble_popup_set (entry);
if (entry->priv->magnifier_popover)
gtk_widget_hide (entry->priv->magnifier_popover);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]