DrawingArea shows gaps between Cairo Surfaces on HiDPI displays
While trying to tile cairo_surface_t
s across a GTK3 DrawingArea
, I noticed gaps between each of the tiles when displayed on a HiDPI monitor with scaling enabled. For example, on a non-HiDPI display (scaling 100%) I see this:
But dragging this window to a HiDPI display (scaling 200%) shows the following. Tweaking the background color makes it a bit more apparent depending on the platform:
The above screenshots were generated on an Ubuntu 22.04 machine running Gnome with scaling set to 200% on a HiDPI display. The issue similarly reproduces on a MacBook Air with a Retina display with scaling enabled.
I reported a similar issue to the gtk-rs team with one of their samples that seems to suffer from the same issue: https://github.com/gtk-rs/gtk3-rs/issues/854
I've attached gtk3.c which can be used to build the example.