--- a/ui/gtk/graphics.c Mon Jun 17 21:20:58 2024 +0200 +++ b/ui/gtk/graphics.c Sun Sep 29 13:32:51 2024 +0200 @@ -51,6 +51,7 @@ } +#if GTK_MAJOR_VERSION <= 3 static gboolean widget_button_pressed( GtkWidget *widget, GdkEvent *event, @@ -82,14 +83,18 @@ } return TRUE; } +#endif void ui_drawingarea_getsize(UIWIDGET drawingarea, int *width, int *height) { -#ifdef UI_GTK3 - *width = gtk_widget_get_allocated_width(drawingarea); - *height = gtk_widget_get_allocated_height(drawingarea); +#if GTK_MAJOR_VERSION >= 4 + *width = gtk_widget_get_width(drawingarea); + *height = gtk_widget_get_height(drawingarea); +#elif GTK_MAJOR_VERSION == 3 + *width = gtk_widget_get_allocated_width(drawingarea); + *height = gtk_widget_get_allocated_height(drawingarea); #else - *width = drawingarea->allocation.width; - *height = drawingarea->allocation.height; + *width = drawingarea->allocation.width; + *height = drawingarea->allocation.height; #endif } @@ -98,6 +103,9 @@ } void ui_drawingarea_mousehandler(UiObject *obj, UIWIDGET widget, ui_callback f, void *u) { +#if GTK_MAJOR_VERSION >= 4 + // TODO +#else gtk_widget_set_events(widget, GDK_BUTTON_PRESS_MASK); if(f) { UiEventData *event = malloc(sizeof(UiEventData)); @@ -114,6 +122,7 @@ } else { // TODO: warning } +#endif }