I remember there was something why it didn't work right when checking ->ID() and GetActiveWindow() (causing misbehaviour in vis not being deactivated at all and so on), so I added the bool to track things, which made things work fine, also if somewhere a check for the condition is missing, it can easily be added by evaluating the bool.