diff --git a/api/graphics_api.h b/api/graphics_api.h index e9317154ed..1ff231b386 100755 --- a/api/graphics_api.h +++ b/api/graphics_api.h @@ -3,8 +3,6 @@ #define MODE_NO_GRAPHICS 1 #define MODE_WINDOW 2 #define MODE_FULLSCREEN 3 -#define MODE_DEFAULT 4 -#define MODE_BLANK_SCREEN 5 struct GRAPHICS_INFO { int xsize; diff --git a/api/gutil.cpp b/api/gutil.cpp index c35aa40cea..e78ef26b8d 100755 --- a/api/gutil.cpp +++ b/api/gutil.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #endif #ifdef __APPLE_CC__ #include diff --git a/api/windows_opengl.cpp b/api/windows_opengl.cpp index ee94d8e8a6..3c20948a4e 100755 --- a/api/windows_opengl.cpp +++ b/api/windows_opengl.cpp @@ -54,13 +54,12 @@ DWORD WINAPI win_graphics_event_loop( LPVOID duff ); BOOL reg_win_class(); BOOL unreg_win_class(); -void SetMode(int mode, int pmode) +void SetMode(int mode) { RECT WindowRect = {0,0,0,0}; int width, height; - if(pmode == MODE_DEFAULT) nPrevMode = nMode; - else nPrevMode = pmode; + nPrevMode = nMode; nMode = mode; if(hWnd) { @@ -169,17 +168,17 @@ LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: - if(nMode == MODE_FULLSCREEN) SetMode(nPrevMode, MODE_DEFAULT); + if(nMode == MODE_FULLSCREEN) SetMode(nPrevMode); return 0; case WM_MOUSEMOVE: if(nMode == MODE_FULLSCREEN) { POINT cPos; GetCursorPos(&cPos); - if(cPos.x != mousePos.x || cPos.y != mousePos.y) SetMode(nPrevMode, MODE_DEFAULT); + if(cPos.x != mousePos.x || cPos.y != mousePos.y) SetMode(nPrevMode); } return 0; case WM_CLOSE: - SetMode(MODE_NO_GRAPHICS, MODE_DEFAULT); + SetMode(MODE_NO_GRAPHICS); return 0; case WM_PAINT: PAINTSTRUCT ps; @@ -207,7 +206,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window } if(uMsg == SET_MODE) { - SetMode(wParam, lParam); + SetMode(wParam); return 0; } @@ -229,7 +228,7 @@ DWORD WINAPI win_graphics_event_loop( LPVOID gi ) { GET_MODE = RegisterWindowMessage( "BOINC_APP_GET" ); SET_MODE = RegisterWindowMessage( "BOINC_APP_SET" ); - SetMode(MODE_NO_GRAPHICS, MODE_NO_GRAPHICS); + SetMode(MODE_NO_GRAPHICS); win_loop_done = false; using_opengl = true; diff --git a/client/win/wingui_mainwindow.cpp b/client/win/wingui_mainwindow.cpp index d3e4387b6d..949a5afef3 100755 --- a/client/win/wingui_mainwindow.cpp +++ b/client/win/wingui_mainwindow.cpp @@ -1119,7 +1119,7 @@ void CMainWindow::OnCommandWorkShowGraphics() if(at) { CWnd* pAppWnd = GetWndFromProcId(at->pid); if(pAppWnd && IsWindow(pAppWnd->m_hWnd)) { - pAppWnd->PostMessage(RegisterWindowMessage(APP_SET_MSG), MODE_WINDOW, MODE_DEFAULT); + pAppWnd->PostMessage(RegisterWindowMessage(APP_SET_MSG), MODE_WINDOW, 0); } } } diff --git a/client/win/wingui_sswindow.cpp b/client/win/wingui_sswindow.cpp index cb4cfcc244..ba0165ed56 100755 --- a/client/win/wingui_sswindow.cpp +++ b/client/win/wingui_sswindow.cpp @@ -46,6 +46,7 @@ CSSWindow::CSSWindow() m_uScreenSaverMsg = RegisterWindowMessage(START_SS_MSG); m_uSetMsg = RegisterWindowMessage(APP_SET_MSG); m_uGetMsg = RegisterWindowMessage(APP_GET_MSG); + m_uAppModeMsg = RegisterWindowMessage("BOINC_APP_MODE"); m_dwAppId = 0; m_uStartTime = 0; m_bCleared = false; @@ -120,7 +121,7 @@ void CSSWindow::CheckAppWnd() m_dwAppId = gstate.active_tasks.active_tasks[0]->pid; pAppWnd = GetWndFromProcId(m_dwAppId); if(pAppWnd) { - pAppWnd->PostMessage(m_uSetMsg, MODE_FULLSCREEN, MODE_DEFAULT); + pAppWnd->PostMessage(m_uSetMsg, MODE_FULLSCREEN, 0); } else { m_dwAppId = 0; } @@ -129,7 +130,7 @@ void CSSWindow::CheckAppWnd() pAppWnd = GetWndFromProcId(m_dwAppId); if(pAppWnd && IsWindow(pAppWnd->m_hWnd)) { SetMode(MODE_FULLSCREEN); - pAppWnd->PostMessage(m_uSetMsg, MODE_NO_GRAPHICS, MODE_DEFAULT); + pAppWnd->PostMessage(m_uSetMsg, MODE_NO_GRAPHICS, 0); } m_dwAppId = 0; } else { @@ -177,11 +178,11 @@ LRESULT CSSWindow::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) SetMode(MODE_FULLSCREEN); CWnd* pAppWnd = GetWndFromProcId(m_dwAppId); if(pAppWnd && IsWindow(pAppWnd->m_hWnd)) { - pAppWnd->PostMessage(m_uSetMsg, MODE_FULLSCREEN, MODE_DEFAULT); + pAppWnd->PostMessage(m_uSetMsg, MODE_FULLSCREEN, 0); } return 0; - } else if(message == RegisterWindowMessage("BOINC_APP_MODE")) { - if(lParam == m_dwAppId && wParam != MODE_FULLSCREEN && m_nMode == MODE_FULLSCREEN) { + } else if(m_uAppModeMsg == message) { + if(lParam == m_dwAppId && wParam != MODE_FULLSCREEN) { SetMode(MODE_NO_GRAPHICS); m_dwAppId = 0; m_uStartTime = 0; diff --git a/client/win/wingui_sswindow.h b/client/win/wingui_sswindow.h index cf50f46e01..a60fed2eb9 100755 --- a/client/win/wingui_sswindow.h +++ b/client/win/wingui_sswindow.h @@ -60,6 +60,7 @@ private: UINT m_uScreenSaverMsg; // ID of screensaver message UINT m_uSetMsg; UINT m_uGetMsg; + UINT m_uAppModeMsg; DWORD m_dwAppId; CRect m_AppRect;