mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
*** empty log message ***
This commit is contained in:
parent
f069740c93
commit
77fef0c9e5
@ -231,6 +231,24 @@ get_pipe(int 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
|
||||
|
@ -27,6 +27,7 @@
|
||||
// Defines
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class GraphicsPipe;
|
||||
class glxDisplay;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : GraphicsPipe
|
||||
@ -53,6 +54,10 @@ public:
|
||||
static int get_num_pipes();
|
||||
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:
|
||||
virtual int get_num_hw_channels();
|
||||
virtual HardwareChannel *get_hw_channel(GraphicsWindow *, int);
|
||||
|
@ -10,11 +10,13 @@
|
||||
glgsg
|
||||
|
||||
#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 \
|
||||
glxGraphicsWindow.h
|
||||
|
||||
#define INSTALL_HEADERS \
|
||||
glxDisplay.I glxDisplay.h \
|
||||
glxGraphicsPipe.h glxGraphicsWindow.I glxGraphicsWindow.h
|
||||
|
||||
#end lib_target
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "config_glxdisplay.h"
|
||||
#include "glxGraphicsPipe.h"
|
||||
#include "glxGraphicsWindow.h"
|
||||
#include "glxDisplay.h"
|
||||
|
||||
#include <dconfig.h>
|
||||
|
||||
@ -19,4 +20,5 @@ ConfigureFn(config_glxdisplay) {
|
||||
glxGraphicsWindow::init_type();
|
||||
GraphicsWindow::_factory.register_factory(glxGraphicsWindow::get_class_type(),
|
||||
glxGraphicsWindow::make_GlxGraphicsWindow);
|
||||
glxDisplay::init_type();
|
||||
}
|
||||
|
57
panda/src/glxdisplay/glxDisplay.I
Normal file
57
panda/src/glxdisplay/glxDisplay.I
Normal 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;
|
||||
}
|
62
panda/src/glxdisplay/glxDisplay.cxx
Normal file
62
panda/src/glxdisplay/glxDisplay.cxx
Normal 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;
|
||||
}
|
65
panda/src/glxdisplay/glxDisplay.h
Normal file
65
panda/src/glxdisplay/glxDisplay.h
Normal 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
|
@ -17,27 +17,9 @@
|
||||
TypeHandle glxGraphicsPipe::_type_handle;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// 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::
|
||||
make_glxGraphicsPipe(const FactoryParams ¶ms) {
|
||||
GraphicsPipe::PipeSpec *pipe_param;
|
||||
@ -67,44 +60,12 @@ TypeHandle glxGraphicsPipe::get_class_type(void) {
|
||||
|
||||
void glxGraphicsPipe::init_type(void) {
|
||||
InteractiveGraphicsPipe::init_type();
|
||||
glxDisplay::init_type();
|
||||
register_type(_type_handle, "glxGraphicsPipe",
|
||||
InteractiveGraphicsPipe::get_class_type());
|
||||
InteractiveGraphicsPipe::get_class_type(),
|
||||
glxDisplay::get_class_type());
|
||||
}
|
||||
|
||||
TypeHandle glxGraphicsPipe::get_type(void) const {
|
||||
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;
|
||||
}
|
||||
|
@ -11,21 +11,16 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include <pandabase.h>
|
||||
|
||||
#include <string>
|
||||
#include <interactiveGraphicsPipe.h>
|
||||
#include "glxGraphicsWindow.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include "glxDisplay.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Defines
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class Xclass;
|
||||
#include <interactiveGraphicsPipe.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : glxGraphicsPipe
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class glxGraphicsPipe : public InteractiveGraphicsPipe
|
||||
class glxGraphicsPipe : public InteractiveGraphicsPipe, public glxDisplay
|
||||
{
|
||||
public:
|
||||
|
||||
@ -33,7 +28,7 @@ class glxGraphicsPipe : public InteractiveGraphicsPipe
|
||||
|
||||
virtual TypeHandle get_window_type() const;
|
||||
|
||||
glxGraphicsWindow* find_window(Window win);
|
||||
virtual glxDisplay *get_glx_display();
|
||||
|
||||
public:
|
||||
|
||||
@ -44,25 +39,9 @@ class glxGraphicsPipe : public InteractiveGraphicsPipe
|
||||
virtual TypeHandle get_type(void) const;
|
||||
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:
|
||||
|
||||
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
|
||||
|
@ -7,9 +7,10 @@
|
||||
// Includes
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "glxGraphicsWindow.h"
|
||||
#include "glxGraphicsPipe.h"
|
||||
#include "glxDisplay.h"
|
||||
#include "config_glxdisplay.h"
|
||||
|
||||
#include <graphicsPipe.h>
|
||||
#include <keyboardButton.h>
|
||||
#include <mouseButton.h>
|
||||
#include <glGraphicsStateGuardian.h>
|
||||
@ -82,11 +83,14 @@ bool glxGraphicsWindow::glx_supports(const char* extension)
|
||||
char* where, *terminator;
|
||||
int major, minor;
|
||||
|
||||
glxDisplay *glx = _pipe->get_glx_display();
|
||||
nassertr(glx != (glxDisplay *)NULL, false);
|
||||
|
||||
glXQueryVersion(_display, &major, &minor);
|
||||
if ((major == 1 && minor >= 1) || (major > 1)) {
|
||||
if (!_glx_extensions) {
|
||||
_glx_extensions = glXQueryExtensionsString(_display,
|
||||
((glxGraphicsPipe *)_pipe)->get_screen());
|
||||
_glx_extensions =
|
||||
glXQueryExtensionsString(_display, glx->get_screen());
|
||||
}
|
||||
start = _glx_extensions;
|
||||
for (;;) {
|
||||
@ -116,7 +120,7 @@ bool glxGraphicsWindow::glx_supports(const char* extension)
|
||||
// visual information if possible, or NULL if it is not.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
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) {
|
||||
static const int max_attrib_list = 32;
|
||||
int attrib_list[max_attrib_list];
|
||||
@ -191,7 +195,7 @@ try_for_visual(glxGraphicsPipe *pipe, int mask,
|
||||
attrib_list[n] = (int)None;
|
||||
|
||||
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 (vinfo != NULL) {
|
||||
@ -211,7 +215,8 @@ try_for_visual(glxGraphicsPipe *pipe, int mask,
|
||||
////////////////////////////////////////////////////////////////////
|
||||
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 want_depth_bits = _props._want_depth_bits;
|
||||
@ -228,7 +233,7 @@ void glxGraphicsWindow::choose_visual(void)
|
||||
}
|
||||
#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
|
||||
// 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
|
||||
// try to open a window with all of the requested options, but
|
||||
// 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) {
|
||||
@ -304,7 +309,7 @@ void glxGraphicsWindow::choose_visual(void)
|
||||
for (i = 0; _visual == NULL && strip_properties[i] != 0; i++) {
|
||||
int new_mask = mask & ~strip_properties[i];
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -319,7 +324,7 @@ void glxGraphicsWindow::choose_visual(void)
|
||||
for (i = 0; _visual == NULL && strip_properties[i] != 0; i++) {
|
||||
int new_mask = mask & ~strip_properties[i];
|
||||
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) {
|
||||
// Here's our last-ditch desparation attempt: give us any GLX
|
||||
// visual at all!
|
||||
_visual = try_for_visual(pipe, 0);
|
||||
_visual = try_for_visual(glx, 0);
|
||||
}
|
||||
|
||||
if (_visual == NULL) {
|
||||
@ -384,9 +389,10 @@ void glxGraphicsWindow::config( void )
|
||||
{
|
||||
GraphicsWindow::config();
|
||||
|
||||
// glxGraphicsPipe* pipe = (glxGraphicsPipe *)_pipe;
|
||||
glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe);
|
||||
_display = pipe->get_display();
|
||||
glxDisplay *glx = _pipe->get_glx_display();
|
||||
nassertv(glx != (glxDisplay *)NULL);
|
||||
|
||||
_display = glx->get_display();
|
||||
|
||||
// Configure the framebuffer according to parameters specified in _props
|
||||
// Initializes _visual
|
||||
@ -408,7 +414,7 @@ void glxGraphicsWindow::config( void )
|
||||
wa.event_mask = _event_mask;
|
||||
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,
|
||||
_visual->depth, InputOutput, _visual->visual, attrib_mask, &wa);
|
||||
if (!_xwindow) {
|
||||
@ -481,9 +487,8 @@ void glxGraphicsWindow::setup_colormap(void)
|
||||
#else
|
||||
visual_class = _visual->class;
|
||||
#endif
|
||||
|
||||
// glxGraphicsPipe* pipe = (glxGraphicsPipe *)_pipe;
|
||||
glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe);
|
||||
glxDisplay *glx = _pipe->get_glx_display();
|
||||
nassertv(glx != (glxDisplay *)NULL);
|
||||
|
||||
switch (visual_class) {
|
||||
case PseudoColor:
|
||||
@ -495,19 +500,19 @@ void glxGraphicsWindow::setup_colormap(void)
|
||||
// this is a terrible terrible hack, that seems to work
|
||||
_colormap = (Colormap)0;
|
||||
} else {
|
||||
_colormap = XCreateColormap(_display, pipe->get_root(),
|
||||
_colormap = XCreateColormap(_display, glx->get_root(),
|
||||
_visual->visual, AllocAll);
|
||||
}
|
||||
break;
|
||||
case TrueColor:
|
||||
case DirectColor:
|
||||
_colormap = XCreateColormap(_display, pipe->get_root(),
|
||||
_colormap = XCreateColormap(_display, glx->get_root(),
|
||||
_visual->visual, AllocNone);
|
||||
break;
|
||||
case StaticColor:
|
||||
case StaticGray:
|
||||
case GrayScale:
|
||||
_colormap = XCreateColormap(_display, pipe->get_root(),
|
||||
_colormap = XCreateColormap(_display, glx->get_root(),
|
||||
_visual->visual, AllocNone);
|
||||
break;
|
||||
default:
|
||||
@ -1097,8 +1102,8 @@ void glxGraphicsWindow::process_events(void)
|
||||
int got_event;
|
||||
glxGraphicsWindow* window;
|
||||
|
||||
// glxGraphicsPipe* pipe = (glxGraphicsPipe *)_pipe;
|
||||
glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe);
|
||||
glxDisplay *glx = _pipe->get_glx_display();
|
||||
nassertv(glx != (glxDisplay *)NULL);
|
||||
|
||||
do {
|
||||
got_event = interruptible_xnextevent(_display, &event);
|
||||
@ -1108,7 +1113,7 @@ void glxGraphicsWindow::process_events(void)
|
||||
XRefreshKeyboardMapping((XMappingEvent *) &event);
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
if ((window = pipe->find_window(event.xconfigure.window)) != NULL)
|
||||
if ((window = glx->find_window(event.xconfigure.window)) != NULL)
|
||||
window->process_event(event);
|
||||
break;
|
||||
case Expose:
|
||||
@ -1124,16 +1129,16 @@ void glxGraphicsWindow::process_events(void)
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
if ((window = pipe->find_window(event.xbutton.window)) != NULL)
|
||||
if ((window = glx->find_window(event.xbutton.window)) != NULL)
|
||||
window->process_event(event);
|
||||
break;
|
||||
case MotionNotify:
|
||||
if ((window = pipe->find_window(event.xmotion.window)) != NULL)
|
||||
if ((window = glx->find_window(event.xmotion.window)) != NULL)
|
||||
window->process_event(event);
|
||||
break;
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
if ((window = pipe->find_window(event.xmotion.window)) != NULL)
|
||||
if ((window = glx->find_window(event.xmotion.window)) != NULL)
|
||||
window->process_event(event);
|
||||
break;
|
||||
case EnterNotify:
|
||||
@ -1144,7 +1149,7 @@ void glxGraphicsWindow::process_events(void)
|
||||
// Ignore "virtual" window enter/leave events
|
||||
break;
|
||||
}
|
||||
if ((window = pipe->find_window(event.xcrossing.window)) != NULL)
|
||||
if ((window = glx->find_window(event.xcrossing.window)) != NULL)
|
||||
window->process_event(event);
|
||||
break;
|
||||
case UnmapNotify:
|
||||
|
@ -12,7 +12,10 @@
|
||||
TypeHandle SgiGlxGraphicsPipe::_type_handle;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// 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::
|
||||
make_sgiglxgraphicspipe(const FactoryParams ¶ms) {
|
||||
GraphicsPipe::PipeSpec *pipe_param;
|
||||
@ -42,8 +56,10 @@ TypeHandle SgiGlxGraphicsPipe::get_class_type(void) {
|
||||
|
||||
void SgiGlxGraphicsPipe::init_type(void) {
|
||||
sgiGraphicsPipe::init_type();
|
||||
glxDisplay::init_type();
|
||||
register_type(_type_handle, "SgiGlxGraphicsPipe",
|
||||
sgiGraphicsPipe::get_class_type());
|
||||
sgiGraphicsPipe::get_class_type(),
|
||||
glxDisplay::get_class_type());
|
||||
}
|
||||
|
||||
TypeHandle SgiGlxGraphicsPipe::get_type(void) const {
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <pandabase.h>
|
||||
|
||||
#include <sgiGraphicsPipe.h>
|
||||
#include <glxGraphicsWindow.h>
|
||||
#include <glxDisplay.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : SgiGlxGraphicsPipe
|
||||
@ -20,12 +20,12 @@
|
||||
// supports the functionality of an sgi pipe with
|
||||
// hardware channels
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class SgiGlxGraphicsPipe : public sgiGraphicsPipe
|
||||
{
|
||||
class SgiGlxGraphicsPipe : public sgiGraphicsPipe, public glxDisplay {
|
||||
public:
|
||||
SgiGlxGraphicsPipe( const PipeSpecifier& );
|
||||
|
||||
virtual TypeHandle get_window_type() const;
|
||||
virtual glxDisplay *get_glx_display();
|
||||
|
||||
static GraphicsPipe* make_sgiglxgraphicspipe(const FactoryParams ¶ms);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user