I've read here that it's possible for any app using the X server to sniff keystrokes to any other app which is also using the X server, including su (on a terminal) or gksu. I've heard of a few ways to make the X server secure like Xephyr, but I'm not sure which one to use. I just want to prevent any app like xinput from easily sniffing the keystrokes when I'm typing a password in the terminal or gksu. I'm currently using Debian sid. 
How do I prevent programs from sniffing keystrokes to su/gksu?
debian;security;x11