I get the feeling this is part of some bigger picture which has an easier solution than what you're focused on currently.
It's certainly possible if you absolutely need to filter out tooltip handling to specific buttons, but there's a point where the performance cost would be drastically higher than hooking the OnEnter
handler of your target buttons for example.
Right now, there's just not enough information of the overall process to suggest a better alternative.
Another example is how BuffOwner
was written. The goal of the addon was to show who was the caster of a buff or debuff. I could've followed the same route of hooking whenever the tooltip was shown and figure out if the calling button was from an aura button. Instead, I came to the conclusion that it didn't need to know that. All it needed was the buff's info, and hooking the appropriate :Set()
functions that generate the description in the first place would be adequate for retrieving it.