Solved. Someone have a example of how to create a custom widget with cairo in C? Thanks
-------- Mensagem original -------- Assunto: Fwd: GtkDrawingArea size request De: Rúben Rodrigues Para: gtk-app-devel-list@gnome.org CC: Someone received my question? Thanks -------- Mensagem reencaminhada -------- Assunto: GtkDrawingArea size request Data: Wed, 21 Jun 2017 10:08:15 +0100 De: Rúben Rodrigues <ruben...@live.com.pt><mailto:ruben...@live.com.pt> Para: gtk-app-devel-list@gnome.org<mailto:gtk-app-devel-list@gnome.org> <gtk-app-devel-list@gnome.org><mailto:gtk-app-devel-list@gnome.org> Hi, I create a drawing area to draw a circular gauge with cairo. GtkWidget *drawing_area = gtk_drawing_area_new (); gtk_widget_set_size_request (drawing_area, 100, 100); gtk_box_pack_start (GTK_BOX(gtk_builder_get_object(builder, "box30")),drawing_area,FALSE,TRUE,0); The problem is that the drawing area is not 100x100 but the entire of screen. This is the callback function: gboolean on_circular_gauge_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data) { int width, height; gint percentage, linewidth; width = gtk_widget_get_allocated_width (widget); height = gtk_widget_get_allocated_height (widget); linewidth = (MIN (width, height) / 2.0 * 30.0) / 100.0; cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.6); cairo_set_line_width (cr, linewidth); cairo_arc(cr, width/2.0, height/2.0, MIN (width, height) / 2.0 - linewidth, angle1, angle2); cairo_stroke (cr); cairo_set_source_rgba (cr, 0.0, 0.9, 0.0, 1.0); cairo_set_line_width (cr, linewidth); cairo_arc(cr, width/2.0, height/2.0, MIN (width, height) / 2.0 - linewidth, 180.0 * (M_PI/180.0),315.0 * (M_PI/180.0) ); cairo_stroke (cr); return FALSE; } [https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> Sem vírus. www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list