It is impossible to say for certain whether your horse's head tossing and ear pinning are caused by leg pain or simple laziness. These behaviors can signal many different issues, so it is important to consult a veterinarian to rule out medical causes.
Possible reasons include pain in the legs, feet, or back; general laziness or boredom; irritation from flies or other insects; behavioral frustration or anxiety; and underlying medical conditions such as ulcers, dental problems, or infections.
Observe your horse carefully for other signs of discomfort, such as limping or reluctance to move. Check for external irritants, and consider whether your training methods might be contributing to the behavior. Most importantly, schedule a veterinary examination to ensure your horse's well-being.