Browse Source

Added raw_mice flag to WindowProperties

Josh Yelon 19 years ago
parent
commit
be067c60dd

+ 5 - 2
direct/src/showbase/ShowBase.py

@@ -200,7 +200,10 @@ class ShowBase(DirectObject.DirectObject):
 
 
         # Open the default rendering window.
         # Open the default rendering window.
         if self.windowType != 'none':
         if self.windowType != 'none':
-            self.openDefaultWindow(startDirect = False)
+	    props = WindowProperties.getDefault()
+	    if (self.config.GetBool('read-raw-mice', 1)):
+	        props.setRawMice(1)
+            self.openDefaultWindow(startDirect = False, props=props)
 
 
         self.loader = Loader.Loader(self)
         self.loader = Loader.Loader(self)
         self.eventMgr = eventMgr
         self.eventMgr = eventMgr
@@ -433,7 +436,7 @@ class ShowBase(DirectObject.DirectObject):
 
 
     def openWindow(self, props = None, pipe = None, gsg = None,
     def openWindow(self, props = None, pipe = None, gsg = None,
                    type = None, name = None, size = None, aspectRatio = None,
                    type = None, name = None, size = None, aspectRatio = None,
-                   makeCamera = 1, scene = None, stereo = None):
+                   makeCamera = 1, scene = None, stereo = None, rawmice = 0):
         """
         """
         Creates a window and adds it to the list of windows that are
         Creates a window and adds it to the list of windows that are
         to be updated every frame.
         to be updated every frame.

+ 1 - 7
panda/src/display/config_display.cxx

@@ -90,18 +90,12 @@ ConfigVariableString screenshot_filename
  PRC_DESC("This specifies the filename pattern to be used to generate "
  PRC_DESC("This specifies the filename pattern to be used to generate "
           "screenshots captured via save_screenshot_default().  See "
           "screenshots captured via save_screenshot_default().  See "
           "DisplayRegion::save_screenshot()."));
           "DisplayRegion::save_screenshot()."));
+
 ConfigVariableString screenshot_extension
 ConfigVariableString screenshot_extension
 ("screenshot-extension", "jpg",
 ("screenshot-extension", "jpg",
  PRC_DESC("This specifies the default filename extension (and therefore the "
  PRC_DESC("This specifies the default filename extension (and therefore the "
           "default image type) to be used for saving screenshots."));
           "default image type) to be used for saving screenshots."));
 
 
-// I'll remove this permanently in a few days. - Josh
-//ConfigVariableBool show_buffers
-//("show-buffers", false,
-// PRC_DESC("Set this true to cause offscreen GraphicsBuffers to be created as "
-//          "GraphicsWindows, if possible, so that their contents may be viewed "
-//          "interactively.  Handy during development of multipass algorithms."));
-
 ConfigVariableBool prefer_texture_buffer
 ConfigVariableBool prefer_texture_buffer
 ("prefer-texture-buffer", true,
 ("prefer-texture-buffer", true,
  PRC_DESC("Set this true to make GraphicsOutput::make_texture_buffer() always "
  PRC_DESC("Set this true to make GraphicsOutput::make_texture_buffer() always "

+ 47 - 0
panda/src/display/windowProperties.I

@@ -467,6 +467,53 @@ clear_minimized() {
   _flags &= ~F_minimized;
   _flags &= ~F_minimized;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: WindowProperties::set_raw_mice
+//       Access: Published
+//  Description: Specifies whether the window should read the raw
+//               mouse devices.
+////////////////////////////////////////////////////////////////////
+INLINE void WindowProperties::
+set_raw_mice(bool raw_mice) {
+  if (raw_mice) {
+    _flags |= F_raw_mice;
+  } else {
+    _flags &= ~F_raw_mice;
+  }
+  _specified |= S_raw_mice;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: WindowProperties::get_raw_mice
+//       Access: Published
+//  Description: Returns true if the window reads the raw mice.
+////////////////////////////////////////////////////////////////////
+INLINE bool WindowProperties::
+get_raw_mice() const {
+  return (_flags & F_raw_mice) != 0;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: WindowProperties::has_raw_mice
+//       Access: Published
+//  Description: Returns true if set_raw_mice() has been specified.
+////////////////////////////////////////////////////////////////////
+INLINE bool WindowProperties::
+has_raw_mice() const {
+  return ((_specified & S_raw_mice) != 0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: WindowProperties::clear_raw_mice
+//       Access: Published
+//  Description: Removes the raw_mice specification from the properties.
+////////////////////////////////////////////////////////////////////
+INLINE void WindowProperties::
+clear_raw_mice() {
+  _specified &= ~S_raw_mice;
+  _flags &= ~F_raw_mice;
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: WindowProperties::set_open
 //     Function: WindowProperties::set_open
 //       Access: Published
 //       Access: Published

+ 7 - 0
panda/src/display/windowProperties.h

@@ -106,6 +106,11 @@ PUBLISHED:
   INLINE bool has_minimized() const;
   INLINE bool has_minimized() const;
   INLINE void clear_minimized();
   INLINE void clear_minimized();
 
 
+  INLINE void set_raw_mice(bool raw_mice);
+  INLINE bool get_raw_mice() const;
+  INLINE bool has_raw_mice() const;
+  INLINE void clear_raw_mice();
+
   INLINE void set_open(bool open);
   INLINE void set_open(bool open);
   INLINE bool get_open() const;
   INLINE bool get_open() const;
   INLINE bool has_open() const;
   INLINE bool has_open() const;
@@ -161,6 +166,7 @@ private:
     S_cursor_filename  = 0x1000,
     S_cursor_filename  = 0x1000,
     S_mouse_mode       = 0x2000,
     S_mouse_mode       = 0x2000,
     S_parent_window    = 0x4000,
     S_parent_window    = 0x4000,
+    S_raw_mice         = 0x8000,
   };
   };
 
 
   // This bitmask represents the true/false settings for various
   // This bitmask represents the true/false settings for various
@@ -174,6 +180,7 @@ private:
     F_open           = S_open,
     F_open           = S_open,
     F_cursor_hidden  = S_cursor_hidden,
     F_cursor_hidden  = S_cursor_hidden,
     F_fixed_size     = S_fixed_size,
     F_fixed_size     = S_fixed_size,
+    F_raw_mice       = S_raw_mice,
   };
   };
 
 
   int _specified;
   int _specified;