In a Texas courtroom Tuesday , a retired district judge , C.W. Duncan , hearing the petition ruled in favor of the embattled Republican lawmaker .