  Let $X$ be a compact complex manifold such that its canonical bundle $K_X$ is
numerically trivial. Assume additionally that $X$ is Moishezon or $X$ is Fujiki
with dimension at most four. Using the MMP and classical results in foliation
theory, we prove a Beauville-Bogomolov type decomposition theorem for $X$. We
deduce that holomorphic geometric structures of affine type on $X$ are in fact
locally homogeneous away from an analytic subset of complex codimension at
least two, and that they cannot be rigid unless $X$ is an \'etale quotient of a
compact complex torus. Moreover, we establish a characterization of torus
quotients using the vanishing of the first two Chern classes which is valid for
any compact complex $n$-folds of algebraic dimension at least $n-1$. Finally,
we show that a compact complex manifold with trivial canonical bundle bearing a
rigid geometric structure must have infinite fundamental group if either $X$ is
Fujiki, $X$ is a threefold, or $X$ is of algebraic dimension at most one.
