My boat has wooden rabitted window openings.
I use Loctite Black PL Roof and flashing polyurethane from H Depot.
It is cheap, very rubbery, lots of yield so it moves- stretches and keeps the glass from leaking.
Remove glass, smear Black PL into rabbit, place glass back, smear more Black PL around the glass edge. After 2 days cure, clean edge with a razor blade and can be painted.
Loctite PL S30 Polyurethane Roof & Flashing Sealant from Loctite Adhesives
Originally, from 1970, boat had an aluminum quarter round bent to fit ontop the glass into the rabbit, then side nailed. Problems came when repairs had to be made, the nails were impossible to remove and had corroded into the aluminum.