LRESULT WindowMonitor::HandleMessage(UINT message, WPARAM wParam, LPARAM) { switch (message) { case LM_REDRAW: UpdateWindowData((HWND)wParam); return 0; case LM_WINDOWCREATED: UpdateWindowData((HWND)wParam); return 0; case LM_WINDOWDESTROYED: sWindowData.erase((HWND)wParam); return 0; case LM_WINDOWREPLACED: UpdateWindowData((HWND)wParam); return 0; case LM_WINDOWREPLACING: sWindowData.erase((HWND)wParam); return 0; default: assert(false); // We should handle every message sent to us. return 0; } }
PLUGIN_API void Berkelium_Window_destroy(int windowID) { WindowMap::iterator it = windows.find(windowID); if(it != windows.end()) { delete it->second; windows.erase(it); } }
void WindowMonitor::RunWindowMaintenance() { for (WindowMap::iterator iter = sWindowData.begin(); iter != sWindowData.end();) { if (!IsTaskbarWindow(iter->first)) { iter = sWindowData.erase(iter); continue; } if (iter->second.updateDuringMaintenance) { iter->second.updateDuringMaintenance = false; UpdateWindowData(iter->first); } ++iter; } }