From be067c60ddb6a6f7fcdb4652e41537b1ecfb23be Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Thu, 22 Mar 2007 19:59:33 +0000 Subject: [PATCH] Added raw_mice flag to WindowProperties --- direct/src/showbase/ShowBase.py | 7 +++-- panda/src/display/config_display.cxx | 8 +---- panda/src/display/windowProperties.I | 47 ++++++++++++++++++++++++++++ panda/src/display/windowProperties.h | 7 +++++ 4 files changed, 60 insertions(+), 9 deletions(-) diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 1a759027d8..f16c22994a 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -200,7 +200,10 @@ class ShowBase(DirectObject.DirectObject): # Open the default rendering window. 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.eventMgr = eventMgr @@ -433,7 +436,7 @@ class ShowBase(DirectObject.DirectObject): def openWindow(self, props = None, pipe = None, gsg = 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 to be updated every frame. diff --git a/panda/src/display/config_display.cxx b/panda/src/display/config_display.cxx index 7f01e853c9..94120f10aa 100644 --- a/panda/src/display/config_display.cxx +++ b/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 " "screenshots captured via save_screenshot_default(). See " "DisplayRegion::save_screenshot().")); + ConfigVariableString screenshot_extension ("screenshot-extension", "jpg", PRC_DESC("This specifies the default filename extension (and therefore the " "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 ("prefer-texture-buffer", true, PRC_DESC("Set this true to make GraphicsOutput::make_texture_buffer() always " diff --git a/panda/src/display/windowProperties.I b/panda/src/display/windowProperties.I index 273ccb0058..a5682ab0e8 100644 --- a/panda/src/display/windowProperties.I +++ b/panda/src/display/windowProperties.I @@ -467,6 +467,53 @@ clear_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 // Access: Published diff --git a/panda/src/display/windowProperties.h b/panda/src/display/windowProperties.h index 46a8bd8ae8..a121578ba9 100644 --- a/panda/src/display/windowProperties.h +++ b/panda/src/display/windowProperties.h @@ -106,6 +106,11 @@ PUBLISHED: INLINE bool has_minimized() const; 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 bool get_open() const; INLINE bool has_open() const; @@ -161,6 +166,7 @@ private: S_cursor_filename = 0x1000, S_mouse_mode = 0x2000, S_parent_window = 0x4000, + S_raw_mice = 0x8000, }; // This bitmask represents the true/false settings for various @@ -174,6 +180,7 @@ private: F_open = S_open, F_cursor_hidden = S_cursor_hidden, F_fixed_size = S_fixed_size, + F_raw_mice = S_raw_mice, }; int _specified;