From 860758dc6755eb9889687b65845dced0a8aa689b Mon Sep 17 00:00:00 2001 From: cxgeorge <> Date: Tue, 9 Oct 2001 23:26:18 +0000 Subject: [PATCH] disable cursor shadow --- panda/src/wgldisplay/config_wgldisplay.cxx | 2 ++ panda/src/wgldisplay/wglGraphicsWindow.cxx | 26 +++++++++++++++++++++- panda/src/wgldisplay/wglGraphicsWindow.h | 3 +++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/panda/src/wgldisplay/config_wgldisplay.cxx b/panda/src/wgldisplay/config_wgldisplay.cxx index 287ebfd768..2d83284779 100644 --- a/panda/src/wgldisplay/config_wgldisplay.cxx +++ b/panda/src/wgldisplay/config_wgldisplay.cxx @@ -68,6 +68,8 @@ init_libwgldisplay() { wglGraphicsWindow::make_wglGraphicsWindow); atexit(AtExitFn); + + set_global_parameters(); } // cant use global var cleanly because global var static init executed after init_libwgl(), incorrectly reiniting var diff --git a/panda/src/wgldisplay/wglGraphicsWindow.cxx b/panda/src/wgldisplay/wglGraphicsWindow.cxx index 821cdce010..1cc6a07586 100644 --- a/panda/src/wgldisplay/wglGraphicsWindow.cxx +++ b/panda/src/wgldisplay/wglGraphicsWindow.cxx @@ -189,6 +189,8 @@ void AtExitFn() { #ifdef _DEBUG wgldisplay_cat.spam() << "AtExitFn called\n"; #endif + + restore_global_parameters(); DestroyAllWindows(true); } @@ -1048,7 +1050,7 @@ verify_window_sizes(unsigned int numsizes,unsigned int *dimen) { bIsGoodmode=false; } else { if(_bIsLowVidMemCard) { - bIsGoodmode=((dwWidth*dwHeight)<=(640*480)); + bIsGoodmode=((float)(dwWidth*(float)dwHeight)<=(float)(640*480)); } else { bIsGoodmode = find_acceptable_display_mode(dwWidth,dwHeight,dwFullScreenBitDepth,dm); } @@ -3317,3 +3319,25 @@ extern char *ConvDDErrorToString(const HRESULT &error) { } } +// Global system parameters we want to modify during our run +static int iMouseTrails; +static bool bCursorShadowOn; + +void set_global_parameters(void) { + // turn off mousetrails and cursor shadow. + // cursor shadow causes cursor blink and reduced frame rate due to lack of driver support for + // cursor alpha blending + + // this is a win2k/xp only param, could use GetVersionEx to do it just for win2k + SystemParametersInfo(SPI_GETCURSORSHADOW,NULL,&bCursorShadowOn,NULL); + SystemParametersInfo(SPI_SETCURSORSHADOW,NULL,(PVOID)false,NULL); + + SystemParametersInfo(SPI_GETMOUSETRAILS,NULL,&iMouseTrails,NULL); + SystemParametersInfo(SPI_SETMOUSETRAILS,NULL,(PVOID)0,NULL); +} + +void restore_global_parameters(void) { + SystemParametersInfo(SPI_SETCURSORSHADOW,NULL,(PVOID)bCursorShadowOn,NULL); + SystemParametersInfo(SPI_SETMOUSETRAILS,NULL,(PVOID)iMouseTrails,NULL); +} + diff --git a/panda/src/wgldisplay/wglGraphicsWindow.h b/panda/src/wgldisplay/wglGraphicsWindow.h index a9b21b9531..378bd6a99b 100644 --- a/panda/src/wgldisplay/wglGraphicsWindow.h +++ b/panda/src/wgldisplay/wglGraphicsWindow.h @@ -163,4 +163,7 @@ private: static TypeHandle _type_handle; }; +extern void set_global_parameters(); +extern void restore_global_parameters(); + #endif