We use the passive voice mainly when we have reasons for not mentioning the agent, or when the agent is not the focus of our attention.
I agree with that for the most part. Sometimes, however, the (syntactically unnecessary) addition of an agent "by"-phrase in the passive voice does serve to focus attention on the agent, by virtue of giving the agent end focus within the sentences.
For example, in the sentence "
Leonardo da Vinci painted the Mona Lisa," we learn that painting the Mona Lisa was something that Leonardo da Vinci did. However, is our focus really on Leonardo da Vinci's agency more than in the passive correlate ("
The Mona Lisa was painted by Leonardo da Vinci")?
Regarding the sentences in the OP, my feeling is that "David cleaned the window" answers the question "What did David do?" more than the question "Who cleaned the window?," though it entails, of course, an answer to both questions.
As a
full-sentence answer to the question "Who cleaned the window?," "The window was cleaned by David" works nicely, in my opinion. This is not to deny that the truncated answers "David" or "David did" would also be quite natural and normal.