[gtk+/touch-text-selection] entry: Optionally update handles on focus in
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/touch-text-selection] entry: Optionally update handles on focus in
- Date: Fri, 24 Aug 2012 17:15:59 +0000 (UTC)
commit 89e420b3905deac199ca58ad882d6d9ebdc52961
Author: Carlos Garnacho <carlos lanedo com>
Date: Fri Aug 24 19:12:27 2012 +0200
entry: Optionally update handles on focus in
This is so toplevels being moved/resized don't leave a selection
with no possibility of being further manipulated
gtk/gtkentry.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index d6c9d0b..9bd808c 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -220,6 +220,7 @@ struct _GtkEntryPrivate
guint truncate_multiline : 1;
guint cursor_handle_dragged : 1;
guint selection_handle_dragged : 1;
+ guint update_handles_on_focus : 1;
};
struct _EntryIconInfo
@@ -4026,7 +4027,14 @@ gtk_entry_button_press (GtkWidget *widget,
else if (event->button == GDK_BUTTON_PRIMARY)
{
gboolean have_selection = gtk_editable_get_selection_bounds (editable, &sel_start, &sel_end);
+ gboolean is_touchscreen;
+ GdkDevice *source;
+
+ source = gdk_event_get_source_device ((GdkEvent *) event);
+ is_touchscreen = test_touchscreen ||
+ gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN;
+ priv->update_handles_on_focus = is_touchscreen;
priv->select_words = FALSE;
priv->select_lines = FALSE;
@@ -4105,13 +4113,9 @@ gtk_entry_button_press (GtkWidget *widget,
}
else
{
- GdkDevice *source;
-
gtk_editable_set_position (editable, tmp_pos);
- source = gdk_event_get_source_device ((GdkEvent *) event);
- if (test_touchscreen ||
- gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN)
+ if (is_touchscreen)
{
priv->cursor_handle_dragged = TRUE;
_gtk_entry_update_handles (entry, GTK_TEXT_HANDLE_MODE_CURSOR);
@@ -4548,6 +4552,10 @@ gtk_entry_focus_in (GtkWidget *widget,
gtk_entry_check_cursor_blink (entry);
}
+ if (priv->update_handles_on_focus &&
+ gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), NULL, NULL))
+ _gtk_entry_update_handles (entry, GTK_TEXT_HANDLE_MODE_SELECTION);
+
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]