Build fix for overlay.

Compute keyboard mod state once.
Fix C++ 'new' usage.