When you're building castles in the air absentmindedly, daydreaming, or looking at nothing with an empty mind, or maybe being absorbed in thought. Then someone comes over and "wakes you up", stopping you from musing on things.
From what I can describe, he might pat you on the back, or say, "Hey, what's wrong?" And you'd be like, getting startled or diverting your sight/attention, or maybe smiling.
What do you call it, the thing he does and the thing your respond to what he does?