diff --git a/client/win/wingui_mainwindow.cpp b/client/win/wingui_mainwindow.cpp index 00d363487c..0d9da7d828 100755 --- a/client/win/wingui_mainwindow.cpp +++ b/client/win/wingui_mainwindow.cpp @@ -1516,7 +1516,7 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs) } // see if we need to hide the window - if(gstate.global_prefs.run_minimized) { + if(gstate.global_prefs.run_minimized || gstate.start_saver) { ShowWindow(SW_HIDE); } else { ShowWindow(SW_SHOW); @@ -1733,5 +1733,4 @@ void CMainWindow::OnTimer(UINT uEventID) if(uEventID == m_nAppTimerID) { CheckAppWnd(); } - } diff --git a/client/win/wingui_sswindow.cpp b/client/win/wingui_sswindow.cpp index 7b7a59e62b..5a06902d3d 100755 --- a/client/win/wingui_sswindow.cpp +++ b/client/win/wingui_sswindow.cpp @@ -27,6 +27,7 @@ BEGIN_MESSAGE_MAP(CSSWindow, CWnd) ON_WM_CREATE() ON_WM_DESTROY() ON_WM_PAINT() + ON_WM_TIMER() END_MESSAGE_MAP() ////////// @@ -40,6 +41,8 @@ CSSWindow::CSSWindow() int nY = rand() % 50; m_Rect.SetRect(0+nX,0+nY,640+nX,480+nY); SetMode(MODE_NO_GRAPHICS, MODE_NO_GRAPHICS); + + m_hBOINCIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON)); } // CMainWindow::SetMode @@ -191,6 +194,10 @@ int CSSWindow::OnCreate(LPCREATESTRUCT lpcs) GetCursorPos(&m_MousePos); SetTimer(1, 100, NULL); + + m_nPosX = m_nPosY = 0; + m_nDX = m_nDY = 5; + return 0; } @@ -208,7 +215,7 @@ void CSSWindow::OnDestroy() // CSSWindow::OnPaint // arguments: null // returns: null -// function: for now, clears the window +// function: clears the window and draws the bouncing icon if necessary void CSSWindow::OnPaint() { PAINTSTRUCT ps; @@ -220,5 +227,27 @@ void CSSWindow::OnPaint() pdc = BeginPaint(&ps); GetClientRect(&winRect); pdc->FillRect(&winRect, &cb); + + if (m_nMode == MODE_FULLSCREEN || m_nMode == MODE_WINDOW) { + pdc->DrawIcon(m_nPosX, m_nPosY, m_hBOINCIcon); + m_nPosX += m_nDX; + m_nPosY += m_nDY; + if (m_nPosX <= winRect.left || (m_nPosX+32) >= winRect.right) m_nDX *= -1; + if (m_nPosY <= winRect.top || (m_nPosY+32) >= winRect.bottom) m_nDY *= -1; + } + EndPaint(&ps); } + +////////// +// CSSWindow::OnTimer +// arguments: null +// returns: null +// function: redraw the window if needed +void CSSWindow::OnTimer() +{ + if (m_nMode == MODE_FULLSCREEN || m_nMode == MODE_WINDOW) { + Invalidate(); + OnPaint(); + } +} \ No newline at end of file diff --git a/client/win/wingui_sswindow.h b/client/win/wingui_sswindow.h index e507a960e7..8124d704e1 100755 --- a/client/win/wingui_sswindow.h +++ b/client/win/wingui_sswindow.h @@ -46,6 +46,10 @@ private: UINT m_uSetMsg; UINT m_uGetMsg; + HICON m_hBOINCIcon; + int m_nPosX, m_nPosY; + int m_nDX, m_nDY; + HDC hdc; HGLRC hrc;