for(Window*w:windows){//A second iteration through the windows because windows without focus should only have priority after a window with focus.
for(autoit=windows.begin();it!=windows.end();++it){//A second iteration through the windows because windows without focus should only have priority after a window with focus.
Window*w=*it;
if(!w->IsFocusedWindow()){
if(w->IsInBounds(GetMousePos())){
w->InternalMouseFocus(this);
if(w->IsFocusedWindow()){//The focused window has changed!
windows.push_back(w);//HACK ALERT! Whenever we are iterating through the windows list we could potentially add an item to the end of it whenever it becomes focused to keep layering. Because of this we don't want to reallocate during another push_back. This ensures that will never occur.
windows.reserve(windows.size()+1);//HACK ALERT! Whenever we are iterating through the windows list we could potentially add an item to the end of it whenever it becomes focused to keep layering. Because of this we don't want to reallocate during another push_back. This ensures that will never occur.