Getting XOrg Keyboard layout

Maybe I shouldn’t be asking for this but I cant find any tutorial about it. How do I get the key pressed and the character representation of it in Xorg like in Win32 that I know ESC_KEY is the ESC_KEY no matter the keyboard layout. Right now I only can get the physical key but not the virtual key.