Browse Source

Merge branch 'release/1.9.x'

rdb 10 năm trước cách đây
mục cha
commit
8c259d4a20

+ 6 - 0
panda/src/windisplay/config_windisplay.cxx

@@ -65,6 +65,12 @@ ConfigVariableBool request_dxdisplay_information
           "you have a specific need for this information and don't mind "
           "having a slow start-up."));
 
+ConfigVariableBool dpi_aware
+("dpi-aware", true,
+ PRC_DESC("The default behavior is for Panda3D to disable DPI-virtualization "
+          "that is introduced in Windows 8.1.  Set this to false if you are "
+          "experiencing problems with this setting."));
+
 ConfigVariableBool swapbuffer_framelock
 ("swapbuffer-framelock", false,
  PRC_DESC("Set this true to enable HW swapbuffer frame-lock on 3dlabs cards"));

+ 1 - 0
panda/src/windisplay/config_windisplay.h

@@ -30,6 +30,7 @@ extern ConfigVariableBool ime_composition_w;
 extern ConfigVariableBool ime_aware;
 extern ConfigVariableBool ime_hide;
 extern ConfigVariableBool request_dxdisplay_information;
+extern ConfigVariableBool dpi_aware;
 
 extern EXPCL_PANDAWIN ConfigVariableBool swapbuffer_framelock;
 

+ 17 - 0
panda/src/windisplay/winGraphicsPipe.cxx

@@ -686,16 +686,30 @@ WinGraphicsPipe() {
   // these fns arent defined on win95, so get dynamic ptrs to them
   // to avoid ugly DLL loader failures on w95
   _pfnTrackMouseEvent = NULL;
+  _pfnSetProcessDPIAware = NULL;
 
   _hUser32 = (HINSTANCE)LoadLibrary("user32.dll");
   if (_hUser32 != NULL) {
     _pfnTrackMouseEvent =
       (PFN_TRACKMOUSEEVENT)GetProcAddress(_hUser32, "TrackMouseEvent");
+
+    if (dpi_aware) {
+      _pfnSetProcessDPIAware =
+        (PFN_SETPROCESSDPIAWARE)GetProcAddress(_hUser32, "SetProcessDPIAware");
+
+      if (windisplay_cat.is_debug()) {
+        windisplay_cat.debug() << "Calling SetProcessDPIAware().\n";
+      }
+      _pfnSetProcessDPIAware();
+    }
   }
 
 #ifdef HAVE_DX9
   // Use D3D to get display info.  This is disabled by default as it is slow.
   if (request_dxdisplay_information) {
+    if (windisplay_cat.is_debug()) {
+      windisplay_cat.debug() << "Using Direct3D 9 to fetch display information.\n";
+    }
     DisplaySearchParameters display_search_parameters_dx9;
     int dx9_display_information (DisplaySearchParameters &display_search_parameters_dx9, DisplayInformation *display_information);
     dx9_display_information(display_search_parameters_dx9, _display_information);
@@ -703,6 +717,9 @@ WinGraphicsPipe() {
 #endif
   {
     // Use the Win32 API to query the available display modes.
+    if (windisplay_cat.is_debug()) {
+      windisplay_cat.debug() << "Using EnumDisplaySettings to fetch display information.\n";
+    }
     pvector<DisplayMode> display_modes;
     DEVMODE dm = {0};
     dm.dmSize = sizeof(dm);

+ 4 - 0
panda/src/windisplay/winGraphicsPipe.h

@@ -41,9 +41,13 @@ public:
 
 private:
   HINSTANCE _hUser32;
+
   typedef BOOL (WINAPI *PFN_TRACKMOUSEEVENT)(LPTRACKMOUSEEVENT);
   PFN_TRACKMOUSEEVENT _pfnTrackMouseEvent;
 
+  typedef BOOL (WINAPI *PFN_SETPROCESSDPIAWARE)(void);
+  PFN_SETPROCESSDPIAWARE _pfnSetProcessDPIAware;
+
 public:
   static TypeHandle get_class_type() {
     return _type_handle;

+ 1 - 1
panda/src/windisplay/winGraphicsWindow.cxx

@@ -1272,7 +1272,7 @@ adjust_z_order(WindowProperties::ZOrder last_z_order,
         // have focus now, don't move it to the top; it will get moved
         // the next time we get focus.
         ) {
-      order = HWND_TOP;
+      order = HWND_NOTOPMOST;
       do_change = true;
     }
     break;