diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 071d730be..d698285aa 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -302,7 +302,39 @@ void CDriverGL::setWindowIcon(const std::vector &bitmaps) { #if defined(NL_OS_WINDOWS) - // TODO + static HICON winIconBig = NULL; + static HICON winIconSmall = NULL; + + if (winIconBig) + { + DestroyIcon(winIconBig); + winIconBig = NULL; + } + + if (winIconSmall) + { + DestroyIcon(winIconSmall); + winIconSmall = NULL; + } + + // first bitmap is the small icon + if (bitmaps.size() > 0) + winIconSmall = bitmaps[0].getHICON(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 32); + + // second bitmap is the big icon + if (bitmaps.size() > 1) + winIconBig = bitmaps[1].getHICON(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 32); + + if (winIconBig) + { + SendMessage(_win, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); + SendMessage(_win, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconBig); + } + else + { + SendMessage(_win, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); + SendMessage(_win, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconSmall); + } #elif defined(NL_OS_MAC) @@ -1193,6 +1225,10 @@ bool CDriverGL::destroyWindow() { H_AUTO_OGL(CDriverGL_destroyWindow) + // make sure window icons are deleted + std::vector bitmaps; + setWindowIcon(bitmaps); + #ifdef NL_OS_WINDOWS // Then delete.