Move mouse handling to gui module