From 07565f943fcd9fd63da5c2ebc7a033c2bdc92920 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 12 Apr 2002 02:45:38 +0000 Subject: [PATCH] support opening multiple remote glx windows --- panda/src/display/interactiveGraphicsPipe.cxx | 52 ++++++++++++------- panda/src/display/interactiveGraphicsPipe.h | 5 +- panda/src/display/pipeSpec.cxx | 10 ++-- panda/src/display/pipeSpec.h | 2 +- panda/src/glxdisplay/Sources.pp | 2 + panda/src/glxdisplay/glxDisplay.h | 10 +++- panda/src/glxdisplay/glxGraphicsPipe.cxx | 2 + panda/src/glxdisplay/glxGraphicsPipe.h | 46 +++++++--------- panda/src/wcrdisplay/Sources.pp | 2 + panda/src/wcrdisplay/wcrGraphicsPipe.cxx | 2 +- panda/src/wcrdisplay/wcrGraphicsPipe.h | 2 +- 11 files changed, 77 insertions(+), 58 deletions(-) diff --git a/panda/src/display/interactiveGraphicsPipe.cxx b/panda/src/display/interactiveGraphicsPipe.cxx index 0f54092e17..541aff980d 100644 --- a/panda/src/display/interactiveGraphicsPipe.cxx +++ b/panda/src/display/interactiveGraphicsPipe.cxx @@ -25,37 +25,49 @@ //////////////////////////////////////////////////////////////////// TypeHandle InteractiveGraphicsPipe::_type_handle; -InteractiveGraphicsPipe::InteractiveGraphicsPipe(const PipeSpecifier& spec) - : GraphicsPipe(spec) {} - -InteractiveGraphicsPipe::InteractiveGraphicsPipe(void) { - display_cat.error() - << "InteractiveGraphicsPipe should not be created with default constructor" << endl; +InteractiveGraphicsPipe:: +InteractiveGraphicsPipe(const PipeSpecifier& spec) : + GraphicsPipe(spec) +{ } -InteractiveGraphicsPipe::InteractiveGraphicsPipe(const InteractiveGraphicsPipe&) { - display_cat.error() - << "InteractiveGraphicsPipes should not be copied" << endl; + +InteractiveGraphicsPipe:: +~InteractiveGraphicsPipe() { } -InteractiveGraphicsPipe& InteractiveGraphicsPipe::operator=(const InteractiveGraphicsPipe&) { - display_cat.error() - << "InteractiveGraphicsPipes should not be assigned" << endl; - return *this; -} - -InteractiveGraphicsPipe::~InteractiveGraphicsPipe(void) {} - -TypeHandle InteractiveGraphicsPipe::get_class_type(void) { +TypeHandle InteractiveGraphicsPipe:: +get_class_type(void) { return _type_handle; } -void InteractiveGraphicsPipe::init_type(void) { +void InteractiveGraphicsPipe:: +init_type(void) { GraphicsPipe::init_type(); register_type(_type_handle, "InteractiveGraphicsPipe", GraphicsPipe::get_class_type()); } -TypeHandle InteractiveGraphicsPipe::get_type(void) const { +TypeHandle InteractiveGraphicsPipe:: +get_type(void) const { return get_class_type(); } + +InteractiveGraphicsPipe:: +InteractiveGraphicsPipe(void) { + display_cat.error() + << "InteractiveGraphicsPipe should not be created with default constructor" << endl; +} + +InteractiveGraphicsPipe:: +InteractiveGraphicsPipe(const InteractiveGraphicsPipe&) { + display_cat.error() + << "InteractiveGraphicsPipes should not be copied" << endl; +} + +InteractiveGraphicsPipe &InteractiveGraphicsPipe:: +operator=(const InteractiveGraphicsPipe&) { + display_cat.error() + << "InteractiveGraphicsPipes should not be assigned" << endl; + return *this; +} diff --git a/panda/src/display/interactiveGraphicsPipe.h b/panda/src/display/interactiveGraphicsPipe.h index ca53e8cbe5..49c6f51571 100644 --- a/panda/src/display/interactiveGraphicsPipe.h +++ b/panda/src/display/interactiveGraphicsPipe.h @@ -24,10 +24,9 @@ #include "graphicsPipe.h" class EXPCL_PANDA InteractiveGraphicsPipe : public GraphicsPipe { -public: - +PUBLISHED: InteractiveGraphicsPipe( const PipeSpecifier& ); - virtual ~InteractiveGraphicsPipe(void) = 0; + virtual ~InteractiveGraphicsPipe(void); public: diff --git a/panda/src/display/pipeSpec.cxx b/panda/src/display/pipeSpec.cxx index 4673560f8e..9651cd5f9b 100644 --- a/panda/src/display/pipeSpec.cxx +++ b/panda/src/display/pipeSpec.cxx @@ -39,9 +39,13 @@ std::string PipeSpecifier::get_X_specifier(void) const { std::string ret; if (!_is_file) { - if (getenv("DISPLAY")) { - ret = getenv("DISPLAY"); - } else { + if (_machine.empty()) { + if (getenv("DISPLAY")) { + ret = getenv("DISPLAY"); + } + } + + if (ret.empty()) { ostringstream ss; ss << _machine << ":" << ((_pipe_number<0)?0:_pipe_number) << ".0"; ret = ss.str(); diff --git a/panda/src/display/pipeSpec.h b/panda/src/display/pipeSpec.h index 2fe42bed78..2ad07f87b0 100644 --- a/panda/src/display/pipeSpec.h +++ b/panda/src/display/pipeSpec.h @@ -24,7 +24,7 @@ #include class EXPCL_PANDA PipeSpecifier { -public: +PUBLISHED: PipeSpecifier(void); PipeSpecifier(const PipeSpecifier&); ~PipeSpecifier(void); diff --git a/panda/src/glxdisplay/Sources.pp b/panda/src/glxdisplay/Sources.pp index ee31f460ce..5a80f5217c 100644 --- a/panda/src/glxdisplay/Sources.pp +++ b/panda/src/glxdisplay/Sources.pp @@ -20,5 +20,7 @@ glxDisplay.I glxDisplay.h \ glxGraphicsPipe.h glxGraphicsWindow.I glxGraphicsWindow.h + #define IGATESCAN glxGraphicsPipe.h + #end lib_target diff --git a/panda/src/glxdisplay/glxDisplay.h b/panda/src/glxdisplay/glxDisplay.h index 0ac93591ae..08cad47abe 100644 --- a/panda/src/glxdisplay/glxDisplay.h +++ b/panda/src/glxdisplay/glxDisplay.h @@ -19,14 +19,20 @@ #ifndef GLXDISPLAY_H #define GLXDISPLAY_H -#include -#include +#include "pandabase.h" +#include "typedObject.h" #include class GraphicsPipe; class glxGraphicsWindow; +#ifdef CPPPARSER +// A simple hack so interrogate can parse this file. +typedef int Display; +typedef int Window; +#endif + //////////////////////////////////////////////////////////////////// // Class : glxDisplay // Description : This class is a base class of glxGraphicsPipe, and diff --git a/panda/src/glxdisplay/glxGraphicsPipe.cxx b/panda/src/glxdisplay/glxGraphicsPipe.cxx index 60264b7854..c3139ad536 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.cxx +++ b/panda/src/glxdisplay/glxGraphicsPipe.cxx @@ -15,7 +15,9 @@ // panda3d@yahoogroups.com . // //////////////////////////////////////////////////////////////////// + #include "glxGraphicsPipe.h" +#include "glxGraphicsWindow.h" #include "config_glxdisplay.h" #include diff --git a/panda/src/glxdisplay/glxGraphicsPipe.h b/panda/src/glxdisplay/glxGraphicsPipe.h index 64ff8fe2e1..6bef98c199 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.h +++ b/panda/src/glxdisplay/glxGraphicsPipe.h @@ -15,45 +15,37 @@ // panda3d@yahoogroups.com . // //////////////////////////////////////////////////////////////////// + #ifndef GLXGRAPHICSPIPE_H #define GLXGRAPHICSPIPE_H -// -//////////////////////////////////////////////////////////////////// -// Includes -//////////////////////////////////////////////////////////////////// -#include -#include "glxGraphicsWindow.h" +#include "pandabase.h" #include "glxDisplay.h" - -#include +#include "interactiveGraphicsPipe.h" //////////////////////////////////////////////////////////////////// // Class : glxGraphicsPipe // Description : //////////////////////////////////////////////////////////////////// -class glxGraphicsPipe : public InteractiveGraphicsPipe, public glxDisplay -{ - public: +class glxGraphicsPipe : public InteractiveGraphicsPipe, public glxDisplay { +PUBLISHED: + glxGraphicsPipe( const PipeSpecifier& ); - glxGraphicsPipe( const PipeSpecifier& ); + virtual TypeHandle get_window_type() const; - virtual TypeHandle get_window_type() const; +public: + virtual glxDisplay *get_glx_display(); - virtual glxDisplay *get_glx_display(); - - public: - - static GraphicsPipe* make_glxGraphicsPipe(const FactoryParams ¶ms); - - static TypeHandle get_class_type(void); - static void init_type(void); - virtual TypeHandle get_type(void) const; - virtual TypeHandle force_init_type() {init_type(); return get_class_type();} - - private: - - static TypeHandle _type_handle; +public: + static GraphicsPipe *make_glxGraphicsPipe(const FactoryParams ¶ms); + + static TypeHandle get_class_type(void); + static void init_type(void); + virtual TypeHandle get_type(void) const; + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + +private: + static TypeHandle _type_handle; }; #endif diff --git a/panda/src/wcrdisplay/Sources.pp b/panda/src/wcrdisplay/Sources.pp index 5baa6ea6bd..f0b8d927cf 100644 --- a/panda/src/wcrdisplay/Sources.pp +++ b/panda/src/wcrdisplay/Sources.pp @@ -22,6 +22,8 @@ #define INCLUDED_SOURCES \ config_wcrdisplay.cxx wcrGraphicsPipe.cxx + #define IGATESCAN wcrGraphicsPipe.h + #end lib_target #begin test_bin_target diff --git a/panda/src/wcrdisplay/wcrGraphicsPipe.cxx b/panda/src/wcrdisplay/wcrGraphicsPipe.cxx index 5fa6d4357c..800efdd682 100644 --- a/panda/src/wcrdisplay/wcrGraphicsPipe.cxx +++ b/panda/src/wcrdisplay/wcrGraphicsPipe.cxx @@ -29,7 +29,7 @@ wcrGraphicsPipe::wcrGraphicsPipe(const PipeSpecifier& spec) //////////////////////////////////////////////////////////////////// // Function: wcrGraphicsPipe::get_window_type -// Access: Public, Virtual +// Access: Published, Virtual // Description: Returns the TypeHandle of the kind of window // preferred by this kind of pipe. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/wcrdisplay/wcrGraphicsPipe.h b/panda/src/wcrdisplay/wcrGraphicsPipe.h index 8b31a861d6..82cc50808a 100644 --- a/panda/src/wcrdisplay/wcrGraphicsPipe.h +++ b/panda/src/wcrdisplay/wcrGraphicsPipe.h @@ -35,7 +35,7 @@ // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDACR wcrGraphicsPipe : public InteractiveGraphicsPipe { -public: +PUBLISHED: wcrGraphicsPipe(const PipeSpecifier&); virtual TypeHandle get_window_type() const;