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; } --- Este e-mail foi verificado em termos de vírus pelo software antivírus Avast. https://www.avast.com/antivirus _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list