The classical GTK drawing area example is still available at gitlab:
examples/drawing.c · main · GNOME / gtk · GitLab
I think years ago it had its own HTML page with a picture, but I can not find it any longer.
You can save that C code as simple.c and compile it like
gcc -Wall simple.c -o simple pkg-config --cflags --libs gtk4
That program draws indeed only tiny unconnected rectangles at current mouse position. For me it is not really clear what you intend at all, and what your “interpolation” is. It is easy to modify that example to connect the mouse coordinates with cairo lines, that is the simplest form of interpolation.
Note that cairo is a vector library, so it may not be the best solution for freehand drawing as in gimp – you may prefer a raster bitmap based library? And note that user interaction has changed in GTK4. No gestures can be used. But the old more flexible legacy interface is still available.
You can create with gtk and cairo tools like GitHub - StefanSalewski/SDT: A simple Nim GTK4 drawing and design tool, but that is some work. Maybe in winter I will find some time to continue that app. The most difficult part for cairo drawing is to support scrolling and zooming. I once created this simple demo in Nim, which draws some basic shapes, and let the user zoom in and scroll, see GitHub - StefanSalewski/gintro: High level GObject-Introspection based GTK3/GTK4 bindings for Nim language. That demo is still GTK3, but is was the basis for the SDT tool mentioned above. There may exists other ways in GTK for zooming ind scrolling, maybe with a GtkScrolledWindow.
Also note, that cairo is a bit outdated. A more modern, actively developed variant is blend2d. And GTK itself seems to use a lot of OpenGL for drawing its widgets in GTK4 now.
[EDIT]
It seems switching off event compression is nearly as good as performing interpolation.
This “event compression” seems to be more a myth, maybe from old GTK2 days. Ten years ago, I asked about it, and trying to deactivate compression made no difference. I got a few dozen mouse movement events per second max, which is generally OK. It may be different for XOrg and wayland. For me it was never a big problem getting too few events, but I can imagine that for smooth movement and scrolling on a 144 or 200 Hz display you may want to get up to 200 events per second. Maybe the experts can answer this.
Maybe we can play with Gdk.Event.get_history