Browse Source

restore win-origin-x and win-origin-y

David Rose 22 years ago
parent
commit
6bc826c5a5

+ 4 - 0
direct/src/showbase/ShowBase.py

@@ -89,6 +89,8 @@ class ShowBase(DirectObject.DirectObject):
         # Get the default window properties.
         winWidth = self.config.GetInt('win-width', 640)
         winHeight = self.config.GetInt('win-height', 480)
+        winOriginX = self.config.GetInt('win-origin-x', -1)
+        winOriginY = self.config.GetInt('win-origin-y', -1)
         fullscreen = self.config.GetBool('fullscreen', 0)
         undecorated = self.config.GetBool('undecorated', 0)
         cursorHidden = self.config.GetBool('cursor-hidden', 0)
@@ -97,6 +99,8 @@ class ShowBase(DirectObject.DirectObject):
         self.defaultWindowProps = WindowProperties()
         self.defaultWindowProps.setOpen(1)
         self.defaultWindowProps.setSize(winWidth, winHeight)
+        if winOriginX >= 0 and winOriginY >= 0:
+            self.defaultWindowProps.setOrigin(winOriginX, winOriginY)
         self.defaultWindowProps.setFullscreen(fullscreen)
         self.defaultWindowProps.setUndecorated(undecorated)
         self.defaultWindowProps.setCursorHidden(cursorHidden)

+ 2 - 0
panda/src/framework/config_framework.cxx

@@ -30,6 +30,8 @@ ConfigureFn(config_framework) {
 
 const int win_width = config_framework.GetInt("win-width", 640);
 const int win_height = config_framework.GetInt("win-height", 480);
+const int win_origin_x = config_framework.GetInt("win-origin-x", -1);
+const int win_origin_y = config_framework.GetInt("win-origin-y", -1);
 const bool fullscreen = config_framework.GetBool("fullscreen", false);
 const bool undecorated = config_framework.GetBool("undecorated", false);
 const bool cursor_hidden = config_framework.GetBool("cursor-hidden", false);

+ 2 - 0
panda/src/framework/config_framework.h

@@ -27,6 +27,8 @@ NotifyCategoryDecl(framework, EXPCL_FRAMEWORK, EXPTP_FRAMEWORK);
 // Configure variables for framework package.
 extern const int win_width;
 extern const int win_height;
+extern const int win_origin_x;
+extern const int win_origin_y;
 extern const bool fullscreen;
 extern const bool undecorated;
 extern const bool cursor_hidden;

+ 3 - 0
panda/src/framework/pandaFramework.cxx

@@ -206,6 +206,9 @@ void PandaFramework::
 get_default_window_props(WindowProperties &props) {
   props.set_open(true);
   props.set_size(win_width, win_height);
+  if (win_origin_x >= 0 && win_origin_y >= 0) {
+    props.set_origin(win_origin_x, win_origin_y);
+  }
   props.set_fullscreen(fullscreen);
   props.set_undecorated(undecorated);
   props.set_cursor_hidden(cursor_hidden);