diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2016-03-15 17:46:06 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2016-03-22 14:35:22 -0300 |
commit | f9fb45c791215237ba75b64002289c8885be4fd4 (patch) | |
tree | abc0a650f70574dd2610381db78054d79bae70de /gladeui | |
parent | badaef0484089f9ea1db6b804dd9764cfd8b8881 (diff) | |
download | glade-f9fb45c791215237ba75b64002289c8885be4fd4.tar.gz |
GladeDesignLayout: fixed regresion drawing nodes and pushpin in margins and alginment edit modes.
_glade_design_layout_get_colors() removed context parameter.
Diffstat (limited to 'gladeui')
-rw-r--r-- | gladeui/glade-design-layout.c | 23 | ||||
-rw-r--r-- | gladeui/glade-design-private.h | 3 | ||||
-rw-r--r-- | gladeui/glade-utils.c | 12 |
3 files changed, 18 insertions, 20 deletions
diff --git a/gladeui/glade-design-layout.c b/gladeui/glade-design-layout.c index 28d93363..b5970ce0 100644 --- a/gladeui/glade-design-layout.c +++ b/gladeui/glade-design-layout.c @@ -1776,8 +1776,7 @@ glade_design_layout_style_updated (GtkWidget *widget) { GladeDesignLayoutPrivate *priv = GLADE_DESIGN_LAYOUT_PRIVATE (widget); - _glade_design_layout_get_colors (gtk_widget_get_style_context (widget), - &priv->frame_color[0], + _glade_design_layout_get_colors (&priv->frame_color[0], &priv->frame_color[1], &priv->frame_color_active[0], &priv->frame_color_active[1]); @@ -2176,27 +2175,37 @@ _glade_design_layout_coords_from_event (GdkWindow *parent, } void -_glade_design_layout_get_colors (GtkStyleContext *context, - GdkRGBA *c1, GdkRGBA *c2, +_glade_design_layout_get_colors (GdkRGBA *c1, GdkRGBA *c2, GdkRGBA *c3, GdkRGBA *c4) { + GtkStyleContext *context = gtk_style_context_new (); + GtkWidgetPath *path = gtk_widget_path_new (); gfloat off; - gtk_style_context_save (context); + /* Fake style context */ + gtk_widget_path_append_type (path, GTK_TYPE_WIDGET); + gtk_style_context_set_path (context, path); + gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW); + + /* Get colors */ gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), c1); gtk_style_context_get_color (context, gtk_style_context_get_state (context), c2); - gtk_style_context_set_state (context, gtk_style_context_get_state (context) | GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED); + gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL | GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED); + gtk_style_context_set_state (context, gtk_style_context_get_state (context)); gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), c3); gtk_style_context_get_color (context, gtk_style_context_get_state (context), c4); - gtk_style_context_restore (context); off = ((c1->red + c1->green + c1->blue)/3 < .5) ? .16 : -.16; c1->red += off; c1->green += off; c1->blue += off; + + /* Free resources */ + gtk_widget_path_free (path); + g_object_unref (context); } void diff --git a/gladeui/glade-design-private.h b/gladeui/glade-design-private.h index 708869d2..8b61460c 100644 --- a/gladeui/glade-design-private.h +++ b/gladeui/glade-design-private.h @@ -34,8 +34,7 @@ G_BEGIN_DECLS void _glade_design_view_freeze (GladeDesignView *view); void _glade_design_view_thaw (GladeDesignView *view); -void _glade_design_layout_get_colors (GtkStyleContext *context, - GdkRGBA *c1, GdkRGBA *c2, +void _glade_design_layout_get_colors (GdkRGBA *c1, GdkRGBA *c2, GdkRGBA *c3, GdkRGBA *c4); void _glade_design_layout_draw_node (cairo_t *cr, diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c index 791dbe53..6fbc5d2d 100644 --- a/gladeui/glade-utils.c +++ b/gladeui/glade-utils.c @@ -1841,10 +1841,8 @@ draw_pointer (cairo_t *cr) GdkPixbuf * glade_utils_pointer_mode_render_icon (GladePointerMode mode, GtkIconSize size) { - GtkStyleContext *ctx = gtk_style_context_new (); GdkRGBA c1, c2, fg, bg; cairo_surface_t *surface; - GtkWidgetPath *path; gint width, height; GdkPixbuf *pix; cairo_t *cr; @@ -1855,16 +1853,8 @@ glade_utils_pointer_mode_render_icon (GladePointerMode mode, GtkIconSize size) cr = cairo_create (surface); cairo_scale (cr, width/24.0, height/24.0); - /* Get Style context */ - path = gtk_widget_path_new (); - gtk_widget_path_append_type (path, GTK_TYPE_WIDGET); - gtk_style_context_set_path (ctx, path); - gtk_style_context_add_class (ctx, GTK_STYLE_CLASS_VIEW); - gtk_widget_path_free (path); - /* Now get colors */ - _glade_design_layout_get_colors (ctx, &bg, &fg, &c1, &c2); - g_object_unref (ctx); + _glade_design_layout_get_colors (&bg, &fg, &c1, &c2); /* Clear surface */ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); |