*** empty log message ***

This commit is contained in:
David Rose 2000-10-31 07:00:44 +00:00
parent f069740c93
commit 77fef0c9e5
12 changed files with 286 additions and 114 deletions

View File

@ -231,6 +231,24 @@ get_pipe(int n) {
return get_all_pipes()[n]; return get_all_pipes()[n];
} }
////////////////////////////////////////////////////////////////////
// Function: GraphicsPipe::get_glx_display
// Access: Public, Virtual
// Description: Returns the glxDisplay information associated with
// this pipe, if any. This allows us to define several
// kinds of GraphicsPipe objects that manage some
// glx-specific stuff, without having them all inherit
// from a common glx base class. This allows the
// glxGraphicsWindow to ask questions about the
// glx-specific stuff without knowing what kind of
// glxGraphicsPipe it has. Non-glx pipes will simply
// return NULL for this function.
////////////////////////////////////////////////////////////////////
glxDisplay *GraphicsPipe::
get_glx_display() {
return (glxDisplay *)NULL;
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: GraphicsPipe::get_num_hw_channels // Function: GraphicsPipe::get_num_hw_channels

View File

@ -27,6 +27,7 @@
// Defines // Defines
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class GraphicsPipe; class GraphicsPipe;
class glxDisplay;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : GraphicsPipe // Class : GraphicsPipe
@ -53,6 +54,10 @@ public:
static int get_num_pipes(); static int get_num_pipes();
static GraphicsPipe *get_pipe(int n); static GraphicsPipe *get_pipe(int n);
// This function's interface must be defined here even though we
// know nothing about glx displays at this point.
virtual glxDisplay *get_glx_display();
protected: protected:
virtual int get_num_hw_channels(); virtual int get_num_hw_channels();
virtual HardwareChannel *get_hw_channel(GraphicsWindow *, int); virtual HardwareChannel *get_hw_channel(GraphicsWindow *, int);

View File

@ -10,11 +10,13 @@
glgsg glgsg
#define SOURCES \ #define SOURCES \
config_glxdisplay.cxx config_glxdisplay.h glxGraphicsPipe.cxx \ config_glxdisplay.cxx config_glxdisplay.h \
glxDisplay.I glxDisplay.h glxDisplay.cxx glxGraphicsPipe.cxx \
glxGraphicsPipe.h glxGraphicsWindow.I glxGraphicsWindow.cxx \ glxGraphicsPipe.h glxGraphicsWindow.I glxGraphicsWindow.cxx \
glxGraphicsWindow.h glxGraphicsWindow.h
#define INSTALL_HEADERS \ #define INSTALL_HEADERS \
glxDisplay.I glxDisplay.h \
glxGraphicsPipe.h glxGraphicsWindow.I glxGraphicsWindow.h glxGraphicsPipe.h glxGraphicsWindow.I glxGraphicsWindow.h
#end lib_target #end lib_target

View File

@ -6,6 +6,7 @@
#include "config_glxdisplay.h" #include "config_glxdisplay.h"
#include "glxGraphicsPipe.h" #include "glxGraphicsPipe.h"
#include "glxGraphicsWindow.h" #include "glxGraphicsWindow.h"
#include "glxDisplay.h"
#include <dconfig.h> #include <dconfig.h>
@ -19,4 +20,5 @@ ConfigureFn(config_glxdisplay) {
glxGraphicsWindow::init_type(); glxGraphicsWindow::init_type();
GraphicsWindow::_factory.register_factory(glxGraphicsWindow::get_class_type(), GraphicsWindow::_factory.register_factory(glxGraphicsWindow::get_class_type(),
glxGraphicsWindow::make_GlxGraphicsWindow); glxGraphicsWindow::make_GlxGraphicsWindow);
glxDisplay::init_type();
} }

View File

