Move keyboard event X11 code to separate file