[PATCH libinput 00/12] typesafe coordinate wrappers
Peter Hutterer
peter.hutterer at who-t.net
Thu Mar 12 01:36:31 PDT 2015
libinput has two types of coordinates - device coordinates and coordinates
normalized into the 1000 dpi default. we generally use int/double for those
two, but it's not always clear or obvious which type of coordinates we're
dealing with. So there's a risk of mixing them up and we may not notice for
a while (see 38ee for example where we used a threshold in device-specific
coordinates).
typedefs help with readability but the compiler won't catch it. this
patchset uses two different structs for the x/y pairs (which is what we're
mostly concerned with). It reads a bit clunkier but we get the benefit of
immediately knowing what coordinates we're dealing with.
I'm somewhat in two minds about it, I like the type-safety, not a fan of the
extra clunkyness. Any suggestions for improvements appreciated.
Cheers,
Peter
More information about the wayland-devel
mailing list