Update keyboard modifier handling code.
Send modifiers on focus.
Fix buffer check logic.