Browse Source

windisplay: fix origin not respected when switching to windowed mode

rdb 3 years ago
parent
commit
b518da99a6
1 changed files with 11 additions and 8 deletions
  1. 11 8
      panda/src/windisplay/winGraphicsWindow.cxx

+ 11 - 8
panda/src/windisplay/winGraphicsWindow.cxx

@@ -283,6 +283,17 @@ process_events() {
  */
 void WinGraphicsWindow::
 set_properties_now(WindowProperties &properties) {
+  if (properties.has_fullscreen() && !properties.get_fullscreen() &&
+      is_fullscreen()) {
+    if (do_windowed_switch()) {
+      _properties.set_fullscreen(false);
+      properties.clear_fullscreen();
+    } else {
+      windisplay_cat.warning()
+        << "Switching to windowed mode failed!\n";
+    }
+  }
+
   GraphicsWindow::set_properties_now(properties);
   if (!properties.is_any_specified()) {
     // The base class has already handled this case.
@@ -413,14 +424,6 @@ set_properties_now(WindowProperties &properties) {
         windisplay_cat.warning()
           << "Switching to fullscreen mode failed!\n";
       }
-    } else if (!properties.get_fullscreen() && is_fullscreen()){
-      if (do_windowed_switch()){
-        _properties.set_fullscreen(false);
-        properties.clear_fullscreen();
-      } else {
-        windisplay_cat.warning()
-          << "Switching to windowed mode failed!\n";
-      }
     }
   }