It might be better to error out here or throw an exception if you can't find an XBMC keysym as opposed to casting KeySym directly - that will just result in very strange behavior.