add supports_fullscreen() etc. to graphicsPipe

This commit is contained in:
David Rose 2003-01-14 20:02:32 +00:00
parent fad8dc93f2
commit 99b5342b5b
7 changed files with 66 additions and 27 deletions

View File

@ -34,3 +34,47 @@ INLINE bool GraphicsPipe::
is_valid() const { is_valid() const {
return _is_valid; 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;
}

View File

@ -32,6 +32,13 @@ GraphicsPipe() {
// Initially, we assume the GraphicsPipe is valid. A derived class // Initially, we assume the GraphicsPipe is valid. A derived class
// should set this to false if it determines otherwise. // should set this to false if it determines otherwise.
_is_valid = true; _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;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

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

View File

@ -48,23 +48,3 @@ INLINE Window glxGraphicsPipe::
get_root() const { get_root() const {
return _root; 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;
}

View File

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

View File

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

View File

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