[BUG #8338] Performance optimization of pointer event handler.