diff options
author | Javier Jardón <jjardon@gnome.org> | 2010-08-11 23:13:46 +0200 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2010-08-22 22:56:12 +0200 |
commit | 379fc17fa9c598f1a219d923861b7d469b0e4b13 (patch) | |
tree | 6b4fb4462dbc3db7370469e962499afd771fa7a7 /gtk/gtkdrawingarea.c | |
parent | 4ddff2691be8f4ec6087bcfd925a281286c5991a (diff) | |
download | gtk+-379fc17fa9c598f1a219d923861b7d469b0e4b13.tar.gz |
gtk/gtkdrawingarea.c: use accessor functions to access GtkWidget
Diffstat (limited to 'gtk/gtkdrawingarea.c')
-rw-r--r-- | gtk/gtkdrawingarea.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c index e5968f790b..6357ca649d 100644 --- a/gtk/gtkdrawingarea.c +++ b/gtk/gtkdrawingarea.c @@ -62,6 +62,8 @@ static void gtk_drawing_area_realize (GtkWidget *widget) { GtkDrawingArea *darea = GTK_DRAWING_AREA (widget); + GtkAllocation allocation; + GdkWindow *window; GdkWindowAttr attributes; gint attributes_mask; @@ -73,11 +75,13 @@ gtk_drawing_area_realize (GtkWidget *widget) { gtk_widget_set_realized (widget, TRUE); + gtk_widget_get_allocation (widget, &allocation); + attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = widget->allocation.x; - attributes.y = widget->allocation.y; - attributes.width = widget->allocation.width; - attributes.height = widget->allocation.height; + attributes.x = allocation.x; + attributes.y = allocation.y; + attributes.width = allocation.width; + attributes.height = allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); @@ -85,12 +89,13 @@ gtk_drawing_area_realize (GtkWidget *widget) attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), - &attributes, attributes_mask); - gdk_window_set_user_data (widget->window, darea); + window = gdk_window_new (gtk_widget_get_parent_window (widget), + &attributes, attributes_mask); + gdk_window_set_user_data (window, darea); + gtk_widget_set_window (widget, window); - widget->style = gtk_style_attach (widget->style, widget->window); - gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); + gtk_widget_style_attach (widget); + gtk_style_set_background (gtk_widget_get_style (widget), window, GTK_STATE_NORMAL); } gtk_drawing_area_send_configure (GTK_DRAWING_AREA (widget)); @@ -103,12 +108,12 @@ gtk_drawing_area_size_allocate (GtkWidget *widget, g_return_if_fail (GTK_IS_DRAWING_AREA (widget)); g_return_if_fail (allocation != NULL); - widget->allocation = *allocation; + gtk_widget_set_allocation (widget, allocation); if (gtk_widget_get_realized (widget)) { if (gtk_widget_get_has_window (widget)) - gdk_window_move_resize (widget->window, + gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x, allocation->y, allocation->width, allocation->height); @@ -119,17 +124,19 @@ gtk_drawing_area_size_allocate (GtkWidget *widget, static void gtk_drawing_area_send_configure (GtkDrawingArea *darea) { + GtkAllocation allocation; GtkWidget *widget; GdkEvent *event = gdk_event_new (GDK_CONFIGURE); widget = GTK_WIDGET (darea); + gtk_widget_get_allocation (widget, &allocation); - event->configure.window = g_object_ref (widget->window); + event->configure.window = g_object_ref (gtk_widget_get_window (widget)); event->configure.send_event = TRUE; - event->configure.x = widget->allocation.x; - event->configure.y = widget->allocation.y; - event->configure.width = widget->allocation.width; - event->configure.height = widget->allocation.height; + event->configure.x = allocation.x; + event->configure.y = allocation.y; + event->configure.width = allocation.width; + event->configure.height = allocation.height; gtk_widget_event (widget, event); gdk_event_free (event); |