summaryrefslogtreecommitdiff
path: root/gtk/gtktexthandle.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2016-10-04 21:13:29 +0200
committerBenjamin Otte <otte@redhat.com>2016-10-16 18:17:21 +0200
commit9f5baf9130cdd75fcb79b70e6a7bdebab45f1916 (patch)
treefb411ddec2719b25c2f1eb5e02206729a51e6b5c /gtk/gtktexthandle.c
parent999d45b4e8cc8874fcbbf2f0ac0fc075081b8583 (diff)
downloadgtk+-9f5baf9130cdd75fcb79b70e6a7bdebab45f1916.tar.gz
GtkTextHandle: Use min-width/min-height
instead of GtkWidget's text-handle-width/text-handle-height style properties
Diffstat (limited to 'gtk/gtktexthandle.c')
-rw-r--r--gtk/gtktexthandle.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index cc98d226a0..4e9e359a5d 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -76,24 +76,27 @@ static void _gtk_text_handle_update (GtkTextHandle *handle,
GtkTextHandlePosition pos);
static void
-_gtk_text_handle_get_size (GtkTextHandle *handle,
- gint *width,
- gint *height)
+_gtk_text_handle_get_size (GtkTextHandle *handle,
+ GtkTextHandlePosition pos,
+ gint *width,
+ gint *height)
{
- GtkTextHandlePrivate *priv;
- gint w, h;
+ GtkTextHandlePrivate *priv = handle->priv;
+ GtkWidget *widget = priv->windows[pos].widget;
+ GtkStyleContext *context;
- priv = handle->priv;
+ context = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_get (context,
+ gtk_style_context_get_state (context),
+ "min-width",
+ width, NULL);
- gtk_widget_style_get (priv->parent,
- "text-handle-width", &w,
- "text-handle-height", &h,
- NULL);
- if (width)
- *width = w;
- if (height)
- *height = h;
+ gtk_style_context_get (context,
+ gtk_style_context_get_state (context),
+ "min-height",
+ height, NULL);
}
static void
@@ -110,7 +113,7 @@ _gtk_text_handle_draw (GtkTextHandle *handle,
handle_window = &priv->windows[pos];
context = gtk_widget_get_style_context (handle_window->widget);
- _gtk_text_handle_get_size (handle, &width, &height);
+ _gtk_text_handle_get_size (handle, pos, &width, &height);
cairo_save (cr);
cairo_translate (cr, handle_window->border.left, handle_window->border.top);
@@ -232,7 +235,7 @@ gtk_text_handle_widget_event (GtkWidget *widget,
window = gtk_widget_get_parent (priv->windows[pos].widget);
gtk_widget_get_allocation (priv->windows[pos].widget, &allocation);
- _gtk_text_handle_get_size (handle, &handle_width, &handle_height);
+ _gtk_text_handle_get_size (handle, pos, &handle_width, &handle_height);
_gtk_window_get_popover_position (GTK_WINDOW (window),
priv->windows[pos].widget,
@@ -383,7 +386,7 @@ _gtk_text_handle_update (GtkTextHandle *handle,
gint w, h;
_gtk_text_handle_ensure_widget (handle, pos);
- _gtk_text_handle_get_size (handle, &width, &height);
+ _gtk_text_handle_get_size (handle, pos, &width, &height);
border->top = height;
border->bottom = height;