Connect to draw instead of expose events

This commit is contained in:
Paul Dicker
2025-04-02 19:03:46 +02:00
committed by Stéphane Lesimple
parent e75d73c74a
commit 6c88a55600
11 changed files with 44 additions and 75 deletions

View File

@@ -141,12 +141,11 @@ static void redraw_spiral(cairo_t *cr, RS03Widgets *wl)
}
/*
* expose event handler for the spiral
* Draw event handler for the spiral
*/
static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{ cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(widget)));
RS03Widgets *wl = (RS03Widgets*)data;
static gboolean draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data)
{ RS03Widgets *wl = (RS03Widgets*)data;
GtkAllocation a = {0};
gtk_widget_get_allocation(widget, &a);
int w,h,size;
@@ -164,8 +163,7 @@ static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer dat
wl->cmpSpiral->mx = a.width / 2;
wl->cmpSpiral->my = (wl->cmpSpiral->diameter + a.height - size)/2;
if(!event->count) /* Exposure compression */
redraw_spiral(cr, wl); /* Redraw the spiral */
redraw_spiral(cr, wl); /* Redraw the spiral */
return TRUE;
}
@@ -273,7 +271,7 @@ void CreateRS03VerifyWindow(Method *self, GtkWidget *parent)
d_area = wl->cmpDrawingArea = gtk_drawing_area_new();
gtk_widget_set_size_request(d_area, wl->cmpSpiral->diameter+20, -1);
gtk_container_add(GTK_CONTAINER(frame), d_area);
g_signal_connect(G_OBJECT(d_area), "expose_event", G_CALLBACK(expose_cb), (gpointer)wl);
g_signal_connect(G_OBJECT(d_area), "draw", G_CALLBACK(draw_cb), (gpointer)wl);
/*** Image info */