Put things in the window, he just can't see the glass and thinks it is an opening that he can fly through.
Use suction cups and hang sun catchers, stained glass, ribbon, bows... or put a few lines of masking tape across the window... just something to let him know it is not a way into your home.
Of course, another thing is, he could be seeing his reflection and trying to fight that 'other bird', but it's more likely the first.