Refactor handling of minimize/maximize button

Use hit-testing instead of IMessageFilter. Produces a must more reliable result.