  An explicit expression in terms of canonical variables is obtained for the
Hamiltonian functional determining the fully nonlinear dynamics of
two-dimensional potential flows of an ideal fluid with a free surface over an
arbitrary nonuniform depth. The canonically conjugate variables are derived
from the previously developed non-canonical conformal description of water
waves over a strongly undulating bottom [V. P. Ruban, Phys. Rev. E {\bf 70},
066302 (2004)]. Also an alternative approach to the problem is discussed, which
gives weakly nonlinear Hamiltonian models of different orders.
