summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2014-05-16 19:59:31 +0200
committerCarlos Garnacho <carlosg@gnome.org>2014-05-23 19:54:32 +0200
commit2ba89256f4436a2b4930709c5696008adc2d8b93 (patch)
tree88e2e93ad3aa4a66eb6d58d5d110956b0f41f93d
parentf322e55e19034e1076a28ae53b7c0147a23efb06 (diff)
downloadgtk+-2ba89256f4436a2b4930709c5696008adc2d8b93.tar.gz
texthandle: Make a bigger hit area around texthandles
The hit area now extends to all sides around the handle, instead of just towards where the text is. This makes it easier to grab handles once shown.
-rw-r--r--gtk/gtktexthandle.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 06347499dc..226198732e 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -102,11 +102,14 @@ _gtk_text_handle_draw (GtkTextHandle *handle,
priv = handle->priv;
context = gtk_widget_get_style_context (priv->parent);
+ _gtk_text_handle_get_size (handle, &width, &height);
cairo_save (cr);
if (pos == GTK_TEXT_HANDLE_POSITION_SELECTION_END)
- cairo_translate (cr, 0, priv->windows[pos].pointing_to.height);
+ cairo_translate (cr, width, priv->windows[pos].pointing_to.height);
+ else
+ cairo_translate (cr, width, height);
gtk_style_context_save (context);
gtk_style_context_add_class (context,
@@ -125,7 +128,6 @@ _gtk_text_handle_draw (GtkTextHandle *handle,
gtk_style_context_add_class (context,
GTK_STYLE_CLASS_TOP);
- _gtk_text_handle_get_size (handle, &width, &height);
gtk_render_background (context, cr, 0, 0, width, height);
gtk_style_context_restore (context);
@@ -313,6 +315,13 @@ _gtk_text_handle_update (GtkTextHandle *handle,
rect.width = width;
rect.height = 0;
+ /* Make the window 3 times as wide, and 2 times as high (plus
+ * handle_window->pointing_to.height), the handle will be rendered
+ * in the center. Making the rest an invisible input area.
+ */
+ width *= 3;
+ height *= 2;
+
_handle_update_child_visible (handle, pos);
window = gtk_widget_get_parent (handle_window->widget);