no message

svn path=/trunk/boinc/; revision=1145
This commit is contained in:
Eric Heien 2003-04-29 20:36:41 +00:00
parent e7954ac7d5
commit 71ba44eb73
6 changed files with 16 additions and 17 deletions

View File

@ -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;

View File

@ -6,7 +6,7 @@
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <glut.h>
#endif
#ifdef __APPLE_CC__
#include <OpenGL/gl.h>

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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;

View File

@ -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;