diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-08-30 14:56:28 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-08-30 14:56:28 +0900 |
commit | 54d44a9bd04cfbed8426614fc69c027a46f41a14 (patch) | |
tree | 34bdf65a6e8d5d6d4016154345d1d803ba0da379 /tests/testellipsise.c | |
parent | b3b22c31b997fb85b3319b392a1a69407703184c (diff) | |
parent | 67194ed77b153eb5a7eb6c596f3c20e274b7787a (diff) | |
download | gtk+-native-layout.tar.gz |
Merge branch 'master' into native-layoutnative-layout
Conflicts:
gtk/gtkplug.c
gtk/gtkscrolledwindow.c
Diffstat (limited to 'tests/testellipsise.c')
-rw-r--r-- | tests/testellipsise.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/testellipsise.c b/tests/testellipsise.c index 805998c1c0..1020456479 100644 --- a/tests/testellipsise.c +++ b/tests/testellipsise.c @@ -70,17 +70,20 @@ ebox_expose_event_cb (GtkWidget *widget, { PangoLayout *layout; const double dashes[] = { 6, 18 }; + GtkAllocation allocation, label_allocation; GtkRequisition minimum_size, natural_size; GtkWidget *label = data; cairo_t *cr; gint x, y; - cr = gdk_cairo_create (widget->window); + cr = gdk_cairo_create (gtk_widget_get_window (widget)); cairo_translate (cr, -0.5, -0.5); cairo_set_line_width (cr, 1); + gtk_widget_get_allocation (widget, &allocation); + cairo_set_source_rgb (cr, 1, 1, 1); - cairo_rectangle (cr, 0, 0, widget->allocation.width, widget->allocation.height); + cairo_rectangle (cr, 0, 0, allocation.width, allocation.height); cairo_fill (cr); gtk_widget_translate_coordinates (label, widget, 0, 0, &x, &y); @@ -97,22 +100,24 @@ ebox_expose_event_cb (GtkWidget *widget, pango_cairo_show_layout (cr, layout); g_object_unref (layout); + gtk_widget_get_allocation (label, &label_allocation); + cairo_rectangle (cr, - x + 0.5 * (label->allocation.width - minimum_size.width), - y + 0.5 * (label->allocation.height - minimum_size.height), + x + 0.5 * (label_allocation.width - minimum_size.width), + y + 0.5 * (label_allocation.height - minimum_size.height), minimum_size.width, minimum_size.height); cairo_set_source_rgb (cr, 0.8, 0.2, 0.2); cairo_set_dash (cr, NULL, 0, 0); cairo_stroke (cr); - cairo_rectangle (cr, x, y, label->allocation.width, label->allocation.height); + cairo_rectangle (cr, x, y, label_allocation.width, label_allocation.height); cairo_set_source_rgb (cr, 0.2, 0.2, 0.8); cairo_set_dash (cr, dashes, 2, 0.5); cairo_stroke (cr); cairo_rectangle (cr, - x + 0.5 * (label->allocation.width - natural_size.width), - y + 0.5 * (label->allocation.height - natural_size.height), + x + 0.5 * (label_allocation.width - natural_size.width), + y + 0.5 * (label_allocation.height - natural_size.height), natural_size.width, natural_size.height); cairo_set_source_rgb (cr, 0.2, 0.8, 0.2); cairo_set_dash (cr, dashes, 2, 12.5); |