It is called a headpat. A motion of affection that consists of ruffling someone's hair when in vicinity.
I do know what a headpat is, but I am not used to getting one all of the sudden, with no prior warning