some refactor work (e.g. supports multiple keycodes for the same keySym)