If we receive a stateNotifyChange, we check if we are in a max state. If so, overwrite the xwc with either X | W, or Y | H depending on the semi max state with the orig position before we went into a semi max state. This way when we leave any sort of max state the orig position is restored.
If the window is being grabbed we do not overwrite the position, which it gets its own value at that point (instead of the orig pos). Fixes: https://bugs.launchpad.net/bugs/892012.
Approved by PS Jenkins bot, Sam Spilsbury, MC Return, Sami Jaktholm.