discarding non purposeful mouse clicks inside a widget in order not to process them

first of all, how would one know if a widget, but nothing in particular like a sub widget (button etc) on the widget was clicked?