[gtk+] Cosmetic: Avoid explicit state variables
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Cosmetic: Avoid explicit state variables
- Date: Sat, 14 Nov 2015 17:56:56 +0000 (UTC)
commit 38be852beecf77978ef4496716c4eb1295470d55
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Nov 14 10:29:39 2015 -0500
Cosmetic: Avoid explicit state variables
Using the state of the context makes this more obviously correct.
gtk/gtktextutil.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index c6632a6..27dadd5 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -201,12 +201,11 @@ limit_layout_lines (PangoLayout *layout)
* Returns: a #cairo_surface_t to use as DND icon
*/
cairo_surface_t *
-_gtk_text_util_create_drag_icon (GtkWidget *widget,
+_gtk_text_util_create_drag_icon (GtkWidget *widget,
gchar *text,
gsize len)
{
GtkStyleContext *style_context;
- GtkStateFlags state;
cairo_surface_t *surface;
PangoContext *context;
PangoLayout *layout;
@@ -236,15 +235,15 @@ _gtk_text_util_create_drag_icon (GtkWidget *widget,
pixmap_width = layout_width / PANGO_SCALE;
pixmap_height = layout_height / PANGO_SCALE;
- style_context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
CAIRO_CONTENT_COLOR_ALPHA,
pixmap_width, pixmap_height);
cr = cairo_create (surface);
- gtk_style_context_get_color (style_context, state, &color);
+ style_context = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_color (style_context,
+ gtk_style_context_get_state (style_context),
+ &color);
gdk_cairo_set_source_rgba (cr, &color);
pango_cairo_show_layout (cr, layout);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]