I give a brief discussion of reduction for indefinite forms at the blog, http://math.blogoverflow.com/2014/08/23/binary-quadratic-forms-over-the-rational-integers-and-class-numbers-of-quadratic-%EF%AC%81elds/
However, given your condition, we can do without. We use upper case letters for $g(x,y) = A x^2 + B x y + C y^2.$ We are told $\Delta = B^2 - 4AC = W^2.$ Take
$r=x/y;$ we want to know whether we can have $r$ rational in $A r^2 + B r + C = 0.$ The quadratic formula says yes:
$$ r = \frac{-B \pm \sqrt {B^2 - 4 AC}}{2A} = \frac{-B \pm \sqrt \Delta}{2A} = \frac{-B \pm W}{2A}. $$
We are told that $W \neq 0.$ As a result, at least one of the possible values of $r$ is nonzero. Choose this one;
$$ r = \frac{p}{q} $$ in lowest terms, with $p,q \neq 0$ and $\gcd(p,q) = 1.$
The standard construction with "extended GCD" says we can find integers with
$$ pu+qv = 1. $$ Then we have the change of variables formula for quadratic form,
$$
\left(
\begin{array}{cc}
v & -u \\
p & q
\end{array}
\right)
\left(
\begin{array}{cc}
2A & B \\
B & 2 C
\end{array}
\right)
\left(
\begin{array}{cc}
v & p \\
-u & q
\end{array}
\right) =
\left(
\begin{array}{cc}
2 D & E \\
E & 0
\end{array}
\right)
$$
where $E = \pm W.$ So far, we have reached $D x^2 + E xy.$
Next is forcing $D \geq 0 $ and $D \leq |E|.$
$$
\left(
\begin{array}{cc}
1 & \delta \\
0 & 1
\end{array}
\right)
\left(
\begin{array}{cc}
2D & E \\
E & 0
\end{array}
\right)
\left(
\begin{array}{cc}
1 & 0 \\
\delta & 1
\end{array}
\right) =
\left(
\begin{array}{cc}
2 D + 2 E \delta & E \\
E & 0
\end{array}
\right)
$$
We have reached $(D + E \delta) x^2 + E xy.$ We may choose $\delta$ so that
$0 \leq D + E \delta < |E|. $