detect pen input, fix #513