@ -0,0 +1,57 @@
// Filename: glxDisplay.I
// Created by: drose (30Oct00)
//
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: glxDisplay::get_display
// Access: Public
// Description: Returns a pointer to the X display associated with
// the pipe: the display on which to create the windows.
////////////////////////////////////////////////////////////////////
INLINE Display *glxDisplay::
get_display() const {
return _display;
}
////////////////////////////////////////////////////////////////////
// Function: glxDisplay::get_screen
// Access: Public
// Description: Returns the X screen number associated with the pipe.
////////////////////////////////////////////////////////////////////
INLINE int glxDisplay::
get_screen() const {
return _screen;
}
////////////////////////////////////////////////////////////////////
// Function: glxDisplay::get_root
// Access: Public
// Description: Returns the handle to the root window on the pipe's
// display.
////////////////////////////////////////////////////////////////////
INLINE Window glxDisplay::
get_root() const {
return _root;
}
////////////////////////////////////////////////////////////////////
// Function: glxDisplay::get_display_width
// Access: Public
// Description: Returns the width of the entire display.
////////////////////////////////////////////////////////////////////
INLINE int glxDisplay::
get_display_width() const {
return _width;
}
////////////////////////////////////////////////////////////////////
// Function: glxDisplay::get_display_height
// Access: Public
// Description: Returns the height of the entire display.
////////////////////////////////////////////////////////////////////
INLINE int glxDisplay::
get_display_height() const {
return _height;
}

View File

@ -0,0 +1,62 @@
// Filename: glxDisplay.cxx
// Created by: drose (30Oct00)
//
////////////////////////////////////////////////////////////////////
#include "glxDisplay.h"
#include "glxGraphicsWindow.h"
#include "config_glxdisplay.h"
#include <graphicsPipe.h>
#include <GL/glx.h>
TypeHandle glxDisplay::_type_handle;
////////////////////////////////////////////////////////////////////
// Function: glxDisplay::Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
glxDisplay::
glxDisplay(GraphicsPipe *pipe, const string &x_specifier) {
_pipe = pipe;
_display = XOpenDisplay(x_specifier.c_str());
if (!_display) {
glxdisplay_cat.fatal()
<< "glxGraphicsPipe::construct(): Could not open display: "
<< x_specifier << endl;
exit(1);
}
int errorBase, eventBase;
if (!glXQueryExtension(_display, &errorBase, &eventBase)) {
glxdisplay_cat.fatal()
<< "glxGraphicsPipe::construct(): OpenGL GLX extension not "
<< "supported by display: " << x_specifier << endl;
exit(1);
}
_screen = DefaultScreen(_display);
_root = RootWindow(_display, _screen);
_width = DisplayWidth(_display, _screen);
_height = DisplayHeight(_display, _screen);
}
////////////////////////////////////////////////////////////////////
// Function: glxDisplay::find_window
// Access: Public
// Description: Find the window that has the xwindow "win" in the
// window list for the pipe (if it exists)
////////////////////////////////////////////////////////////////////
glxGraphicsWindow *glxDisplay::
find_window(Window win) const {
int num_windows = _pipe->get_num_windows();
for (int w = 0; w < num_windows; w++) {
glxGraphicsWindow *window;
DCAST_INTO_R(window, _pipe->get_window(w), NULL);
if (window->get_xwindow() == win) {
return window;
}
}
return NULL;
}

View File

