2
0
Эх сурвалжийг харах

add supports_fullscreen() etc. to graphicsPipe

David Rose 23 жил өмнө
parent
commit
99b5342b5b

+ 44 - 0
panda/src/display/graphicsPipe.I

@@ -34,3 +34,47 @@ INLINE bool GraphicsPipe::
 is_valid() const {
   return _is_valid;
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsPipe::supports_fullscreen
+//       Access: Published
+//  Description: Returns false if this pipe is known to not support
+//               any creation of fullscreen windows.  If this returns
+//               false, any attempt to create a window with the
+//               fullscreen property set will certainly fail.
+//
+//               Returns true when the pipe will probably support
+//               fullscreen windows.  This is not, however, a
+//               guarantee that an attempt to create a fullscreen
+//               window will not fail.
+////////////////////////////////////////////////////////////////////
+INLINE bool GraphicsPipe::
+supports_fullscreen() const {
+  return _supports_fullscreen;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsPipe::get_display_width
+//       Access: Public
+//  Description: Returns the width of the entire display, if it is
+//               known.  This may return 0.  This is not a guarantee
+//               that windows (particularly fullscreen windows) may
+//               not be created larger than this width, but it is
+//               intended to provide a hint to the application.
+////////////////////////////////////////////////////////////////////
+INLINE int GraphicsPipe::
+get_display_width() const {
+  return _display_width;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsPipe::get_display_height
+//       Access: Public
+//  Description: Returns the height of the entire display, if it is
+//               known.  This may return 0.  See the caveats for
+//               get_display_width().
+////////////////////////////////////////////////////////////////////
+INLINE int GraphicsPipe::
+get_display_height() const {
+  return _display_height;
+}

+ 7 - 0
panda/src/display/graphicsPipe.cxx

@@ -32,6 +32,13 @@ GraphicsPipe() {
   // Initially, we assume the GraphicsPipe is valid.  A derived class
   // should set this to false if it determines otherwise.
   _is_valid = true;
+
+  // Similarly, we initially assume the pipe will support fullscreen
+  // windows.  A derived class can choose to inform us otherwise.
+  _supports_fullscreen = true;
+
+  _display_width = 0;
+  _display_height = 0;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 8 - 0
panda/src/display/graphicsPipe.h

@@ -60,6 +60,11 @@ PUBLISHED:
   PT(GraphicsWindow) get_window(int n) const;
 
   INLINE bool is_valid() const;
+  INLINE bool supports_fullscreen() const;
+
+  INLINE int get_display_width() const;
+  INLINE int get_display_height() const;
+
   virtual string get_interface_name() const=0;
 
 public:
@@ -81,6 +86,9 @@ protected:
   Mutex _lock;
 
   bool _is_valid;
+  bool _supports_fullscreen;
+  int _display_width;
+  int _display_height;
 
 public:
   static TypeHandle get_class_type() {

+ 0 - 20
panda/src/glxdisplay/glxGraphicsPipe.I

@@ -48,23 +48,3 @@ INLINE Window glxGraphicsPipe::
 get_root() const {
   return _root;
 }
-
-////////////////////////////////////////////////////////////////////
-//     Function: glxGraphicsPipe::get_display_width
-//       Access: Public
-//  Description: Returns the width of the entire display.
-////////////////////////////////////////////////////////////////////
-INLINE int glxGraphicsPipe::
-get_display_width() const {
-  return _display_width;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: glxGraphicsPipe::get_display_height
-//       Access: Public
-//  Description: Returns the height of the entire display.
-////////////////////////////////////////////////////////////////////
-INLINE int glxGraphicsPipe::
-get_display_height() const {
-  return _display_height;
-}

+ 2 - 2
panda/src/glxdisplay/glxGraphicsPipe.cxx

@@ -41,11 +41,10 @@ glxGraphicsPipe(const string &display) {
   }
 
   _is_valid = false;
+  _supports_fullscreen = false;
   _display = NULL;
   _screen = 0;
   _root = (Window)NULL;
-  _display_width = 0;
-  _display_height = 0;
 
   _display = XOpenDisplay(display_spec.c_str());
   if (!_display) {
@@ -118,5 +117,6 @@ make_window() {
   if (!_is_valid) {
     return NULL;
   }
+
   return new glxGraphicsWindow(this);
 }

+ 0 - 5
panda/src/glxdisplay/glxGraphicsPipe.h

@@ -49,19 +49,14 @@ public:
   INLINE Display *get_display() const;
   INLINE int get_screen() const;
   INLINE Window get_root() const;
-  INLINE int get_display_width() const;
-  INLINE int get_display_height() const;
 
 protected:
   virtual PT(GraphicsWindow) make_window();
 
 private:
-  bool _is_valid;
   Display *_display;
   int _screen;
   Window _root;
-  int _display_width;
-  int _display_height;
 
 
 public:

+ 5 - 0
panda/src/glxdisplay/glxGraphicsWindow.cxx

@@ -314,6 +314,11 @@ close_window() {
 ////////////////////////////////////////////////////////////////////
 bool glxGraphicsWindow::
 open_window() {
+  if (_properties.get_fullscreen()) {
+    // We don't support fullscreen windows.
+    return false;
+  }
+
   if (!_properties.has_origin()) {
     _properties.set_origin(0, 0);
   }