What structural elements need for gate in place of fence?
Size the gate to clear the window obstruction. From the image it looks like a 4x4 post set flush against the siding is sufficient to clear the window but if there is a light well then you need to leave more space. Also, a narrower gate will look better visually. If this is a 6' tall fence then a 4' wide gate would be typical (gets you close to a golden ratio 1.618). A smaller panel would be used to bridge to the siding.

The gate threshold should be anchored with posts buried in the ground on both sides. Gates are heavy and take a lot of abuse. You would be wise not to anchor your gate to either your house or the adjoining fence. This is true for the hinge side as well as the latch side.

If you build a narrower gate with a small panel on the house side it should be fine to re-use the 2x4 strip against your house for attaching one side of the panel (not the gate). And this avoids patching holes in the siding.

Here's what the pro's did on my fence gate in a very similar situation. You're looking at a 4 ft gate framed by 6x6 posts with a small panel attached to a 4x4 post. The total span here is 7 ft. Those are 9 ft posts buried 3 ft in the ground with dry packed cement footers. The two end posts are buried flush against the existing fence and the house (not holes I'd like to dig).

Note the A-frame bracing on the gate. This is something you should build into your existing fence panel. You could build a simpler Z-frame brace too. But make sure it's pointed the right way. For the pictured gate with hinges on the left a wooden Z brace should look like the letter Z. With hinges on the right you would form the mirror-image of the letter Z.