summaryrefslogtreecommitdiff
path: root/demos/gtk-demo/rotated_text.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2010-08-30 14:56:28 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-08-30 14:56:28 +0900
commit54d44a9bd04cfbed8426614fc69c027a46f41a14 (patch)
tree34bdf65a6e8d5d6d4016154345d1d803ba0da379 /demos/gtk-demo/rotated_text.c
parentb3b22c31b997fb85b3319b392a1a69407703184c (diff)
parent67194ed77b153eb5a7eb6c596f3c20e274b7787a (diff)
downloadgtk+-native-layout.tar.gz
Merge branch 'master' into native-layoutnative-layout
Conflicts: gtk/gtkplug.c gtk/gtkscrolledwindow.c
Diffstat (limited to 'demos/gtk-demo/rotated_text.c')
-rw-r--r--demos/gtk-demo/rotated_text.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/demos/gtk-demo/rotated_text.c b/demos/gtk-demo/rotated_text.c
index b83b2c302b..4450ab0bff 100644
--- a/demos/gtk-demo/rotated_text.c
+++ b/demos/gtk-demo/rotated_text.c
@@ -99,6 +99,8 @@ rotated_text_expose_event (GtkWidget *widget,
#define N_WORDS 5
#define FONT "Serif 18"
+ GtkAllocation allocation;
+
PangoContext *context;
PangoLayout *layout;
PangoFontDescription *desc;
@@ -108,16 +110,20 @@ rotated_text_expose_event (GtkWidget *widget,
PangoAttrList *attrs;
- int width = widget->allocation.width;
- int height = widget->allocation.height;
+ int width;
+ int height;
double device_radius;
int i;
+ gtk_widget_get_allocation (widget, &allocation);
+ width = allocation.width;
+ height = allocation.height;
+
/* Create a cairo context and set up a transformation matrix so that the user
* space coordinates for the centered square where we draw are [-RADIUS, RADIUS],
* [-RADIUS, RADIUS].
* We first center, then change the scale. */
- cr = gdk_cairo_create (widget->window);
+ cr = gdk_cairo_create (gtk_widget_get_window (widget));
device_radius = MIN (width, height) / 2.;
cairo_translate (cr,
device_radius + (width - 2 * device_radius) / 2,