From 99b5342b5b1396b94c50816ac40686ce38fc0d46 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 14 Jan 2003 20:02:32 +0000 Subject: [PATCH] add supports_fullscreen() etc. to graphicsPipe --- panda/src/display/graphicsPipe.I | 44 ++++++++++++++++++++++ panda/src/display/graphicsPipe.cxx | 7 ++++ panda/src/display/graphicsPipe.h | 8 ++++ panda/src/glxdisplay/glxGraphicsPipe.I | 20 ---------- panda/src/glxdisplay/glxGraphicsPipe.cxx | 4 +- panda/src/glxdisplay/glxGraphicsPipe.h | 5 --- panda/src/glxdisplay/glxGraphicsWindow.cxx | 5 +++ 7 files changed, 66 insertions(+), 27 deletions(-) diff --git a/panda/src/display/graphicsPipe.I b/panda/src/display/graphicsPipe.I index 3da9d91ba6..0ebd5a6846 100644 --- a/panda/src/display/graphicsPipe.I +++ b/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; +} diff --git a/panda/src/display/graphicsPipe.cxx b/panda/src/display/graphicsPipe.cxx index 3b1be1a8cd..1178f245be 100644 --- a/panda/src/display/graphicsPipe.cxx +++ b/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; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/display/graphicsPipe.h b/panda/src/display/graphicsPipe.h index 9690c8ee2c..914fa8f793 100644 --- a/panda/src/display/graphicsPipe.h +++ b/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() { diff --git a/panda/src/glxdisplay/glxGraphicsPipe.I b/panda/src/glxdisplay/glxGraphicsPipe.I index 4600c23f4a..1d3721fa74 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.I +++ b/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; -} diff --git a/panda/src/glxdisplay/glxGraphicsPipe.cxx b/panda/src/glxdisplay/glxGraphicsPipe.cxx index 1e029490bf..10e24148eb 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.cxx +++ b/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); } diff --git a/panda/src/glxdisplay/glxGraphicsPipe.h b/panda/src/glxdisplay/glxGraphicsPipe.h index 3c7f385deb..293865e2c5 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.h +++ b/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: diff --git a/panda/src/glxdisplay/glxGraphicsWindow.cxx b/panda/src/glxdisplay/glxGraphicsWindow.cxx index 6d887ddba3..0214555d31 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.cxx +++ b/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); }