add warning

This commit is contained in:
cxgeorge 2002-10-20 03:01:30 +00:00
parent 4ccc65fa91
commit 6df8489124
2 changed files with 37 additions and 33 deletions

View File

@ -1585,7 +1585,7 @@ bool wdxGraphicsWindow::resize(unsigned int xsize,unsigned int ysize) {
} }
} }
// must ALWAYS use search_for_valid_displaymode even if we know a-priori that res is valid so we can // must ALWAYS use search_for_valid_displaymode even if we know a-priori that res is valid so we can
// get a valid pixfmt // get a valid pixfmt
search_for_valid_displaymode(xsize,ysize,bNeedZBuffer,bNeedStencilBuffer, search_for_valid_displaymode(xsize,ysize,bNeedZBuffer,bNeedStencilBuffer,
&_dxgsg->scrn.SupportedScreenDepthsMask,&bCouldntFindValidZBuf, &_dxgsg->scrn.SupportedScreenDepthsMask,&bCouldntFindValidZBuf,
@ -1650,7 +1650,7 @@ special_check_fullscreen_resolution(UINT xsize,UINT ysize) {
I dont have a complete list of intel deviceIDs (missing 82830, 845, etc) I dont have a complete list of intel deviceIDs (missing 82830, 845, etc)
// Intel i810,i815,82810 // Intel i810,i815,82810
if((DeviceId==0x7121)||(DeviceId==0x7123)||(DeviceId==0x7125)|| if((DeviceId==0x7121)||(DeviceId==0x7123)||(DeviceId==0x7125)||
(DeviceId==0x1132)) (DeviceId==0x1132))
*/ */
{ {
if((xsize==640)&&(ysize==480)) if((xsize==640)&&(ysize==480))
@ -2079,13 +2079,13 @@ void wdxGraphicsWindow::search_for_valid_displaymode(UINT RequestedXsize,UINT Re
wdxdisplay_cat.error() << "CheckDeviceFormat failed for device #" <<_dxgsg->scrn.CardIDNum << D3DERRORSTRING(hr); wdxdisplay_cat.error() << "CheckDeviceFormat failed for device #" <<_dxgsg->scrn.CardIDNum << D3DERRORSTRING(hr);
exit(1); exit(1);
} }
} }
bool bIs16bppRenderTgt = IS_16BPP_DISPLAY_FORMAT(dispmode.Format); bool bIs16bppRenderTgt = IS_16BPP_DISPLAY_FORMAT(dispmode.Format);
float RendTgtMinMemReqmt; float RendTgtMinMemReqmt;
// if we have a valid memavail value, try to determine if we have enough space // if we have a valid memavail value, try to determine if we have enough space
if( (_dxgsg->scrn.MaxAvailVidMem!=UNKNOWN_VIDMEM_SIZE) && if( (_dxgsg->scrn.MaxAvailVidMem!=UNKNOWN_VIDMEM_SIZE) &&
(!(special_check_fullscreen_resolution(RequestedXsize,RequestedYsize)))) { (!(special_check_fullscreen_resolution(RequestedXsize,RequestedYsize)))) {
// assume user is testing fullscreen, not windowed, so use the dwTotal value // assume user is testing fullscreen, not windowed, so use the dwTotal value
// see if 3 scrnbufs (front/back/z)at 16bpp at xsize*ysize will fit with a few // see if 3 scrnbufs (front/back/z)at 16bpp at xsize*ysize will fit with a few
@ -2282,9 +2282,9 @@ bool wdxGraphicsWindow::search_for_device(LPDIRECT3D8 pD3D8,DXDeviceInfo *pDevIn
if(!_dxgsg->scrn.bIsLowVidMemCard) { if(!_dxgsg->scrn.bIsLowVidMemCard) {
bool bUseDefaultSize=dx_pick_best_screenres&& bool bUseDefaultSize=dx_pick_best_screenres&&
((_dxgsg->scrn.MaxAvailVidMem == UNKNOWN_VIDMEM_SIZE) || ((_dxgsg->scrn.MaxAvailVidMem == UNKNOWN_VIDMEM_SIZE) ||
is_badvidmem_card(&_dxgsg->scrn.DXDeviceID)); is_badvidmem_card(&_dxgsg->scrn.DXDeviceID));
if(dx_pick_best_screenres && !bUseDefaultSize) { if(dx_pick_best_screenres && !bUseDefaultSize) {
typedef struct { typedef struct {
UINT memlimit; UINT memlimit;
@ -2505,7 +2505,9 @@ CreateScreenBuffersAndDevice(DXScreenData &Display) {
// it changes your WM_ACTIVATEAPP from true to false, causing us // it changes your WM_ACTIVATEAPP from true to false, causing us
// to go into a 'wait-for WM_ACTIVATEAPP true' loop, and the event never comes so we hang // to go into a 'wait-for WM_ACTIVATEAPP true' loop, and the event never comes so we hang
// in fullscreen wait. also doing this for windowed mode since it was requested. // in fullscreen wait. also doing this for windowed mode since it was requested.
SetForegroundWindow(Display.hWnd); if(!SetForegroundWindow(Display.hWnd)) {
wdxdisplay_cat.warning() << "SetForegroundWindow() failed!\n";
}
if(_props._fullscreen) { if(_props._fullscreen) {
pPresParams->SwapEffect = D3DSWAPEFFECT_DISCARD; // we dont care about preserving contents of old frame pPresParams->SwapEffect = D3DSWAPEFFECT_DISCARD; // we dont care about preserving contents of old frame
@ -3049,13 +3051,13 @@ void wdxGraphicsWindow::
get_framebuffer_format(PixelBuffer::Type &fb_type, PixelBuffer::Format &fb_format) { get_framebuffer_format(PixelBuffer::Type &fb_type, PixelBuffer::Format &fb_format) {
assert(_dxgsg!=NULL); assert(_dxgsg!=NULL);
fb_type = PixelBuffer::T_unsigned_byte; fb_type = PixelBuffer::T_unsigned_byte;
// this is sortof incorrect, since for F_rgb5 it's really 5 bits per channel // this is sortof incorrect, since for F_rgb5 it's really 5 bits per channel
//would have to change a lot of texture stuff to make this correct though //would have to change a lot of texture stuff to make this correct though
if(IS_16BPP_DISPLAY_FORMAT(_dxgsg->scrn.PresParams.BackBufferFormat)) if(IS_16BPP_DISPLAY_FORMAT(_dxgsg->scrn.PresParams.BackBufferFormat))
fb_format = PixelBuffer::F_rgb5; fb_format = PixelBuffer::F_rgb5;
else fb_format = PixelBuffer::F_rgb; else fb_format = PixelBuffer::F_rgb;
} }
*/ */
// Global system parameters we want to modify during our run // Global system parameters we want to modify during our run

View File

@ -457,7 +457,9 @@ void wglGraphicsWindow::config() {
ShowWindow(_mwindow, SW_SHOWNORMAL); ShowWindow(_mwindow, SW_SHOWNORMAL);
ShowWindow(_mwindow, SW_SHOWNORMAL); ShowWindow(_mwindow, SW_SHOWNORMAL);
SetForegroundWindow(_mwindow); if(!SetForegroundWindow(_mwindow)) {
wgldisplay_cat.warning() << "SetForegroundWindow() failed!\n";
}
int chg_result = ChangeDisplaySettings(&dm, CDS_FULLSCREEN); int chg_result = ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
@ -531,7 +533,7 @@ void wglGraphicsWindow::config() {
// However, this function doesn't work for Win98; on this OS, we // However, this function doesn't work for Win98; on this OS, we
// have to use ImmGetCompositionStringA() instead, which returns an // have to use ImmGetCompositionStringA() instead, which returns an
// encoded string in shift-jis (which we then have to decode). // encoded string in shift-jis (which we then have to decode).
// For now, this is user-configurable, to allow testing of this code // For now, this is user-configurable, to allow testing of this code
// on both OS's. After we verify that truth of the above claim, we // on both OS's. After we verify that truth of the above claim, we
// should base this decision on GetVersionEx() or maybe // should base this decision on GetVersionEx() or maybe
@ -831,7 +833,7 @@ int wglGraphicsWindow::find_pixfmtnum(bool bLookforHW) {
wgldisplay_cat.error() << "config() - multisample not supported"<< endl; wgldisplay_cat.error() << "config() - multisample not supported"<< endl;
mask &= ~W_MULTISAMPLE; mask &= ~W_MULTISAMPLE;
} }
if(wgldisplay_cat.is_debug()) if(wgldisplay_cat.is_debug())
wgldisplay_cat.debug() << "mask =0x" << (void*) mask << endl; wgldisplay_cat.debug() << "mask =0x" << (void*) mask << endl;
@ -853,7 +855,7 @@ int wglGraphicsWindow::find_pixfmtnum(bool bLookforHW) {
DescribePixelFormat(_hdc, pfnum, sizeof(PIXELFORMATDESCRIPTOR), &pfd); DescribePixelFormat(_hdc, pfnum, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
// official, nvidia sanctioned way. should be equiv to my algorithm // official, nvidia sanctioned way. should be equiv to my algorithm
if ((pfd.dwFlags & PFD_GENERIC_FORMAT) != 0) if ((pfd.dwFlags & PFD_GENERIC_FORMAT) != 0)
drvtype = Software; drvtype = Software;
else if (pfd.dwFlags & PFD_GENERIC_ACCELERATED) else if (pfd.dwFlags & PFD_GENERIC_ACCELERATED)
drvtype = MCD; drvtype = MCD;
@ -869,13 +871,13 @@ int wglGraphicsWindow::find_pixfmtnum(bool bLookforHW) {
continue; // skipping all SW fmts continue; // skipping all SW fmts
} }
#endif #endif
// skip driver types we are not looking for // skip driver types we are not looking for
if(bLookforHW) { if(bLookforHW) {
if(drvtype==Software) if(drvtype==Software)
continue; continue;
} else { } else {
if(drvtype!=Software) if(drvtype!=Software)
continue; continue;
} }
@ -965,7 +967,7 @@ int wglGraphicsWindow::choose_visual(void) {
} }
if(pfnum==0) { if(pfnum==0) {
wgldisplay_cat.error() wgldisplay_cat.error()
<< "make sure OpenGL driver is installed, and try reducing the screen size, reducing the\n" << "make sure OpenGL driver is installed, and try reducing the screen size, reducing the\n"
<< "desktop screen pixeldepth to 16bpp,and check your panda window properties\n"; << "desktop screen pixeldepth to 16bpp,and check your panda window properties\n";
exit(1); exit(1);
@ -1582,15 +1584,15 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
if(iVal & 0x8000) \ if(iVal & 0x8000) \
iVal -= 0x10000; \ iVal -= 0x10000; \
} }
if(!_tracking_mouse_leaving) { if(!_tracking_mouse_leaving) {
// need to re-call TrackMouseEvent every time mouse re-enters window // need to re-call TrackMouseEvent every time mouse re-enters window
track_mouse_leaving(hwnd); track_mouse_leaving(hwnd);
} }
SET_MOUSE_COORD(x,LOWORD(lparam)); SET_MOUSE_COORD(x,LOWORD(lparam));
SET_MOUSE_COORD(y,HIWORD(lparam)); SET_MOUSE_COORD(y,HIWORD(lparam));
handle_mouse_motion(x, y); handle_mouse_motion(x, y);
break; break;
@ -1607,7 +1609,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
} }
break; break;
} }
case WM_NCMOUSELEAVE: { case WM_NCMOUSELEAVE: {
if(!_props._bCursorIsVisible) { if(!_props._bCursorIsVisible) {
// wgldisplay_cat.error() << "NCMOUSELEAVE show=false\n"; // wgldisplay_cat.error() << "NCMOUSELEAVE show=false\n";
@ -1618,14 +1620,14 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
} }
case WM_MOUSELEAVE: { case WM_MOUSELEAVE: {
_tracking_mouse_leaving=false; _tracking_mouse_leaving=false;
handle_mouse_exit(); handle_mouse_exit();
break; break;
} }
case WM_CREATE: { case WM_CREATE: {
track_mouse_leaving(hwnd); track_mouse_leaving(hwnd);
_cursor_in_windowclientarea=false; _cursor_in_windowclientarea=false;
if(!_props._bCursorIsVisible) if(!_props._bCursorIsVisible)
ShowCursor(false); ShowCursor(false);
@ -1735,7 +1737,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
if (!_input_devices.empty()) { if (!_input_devices.empty()) {
HIMC hIMC = ImmGetContext(hwnd); HIMC hIMC = ImmGetContext(hwnd);
nassertr(hIMC != 0, 0); nassertr(hIMC != 0, 0);
static const int max_ime_result = 128; static const int max_ime_result = 128;
static char ime_result[max_ime_result]; static char ime_result[max_ime_result];
@ -1751,15 +1753,15 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
ime_result, max_ime_result); ime_result, max_ime_result);
// Add this string into the text buffer of the application. // Add this string into the text buffer of the application.
// ImmGetCompositionStringW() returns a string, but it's // ImmGetCompositionStringW() returns a string, but it's
// filled in with wstring data: every two characters defines a // filled in with wstring data: every two characters defines a
// 16-bit unicode char. The docs aren't clear on the // 16-bit unicode char. The docs aren't clear on the
// endianness of this. I guess it's safe to assume all Win32 // endianness of this. I guess it's safe to assume all Win32
// machines are little-endian. // machines are little-endian.
for (DWORD i = 0; i < result_size; i += 2) { for (DWORD i = 0; i < result_size; i += 2) {
int result = int result =
((int)(unsigned char)ime_result[i + 1] << 8) | ((int)(unsigned char)ime_result[i + 1] << 8) |
(unsigned char)ime_result[i]; (unsigned char)ime_result[i];
_input_devices[0].keystroke(result); _input_devices[0].keystroke(result);
} }
@ -1822,7 +1824,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
case WM_SYSCOMMAND: case WM_SYSCOMMAND:
if(wparam==SC_KEYMENU) { if(wparam==SC_KEYMENU) {
// if Alt is released (alone w/o other keys), defwindproc will send // if Alt is released (alone w/o other keys), defwindproc will send
// this command, which will 'activate' the title bar menu (we have none) // this command, which will 'activate' the title bar menu (we have none)
// and give focus to it. we dont want this to happen, so kill this msg // and give focus to it. we dont want this to happen, so kill this msg
return 0; return 0;
@ -1838,7 +1840,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
// Handle Cntrl-V paste from clipboard. Is there a better way // Handle Cntrl-V paste from clipboard. Is there a better way
// to detect this hotkey? // to detect this hotkey?
if ((wparam=='V') && (GetKeyState(VK_CONTROL) < 0) && if ((wparam=='V') && (GetKeyState(VK_CONTROL) < 0) &&
!_input_devices.empty()) { !_input_devices.empty()) {
HGLOBAL hglb; HGLOBAL hglb;
char *lptstr; char *lptstr;
@ -1848,7 +1850,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
if (!OpenClipboard(NULL)) if (!OpenClipboard(NULL))
return 0; return 0;
// Maybe we should support CF_UNICODETEXT if it is available // Maybe we should support CF_UNICODETEXT if it is available
// too? // too?
hglb = GetClipboardData(CF_TEXT); hglb = GetClipboardData(CF_TEXT);