X environment listens libretro input

i have some issues with retroarch. while im playing games or navigating on menu, X environment listens keys in the background. after i close retroarch i see apps opened, terminal with texts. how can i block background input ?

hw: rpi2, sw:raspbian libretro: fresh compile

Maybe try using the udev driver if not already (apt-get install libudev-dev and recompile RetroArch with --enable-udev)