War Weariness works like this
1. You have a number of War Weariness points for Every Civ
2. Those points go up
Everytime you kill one of that civ's units
Everytime they kill one of yours
Everytime you take a city, etc.
3. Those points go down
by 1% every turn you are at peace
4. Those points cause unhappiness=
Points x population of city x Other Factors (Police State, Mt. Rushmore, Jails, Currnet war/Peace State*) / some fixed constant
*If you are at peace with that civ, then you get 0 unhappiness from War Weariness... you may also get less unhappiness from a defensive war (not entirely certain)
More detailed answers are in the XML
basically each unit death is ~1-3 points of WW and it is divided by 1000 for the happiness effect