[gtkglarea] examples: Use more accessor funtions



commit 39e12b9e72f1e835ec76abb427b10ce759463e68
Author: Javier Jardón <javier jardon codethink co uk>
Date:   Thu Mar 20 13:12:08 2014 +0000

    examples: Use more accessor funtions

 examples/gtkglarea_demo.c |    6 ++++--
 examples/shaders.c        |    6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/examples/gtkglarea_demo.c b/examples/gtkglarea_demo.c
index 6f146bd..6d2cb93 100644
--- a/examples/gtkglarea_demo.c
+++ b/examples/gtkglarea_demo.c
@@ -355,8 +355,10 @@ gint glarea_draw (GtkWidget* widget, GdkEventExpose* event) {
 
 gint glarea_reshape (GtkWidget* widget, GdkEventConfigure* event) {
 
-  int w = widget->allocation.width;
-  int h = widget->allocation.height;
+  GtkAllocation allocation;
+  gtk_widget_get_allocation (widget, &allocation);
+  int w = allocation.width;
+  int h = allocation.height;
 
   g_print ("Reshape Event\n");
 
diff --git a/examples/shaders.c b/examples/shaders.c
index 6101016..b6abfed 100644
--- a/examples/shaders.c
+++ b/examples/shaders.c
@@ -323,8 +323,10 @@ gint glarea_draw (GtkWidget* widget, GdkEventExpose* event) {
 
 gint glarea_reshape (GtkWidget* widget, GdkEventConfigure* event) {
 
-  int w = widget->allocation.width;
-  int h = widget->allocation.height;
+  GtkAllocation allocation;
+  gtk_widget_get_allocation (widget, &allocation);
+  int w = allocation.width;
+  int h = allocation.height;
 
   if (gtk_gl_area_make_current (GTK_GL_AREA(widget))) {
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]