Use XGetKeyboardMapping instead of deprecated XKeycodeToKeysym
Do not use g_type_init and g_thread_init with GLib >= 2.36
Remove some unused variables