> get keyboard and mouse input Most 2d graphic libs do not support that. Cairo does not, cairo on linux uses gtkdrawingarea for that.
Maybe you want SDL2, I think it supports input. Or maybe Raylib? Note, when people say canvas, some have graphic object handling in mind. But Cairo just draws shapes, it does not store whole objects internally. Maybe you want Nim Pixi of treeform. Pixi is similar to cairo.
