I'm using a Gone With the Wind illustration again, but when Scarlet's mother died, her father lost his mind. At Gerald's funeral, Will Benteen described his descent into madness as "his mainspring busted". There was nothing on the outside that could lick Gerald, but it was from the inside that he could be destroyed.
Anyway, Denethor's world must have fallen apart since Boromir was his "jewel". But that doesn't excuse his treatment of Faramir, and it doesn't excuse his retreat into the death house instead of leading the army into battle.
Denethor's grief is evident when he diminishes Faramir in front of Gandalf. It shows much of Faramir that he didn't punch his father in the brain, but went out to do battle for Gondor.
Denethor II was a proud man, tall, valiant, and more kingly than any man that had appeared in Gondor for many lives of men; and he was wise also, and farsighted, and learned in lore. Indeed he was as like to Thorongil as to one of nearest kin, and yet was ever placed second to the stranger in the hearts of men and the esteem of his father.It must have really stuck in his craw to find out that Thorongil was the rightful king!