pdWindowManager: fix unreliable minimize/restore logic

WM_ACTIVATEAPP was originally used to detect app activation, but it is
an unreliable piece of garbage.  The message is occasionally sent to all
top-level windows, even when they are not being activated.  (For
example, minimizing PD, then maximizing/minimizing another unrelated
window causes PD to arbitrarily receive this message.)

Thank you to the nice MSDN commenter who mentioned an identical problem,
and suggesting use of WM_NCACTIVATE as a more reliable alternative.
Viewport pipeline: start overhaul to support subpixel rendering

Lots left to do; this is mostly just a preliminary clean-up to clarify
some behavior and move some important values to module-level (as they
are shared by multiple parts of the pipeline).