@ -0,0 +1,65 @@
// Filename: glxDisplay.h
// Created by: drose (30Oct00)
//
////////////////////////////////////////////////////////////////////
#ifndef GLXDISPLAY_H
#define GLXDISPLAY_H
#include <pandabase.h>
#include <typeHandle.h>
#include <X11/Xlib.h>
class GraphicsPipe;
class glxGraphicsWindow;
////////////////////////////////////////////////////////////////////
// Class : glxDisplay
// Description : This class is a base class of glxGraphicsPipe, and
// also of SgiGlxGraphicsPipe and potentially other
// glx-based pipes. It simply records some information
// about the display that's useful to the
// glxGraphicsWindow.
////////////////////////////////////////////////////////////////////
class glxDisplay : public TypedObject {
public:
glxDisplay(GraphicsPipe *pipe, const string &x_specifier);
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;
glxGraphicsWindow *find_window(Window win) const;
private:
GraphicsPipe *_pipe;
Display *_display;
int _screen;
Window _root;
int _width;
int _height;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "glxDisplay",
TypedObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "glxDisplay.I"
#endif

View File

@ -17,27 +17,9 @@
TypeHandle glxGraphicsPipe::_type_handle; TypeHandle glxGraphicsPipe::_type_handle;
glxGraphicsPipe::glxGraphicsPipe(const PipeSpecifier& spec) glxGraphicsPipe::glxGraphicsPipe(const PipeSpecifier& spec)
: InteractiveGraphicsPipe(spec) : InteractiveGraphicsPipe(spec),
glxDisplay(this, spec.get_X_specifier())
{ {
// _display = XOpenDisplay(get_name().c_str());
_display = XOpenDisplay((spec.get_X_specifier()).c_str());
if (!_display) {
glxdisplay_cat.fatal()
<< "glxGraphicsPipe::construct(): Could not open display: "
<< spec.get_X_specifier() << endl;
exit(0);
}
int errorBase, eventBase;
if (!glXQueryExtension(_display, &errorBase, &eventBase)) {
glxdisplay_cat.fatal()
<< "glxGraphicsPipe::construct(): OpenGL GLX extension not "
<< "supported by display: " << spec.get_X_specifier() << endl;
exit(0);
}
_screen = DefaultScreen(_display);
_root = RootWindow(_display, _screen);
_width = DisplayWidth(_display, _screen);
_height = DisplayHeight(_display, _screen);
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -51,6 +33,17 @@ get_window_type() const {
return glxGraphicsWindow::get_class_type(); return glxGraphicsWindow::get_class_type();
} }
////////////////////////////////////////////////////////////////////
// Function: glxGraphicsPipe::get_glx_display
// Access: Public, Virtual
// Description: Returns the glxDisplay information associated with
// this pipe.
////////////////////////////////////////////////////////////////////
glxDisplay *glxGraphicsPipe::
get_glx_display() {
return this;
}
GraphicsPipe *glxGraphicsPipe:: GraphicsPipe *glxGraphicsPipe::
make_glxGraphicsPipe(const FactoryParams &params) { make_glxGraphicsPipe(const FactoryParams &params) {
GraphicsPipe::PipeSpec *pipe_param; GraphicsPipe::PipeSpec *pipe_param;
@ -67,44 +60,12 @@ TypeHandle glxGraphicsPipe::get_class_type(void) {
void glxGraphicsPipe::init_type(void) { void glxGraphicsPipe::init_type(void) {
InteractiveGraphicsPipe::init_type(); InteractiveGraphicsPipe::init_type();
glxDisplay::init_type();
register_type(_type_handle, "glxGraphicsPipe", register_type(_type_handle, "glxGraphicsPipe",
InteractiveGraphicsPipe::get_class_type()); InteractiveGraphicsPipe::get_class_type(),
glxDisplay::get_class_type());
} }
TypeHandle glxGraphicsPipe::get_type(void) const { TypeHandle glxGraphicsPipe::get_type(void) const {
return get_class_type(); return get_class_type();
} }
glxGraphicsPipe::glxGraphicsPipe(void) {
glxdisplay_cat.error()
<< "glxGraphicsPipes should not be created with the default constructor"
<< endl;
}
glxGraphicsPipe::glxGraphicsPipe(const glxGraphicsPipe&) {
glxdisplay_cat.error()
<< "glxGraphicsPipes should not be copied" << endl;
}
glxGraphicsPipe& glxGraphicsPipe::operator=(const glxGraphicsPipe&) {
glxdisplay_cat.error()
<< "glxGraphicsPipes should not be assigned" << endl;
return *this;
}
////////////////////////////////////////////////////////////////////
// Function: find_window
// Access:
// Description: Find the window that has the xwindow "win" in the
// window list for the pipe (if it exists)
////////////////////////////////////////////////////////////////////
glxGraphicsWindow *glxGraphicsPipe::
find_window(Window win) {
int num_windows = get_num_windows();
for (int w = 0; w < num_windows; w++) {
glxGraphicsWindow *window = DCAST(glxGraphicsWindow, get_window(w));
if (window->get_xwindow() == win)
return window;
}
return NULL;
}

View File

@ -11,21 +11,16 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include <pandabase.h> #include <pandabase.h>
#include <string>
#include <interactiveGraphicsPipe.h>
#include "glxGraphicsWindow.h" #include "glxGraphicsWindow.h"
#include <X11/Xlib.h> #include "glxDisplay.h"
//////////////////////////////////////////////////////////////////// #include <interactiveGraphicsPipe.h>
// Defines
////////////////////////////////////////////////////////////////////
class Xclass;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : glxGraphicsPipe // Class : glxGraphicsPipe
// Description : // Description :
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class glxGraphicsPipe : public InteractiveGraphicsPipe class glxGraphicsPipe : public InteractiveGraphicsPipe, public glxDisplay
{ {
public: public:
@ -33,7 +28,7 @@ class glxGraphicsPipe : public InteractiveGraphicsPipe
virtual TypeHandle get_window_type() const; virtual TypeHandle get_window_type() const;
glxGraphicsWindow* find_window(Window win); virtual glxDisplay *get_glx_display();
public: public:
@ -44,25 +39,9 @@ class glxGraphicsPipe : public InteractiveGraphicsPipe
virtual TypeHandle get_type(void) const; virtual TypeHandle get_type(void) const;
virtual TypeHandle force_init_type() {init_type(); return get_class_type();} virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
INLINE Display* get_display(void) { return _display; }
INLINE int get_screen(void) { return _screen; }
INLINE Window get_root(void) { return _root; }
private: private:
static TypeHandle _type_handle; static TypeHandle _type_handle;
Display* _display;
int _screen;
Window _root;
int _width;
int _height;
protected:
glxGraphicsPipe( void );
glxGraphicsPipe( const glxGraphicsPipe& );
glxGraphicsPipe& operator=(const glxGraphicsPipe&);
}; };
#endif #endif

View File

@ -7,9 +7,10 @@
// Includes // Includes
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include "glxGraphicsWindow.h" #include "glxGraphicsWindow.h"
#include "glxGraphicsPipe.h" #include "glxDisplay.h"
#include "config_glxdisplay.h" #include "config_glxdisplay.h"
#include <graphicsPipe.h>
#include <keyboardButton.h> #include <keyboardButton.h>
#include <mouseButton.h> #include <mouseButton.h>
#include <glGraphicsStateGuardian.h> #include <glGraphicsStateGuardian.h>
@ -82,11 +83,14 @@ bool glxGraphicsWindow::glx_supports(const char* extension)
char* where, *terminator; char* where, *terminator;
int major, minor; int major, minor;
glxDisplay *glx = _pipe->get_glx_display();
nassertr(glx != (glxDisplay *)NULL, false);
glXQueryVersion(_display, &major, &minor); glXQueryVersion(_display, &major, &minor);
if ((major == 1 && minor >= 1) || (major > 1)) { if ((major == 1 && minor >= 1) || (major > 1)) {
if (!_glx_extensions) { if (!_glx_extensions) {
_glx_extensions = glXQueryExtensionsString(_display, _glx_extensions =
((glxGraphicsPipe *)_pipe)->get_screen()); glXQueryExtensionsString(_display, glx->get_screen());
} }
start = _glx_extensions; start = _glx_extensions;
for (;;) { for (;;) {
@ -116,7 +120,7 @@ bool glxGraphicsWindow::glx_supports(const char* extension)
// visual information if possible, or NULL if it is not. // visual information if possible, or NULL if it is not.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
static XVisualInfo * static XVisualInfo *
try_for_visual(glxGraphicsPipe *pipe, int mask, try_for_visual(glxDisplay *glx, int mask,
int want_depth_bits = 1, int want_color_bits = 1) { int want_depth_bits = 1, int want_color_bits = 1) {
static const int max_attrib_list = 32; static const int max_attrib_list = 32;
int attrib_list[max_attrib_list]; int attrib_list[max_attrib_list];
@ -191,7 +195,7 @@ try_for_visual(glxGraphicsPipe *pipe, int mask,
attrib_list[n] = (int)None; attrib_list[n] = (int)None;
XVisualInfo *vinfo = XVisualInfo *vinfo =
glXChooseVisual(pipe->get_display(), pipe->get_screen(), attrib_list); glXChooseVisual(glx->get_display(), glx->get_screen(), attrib_list);
if (glxdisplay_cat.is_debug()) { if (glxdisplay_cat.is_debug()) {
if (vinfo != NULL) { if (vinfo != NULL) {
@ -211,7 +215,8 @@ try_for_visual(glxGraphicsPipe *pipe, int mask,
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void glxGraphicsWindow::choose_visual(void) void glxGraphicsWindow::choose_visual(void)
{ {
glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe); glxDisplay *glx = _pipe->get_glx_display();
nassertv(glx != (glxDisplay *)NULL);
int mask = _props._mask; int mask = _props._mask;
int want_depth_bits = _props._want_depth_bits; int want_depth_bits = _props._want_depth_bits;
@ -228,7 +233,7 @@ void glxGraphicsWindow::choose_visual(void)
} }
#endif #endif
_visual = try_for_visual(pipe, mask, want_depth_bits, want_color_bits); _visual = try_for_visual(glx, mask, want_depth_bits, want_color_bits);
// This is the severity level at which we'll report the details of // This is the severity level at which we'll report the details of
// the visual we actually do find. Normally, it's debug-level // the visual we actually do find. Normally, it's debug-level
@ -258,7 +263,7 @@ void glxGraphicsWindow::choose_visual(void)
// Actually, first we'll eliminate all of the minimum sizes, to // Actually, first we'll eliminate all of the minimum sizes, to
// try to open a window with all of the requested options, but // try to open a window with all of the requested options, but
// maybe not as many bits in some options as we'd like. // maybe not as many bits in some options as we'd like.
_visual = try_for_visual(pipe, mask); _visual = try_for_visual(glx, mask);
} }
if (_visual == NULL) { if (_visual == NULL) {
@ -304,7 +309,7 @@ void glxGraphicsWindow::choose_visual(void)
for (i = 0; _visual == NULL && strip_properties[i] != 0; i++) { for (i = 0; _visual == NULL && strip_properties[i] != 0; i++) {
int new_mask = mask & ~strip_properties[i]; int new_mask = mask & ~strip_properties[i];
if (tried_masks.insert(new_mask).second) { if (tried_masks.insert(new_mask).second) {
_visual = try_for_visual(pipe, new_mask, want_depth_bits, _visual = try_for_visual(glx, new_mask, want_depth_bits,
want_color_bits); want_color_bits);
} }
} }
@ -319,7 +324,7 @@ void glxGraphicsWindow::choose_visual(void)
for (i = 0; _visual == NULL && strip_properties[i] != 0; i++) { for (i = 0; _visual == NULL && strip_properties[i] != 0; i++) {
int new_mask = mask & ~strip_properties[i]; int new_mask = mask & ~strip_properties[i];
if (tried_masks.insert(new_mask).second) { if (tried_masks.insert(new_mask).second) {
_visual = try_for_visual(pipe, new_mask); _visual = try_for_visual(glx, new_mask);
} }
} }
} }
@ -328,7 +333,7 @@ void glxGraphicsWindow::choose_visual(void)
if (_visual == NULL) { if (_visual == NULL) {
// Here's our last-ditch desparation attempt: give us any GLX // Here's our last-ditch desparation attempt: give us any GLX
// visual at all! // visual at all!
_visual = try_for_visual(pipe, 0); _visual = try_for_visual(glx, 0);
} }
if (_visual == NULL) { if (_visual == NULL) {
@ -384,9 +389,10 @@ void glxGraphicsWindow::config( void )
{ {
GraphicsWindow::config(); GraphicsWindow::config();
// glxGraphicsPipe* pipe = (glxGraphicsPipe *)_pipe; glxDisplay *glx = _pipe->get_glx_display();
glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe); nassertv(glx != (glxDisplay *)NULL);
_display = pipe->get_display();
_display = glx->get_display();
// Configure the framebuffer according to parameters specified in _props // Configure the framebuffer according to parameters specified in _props
// Initializes _visual // Initializes _visual
@ -408,7 +414,7 @@ void glxGraphicsWindow::config( void )
wa.event_mask = _event_mask; wa.event_mask = _event_mask;
wa.do_not_propagate_mask = 0; wa.do_not_propagate_mask = 0;
_xwindow = XCreateWindow(_display, pipe->get_root(), _xwindow = XCreateWindow(_display, glx->get_root(),
_props._xorg, _props._yorg, _props._xsize, _props._ysize, 0, _props._xorg, _props._yorg, _props._xsize, _props._ysize, 0,
_visual->depth, InputOutput, _visual->visual, attrib_mask, &wa); _visual->depth, InputOutput, _visual->visual, attrib_mask, &wa);
if (!_xwindow) { if (!_xwindow) {
@ -481,9 +487,8 @@ void glxGraphicsWindow::setup_colormap(void)
#else #else
visual_class = _visual->class; visual_class = _visual->class;
#endif #endif
glxDisplay *glx = _pipe->get_glx_display();
// glxGraphicsPipe* pipe = (glxGraphicsPipe *)_pipe; nassertv(glx != (glxDisplay *)NULL);
glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe);
switch (visual_class) { switch (visual_class) {
case PseudoColor: case PseudoColor:
@ -495,19 +500,19 @@ void glxGraphicsWindow::setup_colormap(void)
// this is a terrible terrible hack, that seems to work // this is a terrible terrible hack, that seems to work
_colormap = (Colormap)0; _colormap = (Colormap)0;
} else { } else {
_colormap = XCreateColormap(_display, pipe->get_root(), _colormap = XCreateColormap(_display, glx->get_root(),
_visual->visual, AllocAll); _visual->visual, AllocAll);
} }
break; break;
case TrueColor: case TrueColor:
case DirectColor: case DirectColor:
_colormap = XCreateColormap(_display, pipe->get_root(), _colormap = XCreateColormap(_display, glx->get_root(),
_visual->visual, AllocNone); _visual->visual, AllocNone);
break; break;
case StaticColor: case StaticColor:
case StaticGray: case StaticGray:
case GrayScale: case GrayScale:
_colormap = XCreateColormap(_display, pipe->get_root(), _colormap = XCreateColormap(_display, glx->get_root(),
_visual->visual, AllocNone); _visual->visual, AllocNone);
break; break;
default: default:
@ -1097,8 +1102,8 @@ void glxGraphicsWindow::process_events(void)
int got_event; int got_event;
glxGraphicsWindow* window; glxGraphicsWindow* window;
// glxGraphicsPipe* pipe = (glxGraphicsPipe *)_pipe; glxDisplay *glx = _pipe->get_glx_display();
glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe); nassertv(glx != (glxDisplay *)NULL);
do { do {
got_event = interruptible_xnextevent(_display, &event); got_event = interruptible_xnextevent(_display, &event);
@ -1108,7 +1113,7 @@ void glxGraphicsWindow::process_events(void)
XRefreshKeyboardMapping((XMappingEvent *) &event); XRefreshKeyboardMapping((XMappingEvent *) &event);
break; break;
case ConfigureNotify: case ConfigureNotify:
if ((window = pipe->find_window(event.xconfigure.window)) != NULL) if ((window = glx->find_window(event.xconfigure.window)) != NULL)
window->process_event(event); window->process_event(event);
break; break;
case Expose: case Expose:
@ -1124,16 +1129,16 @@ void glxGraphicsWindow::process_events(void)
break; break;
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
if ((window = pipe->find_window(event.xbutton.window)) != NULL) if ((window = glx->find_window(event.xbutton.window)) != NULL)
window->process_event(event); window->process_event(event);
break; break;
case MotionNotify: case MotionNotify:
if ((window = pipe->find_window(event.xmotion.window)) != NULL) if ((window = glx->find_window(event.xmotion.window)) != NULL)
window->process_event(event); window->process_event(event);
break; break;
case KeyPress: case KeyPress:
case KeyRelease: case KeyRelease:
if ((window = pipe->find_window(event.xmotion.window)) != NULL) if ((window = glx->find_window(event.xmotion.window)) != NULL)
window->process_event(event); window->process_event(event);
break; break;
case EnterNotify: case EnterNotify:
@ -1144,7 +1149,7 @@ void glxGraphicsWindow::process_events(void)
// Ignore "virtual" window enter/leave events // Ignore "virtual" window enter/leave events
break; break;
} }
if ((window = pipe->find_window(event.xcrossing.window)) != NULL) if ((window = glx->find_window(event.xcrossing.window)) != NULL)
window->process_event(event); window->process_event(event);
break; break;
case UnmapNotify: case UnmapNotify:

View File

@ -12,7 +12,10 @@
TypeHandle SgiGlxGraphicsPipe::_type_handle; TypeHandle SgiGlxGraphicsPipe::_type_handle;
SgiGlxGraphicsPipe::SgiGlxGraphicsPipe(const PipeSpecifier& spec) SgiGlxGraphicsPipe::SgiGlxGraphicsPipe(const PipeSpecifier& spec)
: sgiGraphicsPipe(spec) {} : sgiGraphicsPipe(spec)
glxDisplay(this, spec.get_X_specifier())
{
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -26,6 +29,17 @@ get_window_type() const {
return glxGraphicsWindow::get_class_type(); return glxGraphicsWindow::get_class_type();
} }
////////////////////////////////////////////////////////////////////
// Function: SgiGlxGraphicsPipe::get_glx_display
// Access: Public, Virtual
// Description: Returns the glxDisplay information associated with
// this pipe.
////////////////////////////////////////////////////////////////////
SgiGlxDisplay *glxGraphicsPipe::
get_glx_display() {
return this;
}
GraphicsPipe *SgiGlxGraphicsPipe:: GraphicsPipe *SgiGlxGraphicsPipe::
make_sgiglxgraphicspipe(const FactoryParams &params) { make_sgiglxgraphicspipe(const FactoryParams &params) {
GraphicsPipe::PipeSpec *pipe_param; GraphicsPipe::PipeSpec *pipe_param;
@ -42,8 +56,10 @@ TypeHandle SgiGlxGraphicsPipe::get_class_type(void) {
void SgiGlxGraphicsPipe::init_type(void) { void SgiGlxGraphicsPipe::init_type(void) {
sgiGraphicsPipe::init_type(); sgiGraphicsPipe::init_type();
glxDisplay::init_type();
register_type(_type_handle, "SgiGlxGraphicsPipe", register_type(_type_handle, "SgiGlxGraphicsPipe",
sgiGraphicsPipe::get_class_type()); sgiGraphicsPipe::get_class_type(),
glxDisplay::get_class_type());
} }
TypeHandle SgiGlxGraphicsPipe::get_type(void) const { TypeHandle SgiGlxGraphicsPipe::get_type(void) const {

View File

@ -12,7 +12,7 @@
#include <pandabase.h> #include <pandabase.h>
#include <sgiGraphicsPipe.h> #include <sgiGraphicsPipe.h>
#include <glxGraphicsWindow.h> #include <glxDisplay.h>
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : SgiGlxGraphicsPipe // Class : SgiGlxGraphicsPipe
@ -20,12 +20,12 @@
// supports the functionality of an sgi pipe with // supports the functionality of an sgi pipe with
// hardware channels // hardware channels
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class SgiGlxGraphicsPipe : public sgiGraphicsPipe class SgiGlxGraphicsPipe : public sgiGraphicsPipe, public glxDisplay {
{
public: public:
SgiGlxGraphicsPipe( const PipeSpecifier& ); SgiGlxGraphicsPipe( const PipeSpecifier& );
virtual TypeHandle get_window_type() const; virtual TypeHandle get_window_type() const;
virtual glxDisplay *get_glx_display();
static GraphicsPipe* make_sgiglxgraphicspipe(const FactoryParams &params); static GraphicsPipe* make_sgiglxgraphicspipe(const FactoryParams &params);