diff -r 7ada3db4cfa8 -r 9af327d0e0e4 ui/gtk/draw_cairo.c --- a/ui/gtk/draw_cairo.c Fri Jun 14 18:24:31 2024 +0200 +++ b/ui/gtk/draw_cairo.c Sun Jun 16 11:36:27 2024 +0200 @@ -33,11 +33,16 @@ #include "draw_cairo.h" -#ifdef UI_GTK3 +#if UI_GTK3 || UI_GTK4 gboolean ui_drawingarea_expose(GtkWidget *w, cairo_t *cr, void *data) { UiCairoGraphics g; +#ifdef UI_GTK4 + g.g.width = gtk_widget_get_width(w); + g.g.height = gtk_widget_get_height(w); +#else g.g.width = gtk_widget_get_allocated_width(w); g.g.height = gtk_widget_get_allocated_height(w); +#endif g.widget = w; g.cr = cr; @@ -51,7 +56,8 @@ return FALSE; } -#else +#endif +#ifdef UI_GTK2 gboolean ui_canvas_expose(GtkWidget *w, GdkEventExpose *e, void *data) { UiCairoGraphics g; g.g.width = w->allocation.width; @@ -74,7 +80,7 @@ // function from graphics.h void ui_connect_draw_handler(GtkWidget *widget, UiDrawEvent *event) { -#ifdef UI_GTK3 +#if UI_GTK3 || UI_GTK4 g_signal_connect(G_OBJECT(widget), "draw", G_CALLBACK(ui_drawingarea_expose),