浏览代码

disable cursor shadow

cxgeorge 24 年之前
父节点
当前提交
860758dc67

+ 2 - 0
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

+ 25 - 1
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);
+}
+

+ 3 - 0
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