protect x11 namespace better; support building with x11 support on osx too

This commit is contained in:
David Rose 2011-08-28 23:31:28 +00:00
parent fcd08bf996
commit dcc4a33ae9
39 changed files with 400 additions and 362 deletions

View File

@ -68,6 +68,7 @@
p3dWinSplashWindow.h p3dWinSplashWindow.I \
p3dX11SplashWindow.h p3dX11SplashWindow.I \
p3dWindowParams.h p3dWindowParams.I \
plugin_get_x11.h \
run_p3dpython.h
#define COREAPI_INCLUDED_SOURCES \

View File

@ -834,14 +834,14 @@ make_window() {
_win_height = _wparams.get_win_height();
}
Window parent = 0;
X11_Window parent = 0;
// Hum, if we use the display provided by the browser,
// it causes a crash in some browsers when you make an Xlib
// call with the plugin window minimized.
// So I kept XOpenDisplay until we have a better workaround.
//_display = (Display*) _wparams.get_parent_window()._xdisplay;
//_display = (X11_Display*) _wparams.get_parent_window()._xdisplay;
//_own_display = false;
//if (_display == 0) {
_display = XOpenDisplay(NULL);

View File

@ -21,9 +21,7 @@
#include "p3dSplashWindow.h"
#include "handleStream.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "plugin_get_x11.h"
#include <vector>
@ -128,7 +126,7 @@ private:
string _label_text;
Display *_display;
X11_Display *_display;
int _screen;
GC _graphics_context;
GC _bar_context;
@ -136,7 +134,7 @@ private:
unsigned long _bg_pixel;
unsigned long _bar_pixel;
Window _window;
X11_Window _window;
};
#include "p3dX11SplashWindow.I"

View File

@ -0,0 +1,45 @@
// Filename: plugin_get_x11.h
// Created by: drose (28Aug11)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef PLUGIN_GET_X11_H
#define PLUGIN_GET_X11_H
#include "pandabase.h"
#ifdef HAVE_X11
// This header file is designed to help work around some of the
// namespace spamming that X11 causes, by renaming the symbols that
// X11 declares that are known to conflict with other library names
// (like Apple's Core Graphics, for instance).
// In order for this to work, everyone who uses X11 within Panda
// should include this file instead of including the X11 headers
// directly.
#define Display X11_Display
#define Window X11_Window
#define Cursor X11_Cursor
#define Connection X11_Connection
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#undef Display
#undef Window
#undef Cursor
#undef Connection
#endif // HAVE_X11
#endif

View File

@ -19,6 +19,7 @@
displayRegionCullCallbackData.I displayRegionCullCallbackData.h \
displayRegionDrawCallbackData.I displayRegionDrawCallbackData.h \
frameBufferProperties.I frameBufferProperties.h \
get_x11.h pre_x11_include.h post_x11_include.h \
graphicsEngine.I graphicsEngine.h \
graphicsOutput.I graphicsOutput.h \
graphicsBuffer.I graphicsBuffer.h \
@ -91,6 +92,7 @@
displayRegionDrawCallbackData.I displayRegionDrawCallbackData.h \
displaySearchParameters.h \
frameBufferProperties.I frameBufferProperties.h \
get_x11.h pre_x11_include.h post_x11_include.h \
graphicsEngine.I graphicsEngine.h \
graphicsOutput.I graphicsOutput.h \
graphicsBuffer.I graphicsBuffer.h \

View File

@ -0,0 +1,66 @@
// Filename: get_x11.h
// Created by: drose (28Aug11)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef GET_X11_H
#define GET_X11_H
#include "pandabase.h"
#ifdef HAVE_X11
// This header file is designed to help work around some of the
// namespace spamming that X11 causes, by renaming the symbols that
// X11 declares that are known to conflict with other library names
// (like Apple's Core Graphics, for instance).
// In order for this to work, everyone who uses X11 within Panda
// should include this file instead of including the X11 headers
// directly.
#ifdef CPPPARSER
// A simple hack so interrogate can get all of the necessary
// typenames.
typedef int X11_Display;
typedef int X11_Window;
typedef int X11_Cursor;
typedef int XErrorEvent;
typedef int XVisualInfo;
typedef int Atom;
typedef int XIM;
typedef int XIC;
#else
#include "pre_x11_include.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#ifdef HAVE_XRANDR
#include <X11/extensions/Xrandr.h>
#endif // HAVE_XRANDR
#ifdef HAVE_XCURSOR
#include <X11/Xcursor/Xcursor.h>
#endif
#ifdef HAVE_XF86DGA
#include <X11/extensions/xf86dga.h>
#endif
#include "post_x11_include.h"
#endif // CPPPARSER
#endif // HAVE_X11
#endif

View File

@ -58,7 +58,7 @@ get_filename() const {
// Description:
////////////////////////////////////////////////////////////////////
INLINE NativeWindowHandle::X11Handle::
X11Handle(Window handle) : _handle(handle) {
X11Handle(X11_Window handle) : _handle(handle) {
}
#endif // HAVE_X11
@ -68,7 +68,7 @@ X11Handle(Window handle) : _handle(handle) {
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE Window NativeWindowHandle::X11Handle::
INLINE X11_Window NativeWindowHandle::X11Handle::
get_handle() const {
return _handle;
}

View File

@ -65,7 +65,7 @@ make_subprocess(const Filename &filename) {
// X11 window.
////////////////////////////////////////////////////////////////////
PT(WindowHandle) NativeWindowHandle::
make_x11(Window window) {
make_x11(X11_Window window) {
return new WindowHandle(new X11Handle(window));
}
#endif // HAVE_X11

View File

@ -18,10 +18,7 @@
#include "pandabase.h"
#include "windowHandle.h"
#ifdef HAVE_X11
#include <X11/Xlib.h>
#endif
#include "get_x11.h"
#ifdef WIN32
#ifndef WIN32_LEAN_AND_MEAN
@ -51,7 +48,7 @@ PUBLISHED:
public:
#if defined(HAVE_X11) && !defined(CPPPARSER)
static PT(WindowHandle) make_x11(Window window);
static PT(WindowHandle) make_x11(X11_Window window);
#endif // HAVE_X11
#if defined(WIN32) && !defined(CPPPARSER)
@ -119,14 +116,14 @@ public:
#if defined(HAVE_X11) && !defined(CPPPARSER)
class EXPCL_PANDA_DISPLAY X11Handle : public OSHandle {
public:
INLINE X11Handle(Window handle);
INLINE X11Handle(X11_Window handle);
virtual size_t get_int_handle() const;
virtual void output(ostream &out) const;
INLINE Window get_handle() const;
INLINE X11_Window get_handle() const;
private:
Window _handle;
X11_Window _handle;
public:
static TypeHandle get_class_type() {

View File

@ -0,0 +1,21 @@
// Filename: post_x11_include.h
// Created by: drose (28Aug11)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
// To be included after including X11/*.h.
#undef Display
#undef Window
#undef Cursor
#undef Connection

View File

@ -0,0 +1,20 @@
// Filename: pre_x11_include.h
// Created by: drose (28Aug11)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
// To be included prior to including X11/*.h.
#define Display X11_Display
#define Window X11_Window
#define Cursor X11_Cursor
#define Connection X11_Connection

View File

@ -19,7 +19,7 @@
// Description: Returns a pointer to the X display associated with
// the pipe: the display on which to create the windows.
////////////////////////////////////////////////////////////////////
INLINE Display *eglGraphicsPipe::
INLINE X11_Display *eglGraphicsPipe::
get_display() const {
return _display;
}
@ -40,7 +40,7 @@ get_screen() const {
// Description: Returns the handle to the root window on the pipe's
// display.
////////////////////////////////////////////////////////////////////
INLINE Window eglGraphicsPipe::
INLINE X11_Window eglGraphicsPipe::
get_root() const {
return _root;
}
@ -63,7 +63,7 @@ get_im() const {
// Description: Returns an invisible Cursor suitable for assigning to
// windows that have the cursor_hidden property set.
////////////////////////////////////////////////////////////////////
INLINE Cursor eglGraphicsPipe::
INLINE X11_Cursor eglGraphicsPipe::
get_hidden_cursor() {
if (_hidden_cursor == None) {
make_hidden_cursor();

View File

@ -59,7 +59,7 @@ eglGraphicsPipe(const string &display) {
_supported_types = OT_window | OT_buffer | OT_texture_buffer;
_display = NULL;
_screen = 0;
_root = (Window)NULL;
_root = (X11_Window)NULL;
_im = (XIM)NULL;
_hidden_cursor = None;
_egl_display = NULL;
@ -400,7 +400,7 @@ install_error_handlers() {
// non-fatal Xlib error.
////////////////////////////////////////////////////////////////////
int eglGraphicsPipe::
error_handler(Display *display, XErrorEvent *error) {
error_handler(X11_Display *display, XErrorEvent *error) {
static const int msg_len = 80;
char msg[msg_len];
XGetErrorText(display, error->error_code, msg, msg_len);
@ -423,7 +423,7 @@ error_handler(Display *display, XErrorEvent *error) {
// fatal Xlib error.
////////////////////////////////////////////////////////////////////
int eglGraphicsPipe::
io_error_handler(Display *display) {
io_error_handler(X11_Display *display) {
egldisplay_cat.fatal()
<< "X fatal error on display " << (void *)display << "\n";

View File

@ -20,6 +20,7 @@
#include "graphicsPipe.h"
#include "lightMutex.h"
#include "lightReMutex.h"
#include "get_x11.h"
#ifdef OPENGLES_2
#include "gles2gsg.h"
@ -34,21 +35,6 @@
class FrameBufferProperties;
#ifdef CPPPARSER
// A simple hack so interrogate can parse this file.
typedef int Display;
typedef int Window;
typedef int XErrorEvent;
typedef int XVisualInfo;
typedef int Atom;
typedef int Cursor;
typedef int XIM;
typedef int XIC;
#else
#include <X11/Xlib.h>
#endif // CPPPARSER
class eglGraphicsBuffer;
class eglGraphicsPixmap;
class eglGraphicsWindow;
@ -67,12 +53,12 @@ public:
virtual string get_interface_name() const;
static PT(GraphicsPipe) pipe_constructor();
INLINE Display *get_display() const;
INLINE X11_Display *get_display() const;
INLINE int get_screen() const;
INLINE Window get_root() const;
INLINE X11_Window get_root() const;
INLINE XIM get_im() const;
INLINE Cursor get_hidden_cursor();
INLINE X11_Cursor get_hidden_cursor();
public:
virtual PreferredWindowThread get_preferred_window_thread() const;
@ -106,19 +92,19 @@ private:
void release_hidden_cursor();
static void install_error_handlers();
static int error_handler(Display *display, XErrorEvent *error);
static int io_error_handler(Display *display);
static int error_handler(X11_Display *display, XErrorEvent *error);
static int io_error_handler(X11_Display *display);
Display *_display;
X11_Display *_display;
int _screen;
Window _root;
X11_Window _root;
XIM _im;
EGLDisplay _egl_display;
Cursor _hidden_cursor;
X11_Cursor _hidden_cursor;
typedef int ErrorHandlerFunc(Display *, XErrorEvent *);
typedef int IOErrorHandlerFunc(Display *);
typedef int ErrorHandlerFunc(X11_Display *, XErrorEvent *);
typedef int IOErrorHandlerFunc(X11_Display *);
static bool _error_handlers_installed;
static ErrorHandlerFunc *_prev_error_handler;
static IOErrorHandlerFunc *_prev_io_error_handler;

View File

@ -46,8 +46,8 @@ protected:
virtual bool open_buffer();
private:
Display *_display;
Window _drawable;
X11_Display *_display;
X11_Window _drawable;
Pixmap _x_pixmap;
EGLSurface _egl_surface;
EGLDisplay _egl_display;

View File

@ -143,7 +143,7 @@ get_properties(FrameBufferProperties &properties,
////////////////////////////////////////////////////////////////////
void eglGraphicsStateGuardian::
choose_pixel_format(const FrameBufferProperties &properties,
Display *display,
X11_Display *display,
int screen, bool need_pbuffer, bool need_pixmap) {
_display = display;

View File

@ -17,8 +17,7 @@
#include "pandabase.h"
#include "eglGraphicsPipe.h"
#include <X11/Xutil.h>
#include "get_x11.h"
////////////////////////////////////////////////////////////////////
// Class : eglGraphicsStateGuardian
@ -36,7 +35,7 @@ public:
bool &pbuffer_supported, bool &pixmap_supported,
bool &slow, EGLConfig config);
void choose_pixel_format(const FrameBufferProperties &properties,
Display *_display,
X11_Display *_display,
int _screen,
bool need_pbuffer, bool need_pixmap);
@ -52,7 +51,7 @@ public:
EGLContext _share_context;
EGLContext _context;
EGLDisplay _egl_display;
Display *_display;
X11_Display *_display;
int _screen;
XVisualInfo *_visual;
XVisualInfo *_visuals;

View File

@ -18,7 +18,7 @@
// Access: Public
// Description: Returns the X11 Window handle.
////////////////////////////////////////////////////////////////////
INLINE Window eglGraphicsWindow::
INLINE X11_Window eglGraphicsWindow::
get_xwindow() const {
return _xwindow;
}

View File

@ -26,12 +26,10 @@
#include "throw_event.h"
#include "lightReMutexHolder.h"
#include "nativeWindowHandle.h"
#include "get_x11.h"
#include <errno.h>
#include <sys/time.h>
#include <X11/keysym.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#ifdef HAVE_LINUX_INPUT_H
#include <linux/input.h>
@ -60,7 +58,7 @@ eglGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
DCAST_INTO_V(egl_pipe, _pipe);
_display = egl_pipe->get_display();
_screen = egl_pipe->get_screen();
_xwindow = (Window)NULL;
_xwindow = (X11_Window)NULL;
_ic = (XIC)NULL;
_egl_display = egl_pipe->_egl_display;
_egl_surface = 0;
@ -261,7 +259,7 @@ process_events() {
GraphicsWindow::process_events();
if (_xwindow == (Window)0) {
if (_xwindow == (X11_Window)0) {
return;
}
@ -608,9 +606,9 @@ close_window() {
}
}
if (_xwindow != (Window)NULL) {
if (_xwindow != (X11_Window)NULL) {
XDestroyWindow(_display, _xwindow);
_xwindow = (Window)NULL;
_xwindow = (X11_Window)NULL;
// This may be necessary if we just closed the last X window in an
// application, so the server hears the close request.
@ -666,7 +664,7 @@ open_window() {
_properties.set_size(100, 100);
}
Window parent_window = egl_pipe->get_root();
X11_Window parent_window = egl_pipe->get_root();
WindowHandle *window_handle = _properties.get_parent_window();
if (window_handle != NULL) {
egldisplay_cat.info()
@ -681,7 +679,7 @@ open_window() {
parent_window = x11_handle->get_handle();
} else if (os_handle->is_of_type(NativeWindowHandle::IntHandle::get_class_type())) {
NativeWindowHandle::IntHandle *int_handle = DCAST(NativeWindowHandle::IntHandle, os_handle);
parent_window = (Window)int_handle->get_handle();
parent_window = (X11_Window)int_handle->get_handle();
}
}
}
@ -713,7 +711,7 @@ open_window() {
_properties.get_x_size(), _properties.get_y_size(),
0, depth, InputOutput, visual, attrib_mask, &wa);
if (_xwindow == (Window)0) {
if (_xwindow == (X11_Window)0) {
egldisplay_cat.error()
<< "failed to create X window.\n";
return false;
@ -1000,7 +998,7 @@ void eglGraphicsWindow::
setup_colormap(XVisualInfo *visual) {
eglGraphicsPipe *egl_pipe;
DCAST_INTO_V(egl_pipe, _pipe);
Window root_window = egl_pipe->get_root();
X11_Window root_window = egl_pipe->get_root();
int visual_class = visual->c_class;
int rc, is_rgb;
@ -1699,7 +1697,7 @@ get_mouse_button(XButtonEvent &button_event) {
// window.
////////////////////////////////////////////////////////////////////
Bool eglGraphicsWindow::
check_event(Display *display, XEvent *event, char *arg) {
check_event(X11_Display *display, XEvent *event, char *arg) {
const eglGraphicsWindow *self = (eglGraphicsWindow *)arg;
// We accept any event that is sent to our window.

View File

@ -20,8 +20,7 @@
#include "eglGraphicsPipe.h"
#include "graphicsWindow.h"
#include "buttonHandle.h"
#include <X11/Xutil.h>
#include "get_x11.h"
////////////////////////////////////////////////////////////////////
// Class : eglGraphicsWindow
@ -47,7 +46,7 @@ public:
virtual void process_events();
virtual void set_properties_now(WindowProperties &properties);
INLINE Window get_xwindow() const;
INLINE X11_Window get_xwindow() const;
protected:
virtual void close_window();
@ -66,15 +65,15 @@ private:
ButtonHandle map_button(KeySym key);
ButtonHandle get_mouse_button(XButtonEvent &button_event);
static Bool check_event(Display *display, XEvent *event, char *arg);
static Bool check_event(X11_Display *display, XEvent *event, char *arg);
void open_raw_mice();
void poll_raw_mice();
private:
Display *_display;
X11_Display *_display;
int _screen;
Window _xwindow;
X11_Window _xwindow;
Colormap _colormap;
XIC _ic;
EGLDisplay _egl_display;

View File

@ -559,7 +559,7 @@ reset() {
if (is_at_least_gl_version(1, 2)) {
_supports_3d_texture = true;
_glTexImage3D = (PFNGLTEXIMAGE3DPROC)
_glTexImage3D = (PFNGLTEXIMAGE3DPROC_P)
get_extension_func(GLPREFIX_QUOTED, "TexImage3D");
_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)
get_extension_func(GLPREFIX_QUOTED, "TexSubImage3D");
@ -567,14 +567,14 @@ reset() {
} else if (has_extension("GL_EXT_texture3D")) {
_supports_3d_texture = true;
_glTexImage3D = (PFNGLTEXIMAGE3DPROC)
_glTexImage3D = (PFNGLTEXIMAGE3DPROC_P)
get_extension_func(GLPREFIX_QUOTED, "TexImage3DEXT");
_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)
get_extension_func(GLPREFIX_QUOTED, "TexSubImage3DEXT");
} else if (has_extension("GL_OES_texture3D") || has_extension("GL_OES_texture_3D")) {
_supports_3d_texture = true;
_glTexImage3D = (PFNGLTEXIMAGE3DPROC)
_glTexImage3D = (PFNGLTEXIMAGE3DPROC_P)
get_extension_func(GLPREFIX_QUOTED, "TexImage3DOES");
_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)
get_extension_func(GLPREFIX_QUOTED, "TexSubImage3DOES");

View File

@ -56,7 +56,8 @@ typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint
typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
// There is some trivial disagreement between different gl.h headers about this one, so we use our own typename.
typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC_P) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, const GLfloat s);
@ -518,7 +519,7 @@ public:
bool _supports_draw_range_elements;
PFNGLDRAWRANGEELEMENTSPROC _glDrawRangeElements;
PFNGLTEXIMAGE3DPROC _glTexImage3D;
PFNGLTEXIMAGE3DPROC_P _glTexImage3D;
PFNGLTEXSUBIMAGE3DPROC _glTexSubImage3D;
PFNGLCOMPRESSEDTEXIMAGE1DPROC _glCompressedTexImage1D;

View File

@ -15,7 +15,7 @@
#define SOURCES \
config_glxdisplay.cxx config_glxdisplay.h \
glxGraphicsBuffer.h glxGraphicsBuffer.I glxGraphicsBuffer.cxx \
glxGraphicsPipe.cxx glxGraphicsPipe.h \
glxGraphicsPipe.cxx glxGraphicsPipe.h glxGraphicsPipe.I \
glxGraphicsPixmap.h glxGraphicsPixmap.I glxGraphicsPixmap.cxx \
glxGraphicsWindow.h glxGraphicsWindow.cxx \
glxGraphicsStateGuardian.h glxGraphicsStateGuardian.I \
@ -24,7 +24,8 @@
#define INSTALL_HEADERS \
glxGraphicsBuffer.I glxGraphicsBuffer.h \
glxGraphicsPipe.h glxGraphicsWindow.h
glxGraphicsPipe.h glxGraphicsPipe.I \
glxGraphicsWindow.h
#end lib_target

View File

@ -44,7 +44,7 @@ protected:
virtual bool open_buffer();
private:
Display *_display;
X11_Display *_display;
GLXPbuffer _pbuffer;
public:

View File

@ -12,61 +12,3 @@
//
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: glxGraphicsPipe::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 *glxGraphicsPipe::
get_display() const {
return _display;
}
////////////////////////////////////////////////////////////////////
// Function: glxGraphicsPipe::get_screen
// Access: Public
// Description: Returns the X screen number associated with the pipe.
////////////////////////////////////////////////////////////////////
INLINE int glxGraphicsPipe::
get_screen() const {
return _screen;
}
////////////////////////////////////////////////////////////////////
// Function: glxGraphicsPipe::get_root
// Access: Public
// Description: Returns the handle to the root window on the pipe's
// display.
////////////////////////////////////////////////////////////////////
INLINE Window glxGraphicsPipe::
get_root() const {
return _root;
}
////////////////////////////////////////////////////////////////////
// Function: glxGraphicsPipe::get_im
// Access: Public
// Description: Returns the input method opened for the pipe, or NULL
// if the input method could not be opened for some
// reason.
////////////////////////////////////////////////////////////////////
INLINE XIM glxGraphicsPipe::
get_im() const {
return _im;
}
////////////////////////////////////////////////////////////////////
// Function: glxGraphicsPipe::get_hidden_cursor
// Access: Public
// Description: Returns an invisible Cursor suitable for assigning to
// windows that have the cursor_hidden property set.
////////////////////////////////////////////////////////////////////
INLINE Cursor glxGraphicsPipe::
get_hidden_cursor() {
if (_hidden_cursor == None) {
make_hidden_cursor();
}
return _hidden_cursor;
}

View File

@ -30,16 +30,9 @@ class FrameBufferProperties;
// Don't pick up the system glxext.h; use our own, which is better.
#define __glxext_h_
#include "pre_x11_include.h"
#include <GL/glx.h>
/*
#if defined(GLX_VERSION_1_3)
// If the system glx version is at least 1.3, then we know we have
// GLXFBConfig and GLXPbuffer.
#define HAVE_GLXFBCONFIG
#define HAVE_OFFICIAL_GLXFBCONFIG
#endif
*/
#include "post_x11_include.h"
// This must be included after we have included glgsg.h (which
// includes gl.h), and after we have checked GLX_VERSION_1_3. But we
@ -121,4 +114,6 @@ private:
static TypeHandle _type_handle;
};
#include "glxGraphicsPipe.I"
#endif

View File

@ -47,8 +47,8 @@ protected:
virtual bool open_buffer();
private:
Display *_display;
Window _drawable;
X11_Display *_display;
X11_Window _drawable;
Pixmap _x_pixmap;
GLXPixmap _glx_pixmap;

View File

@ -57,7 +57,7 @@ glxGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
_checked_get_proc_address = false;
_glXGetProcAddress = NULL;
_temp_context = (GLXContext)NULL;
_temp_xwindow = (Window)NULL;
_temp_xwindow = (X11_Window)NULL;
_temp_colormap = (Colormap)NULL;
}
@ -231,7 +231,7 @@ get_properties_advanced(FrameBufferProperties &properties,
////////////////////////////////////////////////////////////////////
void glxGraphicsStateGuardian::
choose_pixel_format(const FrameBufferProperties &properties,
Display *display,
X11_Display *display,
int screen, bool need_pbuffer, bool need_pixmap) {
_display = display;
@ -825,7 +825,7 @@ void glxGraphicsStateGuardian::
init_temp_context() {
x11GraphicsPipe *x11_pipe;
DCAST_INTO_V(x11_pipe, get_pipe());
Window root_window = x11_pipe->get_root();
X11_Window root_window = x11_pipe->get_root();
// Assume everyone uses TrueColor or DirectColor these days.
Visual *visual = _visual->visual;
@ -840,7 +840,7 @@ init_temp_context() {
(_display, root_window, 0, 0, 100, 100,
0, _visual->depth, InputOutput,
visual, attrib_mask, &wa);
if (_temp_xwindow == (Window)NULL) {
if (_temp_xwindow == (X11_Window)NULL) {
glxdisplay_cat.error()
<< "Could not create temporary window for context\n";
return;
@ -864,9 +864,9 @@ destroy_temp_xwindow() {
XFreeColormap(_display, _temp_colormap);
_temp_colormap = (Colormap)NULL;
}
if (_temp_xwindow != (Window)NULL) {
if (_temp_xwindow != (X11_Window)NULL) {
XDestroyWindow(_display, _temp_xwindow);
_temp_xwindow = (Window)NULL;
_temp_xwindow = (X11_Window)NULL;
}
if (_temp_context != (GLXContext)NULL){

View File

@ -20,11 +20,6 @@
#include "glgsg.h"
#include "glxGraphicsPipe.h"
// Don't pick up the system glxext.h; use our own, which is better.
#define __glxext_h_
#include <GL/glx.h>
#if defined(GLX_VERSION_1_4)
// If the system header files give us version 1.4, we can assume it's
// safe to compile in a reference to glxGetProcAddress().
@ -64,13 +59,13 @@ extern "C" void (*glXGetProcAddressARB(const GLubyte *procName))( void );
typedef __GLXextFuncPtr (* PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
typedef int (* PFNGLXSWAPINTERVALSGIPROC) (int interval);
typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
typedef void (* PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (X11_Display *dpy, int screen, const int *attrib_list, int *nelements);
typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (X11_Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (X11_Display *dpy, GLXFBConfig config);
typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (X11_Display *dpy, GLXFBConfig config, int attribute, int *value);
typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (X11_Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (X11_Display *dpy, GLXFBConfig config, const int *attrib_list);
typedef void (* PFNGLXDESTROYPBUFFERPROC) (X11_Display *dpy, GLXPbuffer pbuf);
#endif // __EDG__
@ -87,7 +82,7 @@ public:
bool &context_has_pbuffer, bool &pixmap_supported,
bool &slow, GLXFBConfig config);
void choose_pixel_format(const FrameBufferProperties &properties,
Display *_display,
X11_Display *_display,
int _screen,
bool need_pbuffer, bool need_pixmap);
@ -102,7 +97,7 @@ public:
GLXContext _share_context;
GLXContext _context;
Display *_display;
X11_Display *_display;
int _screen;
XVisualInfo *_visual;
XVisualInfo *_visuals;
@ -153,7 +148,7 @@ private:
PFNGLXGETPROCADDRESSPROC _glXGetProcAddress;
GLXContext _temp_context;
Window _temp_xwindow;
X11_Window _temp_xwindow;
Colormap _temp_colormap;
public:

View File

@ -18,7 +18,7 @@
// Access: Public
// Description: Returns the X11 Window handle.
////////////////////////////////////////////////////////////////////
INLINE Window glxGraphicsWindow::
INLINE X11_Window glxGraphicsWindow::
get_xwindow() const {
return _xwindow;
}

View File

@ -244,7 +244,7 @@ setup_colormap(GLXFBConfig fbconfig) {
glxGraphicsPipe *glx_pipe;
DCAST_INTO_V(glx_pipe, _pipe);
Window root_window = glx_pipe->get_root();
X11_Window root_window = glx_pipe->get_root();
int rc, is_rgb;
@ -291,7 +291,7 @@ void glxGraphicsWindow::
setup_colormap(XVisualInfo *visual) {
glxGraphicsPipe *glx_pipe;
DCAST_INTO_V(glx_pipe, _pipe);
Window root_window = glx_pipe->get_root();
X11_Window root_window = glx_pipe->get_root();
int visual_class = visual->c_class;
int rc, is_rgb;

View File

@ -324,7 +324,7 @@ typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came for SendEvent request */
Display *display; /* display the event was read from */
X11_Display *display; /* display the event was read from */
GLXDrawable drawable; /* i.d. of Drawable */
int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */
int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */
@ -345,45 +345,45 @@ typedef XID GLXPbuffer;
typedef XID GLXWindow;
#ifdef GLX_GLXEXT_PROTOTYPES
extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *);
extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *);
extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *);
extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig);
extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *);
extern void glXDestroyWindow (Display *, GLXWindow);
extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *);
extern void glXDestroyPixmap (Display *, GLXPixmap);
extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *);
extern void glXDestroyPbuffer (Display *, GLXPbuffer);
extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *);
extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool);
extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext);
extern GLXFBConfig * glXGetFBConfigs (X11_Display *, int, int *);
extern GLXFBConfig * glXChooseFBConfig (X11_Display *, int, const int *, int *);
extern int glXGetFBConfigAttrib (X11_Display *, GLXFBConfig, int, int *);
extern XVisualInfo * glXGetVisualFromFBConfig (X11_Display *, GLXFBConfig);
extern GLXWindow glXCreateWindow (X11_Display *, GLXFBConfig, X11_Window, const int *);
extern void glXDestroyWindow (X11_Display *, GLXWindow);
extern GLXPixmap glXCreatePixmap (X11_Display *, GLXFBConfig, Pixmap, const int *);
extern void glXDestroyPixmap (X11_Display *, GLXPixmap);
extern GLXPbuffer glXCreatePbuffer (X11_Display *, GLXFBConfig, const int *);
extern void glXDestroyPbuffer (X11_Display *, GLXPbuffer);
extern void glXQueryDrawable (X11_Display *, GLXDrawable, int, unsigned int *);
extern GLXContext glXCreateNewContext (X11_Display *, GLXFBConfig, int, GLXContext, Bool);
extern Bool glXMakeContextCurrent (X11_Display *, GLXDrawable, GLXDrawable, GLXContext);
extern GLXDrawable glXGetCurrentReadDrawable ();
extern Display * glXGetCurrentDisplay ();
extern int glXQueryContext (Display *, GLXContext, int, int *);
extern void glXSelectEvent (Display *, GLXDrawable, unsigned long);
extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *);
extern X11_Display * glXGetCurrentDisplay ();
extern int glXQueryContext (X11_Display *, GLXContext, int, int *);
extern void glXSelectEvent (X11_Display *, GLXDrawable, unsigned long);
extern void glXGetSelectedEvent (X11_Display *, GLXDrawable, unsigned long *);
#endif /* GLX_GLXEXT_PROTOTYPES */
/* drose: all of the following PFN... typedefs seemed to be
incorrect. I put a * just inside the leading parenthesis. */
typedef GLXFBConfig * (* PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
typedef GLXWindow (* PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
typedef void (* PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
typedef void (* PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
typedef void (* PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
typedef void (* PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
typedef Bool (* PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
typedef GLXFBConfig * (* PFNGLXGETFBCONFIGSPROC) (X11_Display *dpy, int screen, int *nelements);
typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (X11_Display *dpy, int screen, const int *attrib_list, int *nelements);
typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (X11_Display *dpy, GLXFBConfig config, int attribute, int *value);
typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (X11_Display *dpy, GLXFBConfig config);
typedef GLXWindow (* PFNGLXCREATEWINDOWPROC) (X11_Display *dpy, GLXFBConfig config, X11_Window win, const int *attrib_list);
typedef void (* PFNGLXDESTROYWINDOWPROC) (X11_Display *dpy, GLXWindow win);
typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (X11_Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
typedef void (* PFNGLXDESTROYPIXMAPPROC) (X11_Display *dpy, GLXPixmap pixmap);
typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (X11_Display *dpy, GLXFBConfig config, const int *attrib_list);
typedef void (* PFNGLXDESTROYPBUFFERPROC) (X11_Display *dpy, GLXPbuffer pbuf);
typedef void (* PFNGLXQUERYDRAWABLEPROC) (X11_Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (X11_Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
typedef Bool (* PFNGLXMAKECONTEXTCURRENTPROC) (X11_Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
typedef GLXDrawable (* PFNGLXGETCURRENTREADDRAWABLEPROC) ();
typedef Display * (* PFNGLXGETCURRENTDISPLAYPROC) ();
typedef int (* PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
typedef void (* PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
typedef void (* PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
typedef X11_Display * (* PFNGLXGETCURRENTDISPLAYPROC) ();
typedef int (* PFNGLXQUERYCONTEXTPROC) (X11_Display *dpy, GLXContext ctx, int attribute, int *value);
typedef void (* PFNGLXSELECTEVENTPROC) (X11_Display *dpy, GLXDrawable draw, unsigned long event_mask);
typedef void (* PFNGLXGETSELECTEDEVENTPROC) (X11_Display *dpy, GLXDrawable draw, unsigned long *event_mask);
#endif
#ifndef GLX_VERSION_1_4
@ -435,10 +435,10 @@ typedef int (* PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned
#ifndef GLX_SGI_make_current_read
#define GLX_SGI_make_current_read 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext);
extern Bool glXMakeCurrentReadSGI (X11_Display *, GLXDrawable, GLXDrawable, GLXContext);
extern GLXDrawable glXGetCurrentReadDrawableSGI ();
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef Bool (* PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
typedef Bool (* PFNGLXMAKECURRENTREADSGIPROC) (X11_Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
typedef GLXDrawable (* PFNGLXGETCURRENTREADDRAWABLESGIPROC) ();
#endif
@ -446,11 +446,11 @@ typedef GLXDrawable (* PFNGLXGETCURRENTREADDRAWABLESGIPROC) ();
#define GLX_SGIX_video_source 1
#ifdef _VL_H
#ifdef GLX_GLXEXT_PROTOTYPES
extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode);
extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX);
extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (X11_Display *, int, VLServer, VLPath, int, VLNode);
extern void glXDestroyGLXVideoSourceSGIX (X11_Display *, GLXVideoSourceSGIX);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef GLXVideoSourceSGIX (* PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
typedef void (* PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource);
typedef GLXVideoSourceSGIX (* PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (X11_Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
typedef void (* PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (X11_Display *dpy, GLXVideoSourceSGIX glxvideosource);
#endif
#endif /* _VL_H */
@ -461,135 +461,135 @@ typedef void (* PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSour
#ifndef GLX_EXT_import_context
#define GLX_EXT_import_context 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern Display * glXGetCurrentDisplayEXT ();
extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *);
extern X11_Display * glXGetCurrentDisplayEXT ();
extern int glXQueryContextInfoEXT (X11_Display *, GLXContext, int, int *);
extern GLXContextID glXGetContextIDEXT (const GLXContext);
extern GLXContext glXImportContextEXT (Display *, GLXContextID);
extern void glXFreeContextEXT (Display *, GLXContext);
extern GLXContext glXImportContextEXT (X11_Display *, GLXContextID);
extern void glXFreeContextEXT (X11_Display *, GLXContext);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef Display * (* PFNGLXGETCURRENTDISPLAYEXTPROC) ();
typedef int (* PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value);
typedef X11_Display * (* PFNGLXGETCURRENTDISPLAYEXTPROC) ();
typedef int (* PFNGLXQUERYCONTEXTINFOEXTPROC) (X11_Display *dpy, GLXContext context, int attribute, int *value);
typedef GLXContextID (* PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);
typedef GLXContext (* PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID);
typedef void (* PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context);
typedef GLXContext (* PFNGLXIMPORTCONTEXTEXTPROC) (X11_Display *dpy, GLXContextID contextID);
typedef void (* PFNGLXFREECONTEXTEXTPROC) (X11_Display *dpy, GLXContext context);
#endif
#ifndef GLX_SGIX_fbconfig
#define GLX_SGIX_fbconfig 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *);
extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *);
extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap);
extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool);
extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX);
extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *);
extern int glXGetFBConfigAttribSGIX (X11_Display *, GLXFBConfigSGIX, int, int *);
extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (X11_Display *, int, int *, int *);
extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (X11_Display *, GLXFBConfigSGIX, Pixmap);
extern GLXContext glXCreateContextWithConfigSGIX (X11_Display *, GLXFBConfigSGIX, int, GLXContext, Bool);
extern XVisualInfo * glXGetVisualFromFBConfigSGIX (X11_Display *, GLXFBConfigSGIX);
extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (X11_Display *, XVisualInfo *);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef int (* PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
typedef GLXFBConfigSGIX * (* PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements);
typedef GLXPixmap (* PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
typedef GLXContext (* PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config);
typedef GLXFBConfigSGIX (* PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis);
typedef int (* PFNGLXGETFBCONFIGATTRIBSGIXPROC) (X11_Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
typedef GLXFBConfigSGIX * (* PFNGLXCHOOSEFBCONFIGSGIXPROC) (X11_Display *dpy, int screen, int *attrib_list, int *nelements);
typedef GLXPixmap (* PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (X11_Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
typedef GLXContext (* PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (X11_Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (X11_Display *dpy, GLXFBConfigSGIX config);
typedef GLXFBConfigSGIX (* PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (X11_Display *dpy, XVisualInfo *vis);
#endif
#ifndef GLX_SGIX_pbuffer
#define GLX_SGIX_pbuffer 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *);
extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX);
extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *);
extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long);
extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *);
extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (X11_Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *);
extern void glXDestroyGLXPbufferSGIX (X11_Display *, GLXPbufferSGIX);
extern int glXQueryGLXPbufferSGIX (X11_Display *, GLXPbufferSGIX, int, unsigned int *);
extern void glXSelectEventSGIX (X11_Display *, GLXDrawable, unsigned long);
extern void glXGetSelectedEventSGIX (X11_Display *, GLXDrawable, unsigned long *);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef GLXPbufferSGIX (* PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
typedef void (* PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf);
typedef int (* PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
typedef void (* PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask);
typedef void (* PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask);
typedef GLXPbufferSGIX (* PFNGLXCREATEGLXPBUFFERSGIXPROC) (X11_Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
typedef void (* PFNGLXDESTROYGLXPBUFFERSGIXPROC) (X11_Display *dpy, GLXPbufferSGIX pbuf);
typedef int (* PFNGLXQUERYGLXPBUFFERSGIXPROC) (X11_Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
typedef void (* PFNGLXSELECTEVENTSGIXPROC) (X11_Display *dpy, GLXDrawable drawable, unsigned long mask);
typedef void (* PFNGLXGETSELECTEDEVENTSGIXPROC) (X11_Display *dpy, GLXDrawable drawable, unsigned long *mask);
#endif
#ifndef GLX_SGI_cushion
#define GLX_SGI_cushion 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern void glXCushionSGI (Display *, Window, float);
extern void glXCushionSGI (X11_Display *, X11_Window, float);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef void (* PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion);
typedef void (* PFNGLXCUSHIONSGIPROC) (X11_Display *dpy, X11_Window window, float cushion);
#endif
#ifndef GLX_SGIX_video_resize
#define GLX_SGIX_video_resize 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern int glXBindChannelToWindowSGIX (Display *, int, int, Window);
extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int);
extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *);
extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *);
extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum);
extern int glXBindChannelToWindowSGIX (X11_Display *, int, int, X11_Window);
extern int glXChannelRectSGIX (X11_Display *, int, int, int, int, int, int);
extern int glXQueryChannelRectSGIX (X11_Display *, int, int, int *, int *, int *, int *);
extern int glXQueryChannelDeltasSGIX (X11_Display *, int, int, int *, int *, int *, int *);
extern int glXChannelRectSyncSGIX (X11_Display *, int, int, GLenum);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef int (* PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window);
typedef int (* PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h);
typedef int (* PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
typedef int (* PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
typedef int (* PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype);
typedef int (* PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (X11_Display *display, int screen, int channel, X11_Window window);
typedef int (* PFNGLXCHANNELRECTSGIXPROC) (X11_Display *display, int screen, int channel, int x, int y, int w, int h);
typedef int (* PFNGLXQUERYCHANNELRECTSGIXPROC) (X11_Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
typedef int (* PFNGLXQUERYCHANNELDELTASSGIXPROC) (X11_Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
typedef int (* PFNGLXCHANNELRECTSYNCSGIXPROC) (X11_Display *display, int screen, int channel, GLenum synctype);
#endif
#ifndef GLX_SGIX_dmbuffer
#define GLX_SGIX_dmbuffer 1
#ifdef _DM_BUFFER_H_
#ifdef GLX_GLXEXT_PROTOTYPES
extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer);
extern Bool glXAssociateDMPbufferSGIX (X11_Display *, GLXPbufferSGIX, DMparams *, DMbuffer);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef Bool (* PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
typedef Bool (* PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (X11_Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
#endif
#endif /* _DM_BUFFER_H_ */
#ifndef GLX_SGIX_swap_group
#define GLX_SGIX_swap_group 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable);
extern void glXJoinSwapGroupSGIX (X11_Display *, GLXDrawable, GLXDrawable);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef void (* PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);
typedef void (* PFNGLXJOINSWAPGROUPSGIXPROC) (X11_Display *dpy, GLXDrawable drawable, GLXDrawable member);
#endif
#ifndef GLX_SGIX_swap_barrier
#define GLX_SGIX_swap_barrier 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int);
extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *);
extern void glXBindSwapBarrierSGIX (X11_Display *, GLXDrawable, int);
extern Bool glXQueryMaxSwapBarriersSGIX (X11_Display *, int, int *);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef void (* PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);
typedef Bool (* PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);
typedef void (* PFNGLXBINDSWAPBARRIERSGIXPROC) (X11_Display *dpy, GLXDrawable drawable, int barrier);
typedef Bool (* PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (X11_Display *dpy, int screen, int *max);
#endif
#ifndef GLX_SUN_get_transparent_index
#define GLX_SUN_get_transparent_index 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *);
extern Status glXGetTransparentIndexSUN (X11_Display *, X11_Window, X11_Window, long *);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef Status (* PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
typedef Status (* PFNGLXGETTRANSPARENTINDEXSUNPROC) (X11_Display *dpy, X11_Window overlay, X11_Window underlay, long *pTransparentIndex);
#endif
#ifndef GLX_MESA_copy_sub_buffer
#define GLX_MESA_copy_sub_buffer 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int);
extern void glXCopySubBufferMESA (X11_Display *, GLXDrawable, int, int, int, int);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef void (* PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
typedef void (* PFNGLXCOPYSUBBUFFERMESAPROC) (X11_Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
#endif
#ifndef GLX_MESA_pixmap_colormap
#define GLX_MESA_pixmap_colormap 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap);
extern GLXPixmap glXCreateGLXPixmapMESA (X11_Display *, XVisualInfo *, Pixmap, Colormap);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef GLXPixmap (* PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
typedef GLXPixmap (* PFNGLXCREATEGLXPIXMAPMESAPROC) (X11_Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
#endif
#ifndef GLX_MESA_release_buffers
#define GLX_MESA_release_buffers 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable);
extern Bool glXReleaseBuffersMESA (X11_Display *, GLXDrawable);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef Bool (* PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable);
typedef Bool (* PFNGLXRELEASEBUFFERSMESAPROC) (X11_Display *dpy, GLXDrawable drawable);
#endif
#ifndef GLX_MESA_set_3dfx_mode
@ -616,17 +616,17 @@ typedef Bool (* PFNGLXSET3DFXMODEMESAPROC) (int mode);
#include <inttypes.h>
#ifdef GLX_GLXEXT_PROTOTYPES
extern Bool glXGetSyncValuesOML (Display *, GLXDrawable, int64_t *, int64_t *, int64_t *);
extern Bool glXGetMscRateOML (Display *, GLXDrawable, int32_t *, int32_t *);
extern int64_t glXSwapBuffersMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t);
extern Bool glXWaitForMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t, int64_t *, int64_t *, int64_t *);
extern Bool glXWaitForSbcOML (Display *, GLXDrawable, int64_t, int64_t *, int64_t *, int64_t *);
extern Bool glXGetSyncValuesOML (X11_Display *, GLXDrawable, int64_t *, int64_t *, int64_t *);
extern Bool glXGetMscRateOML (X11_Display *, GLXDrawable, int32_t *, int32_t *);
extern int64_t glXSwapBuffersMscOML (X11_Display *, GLXDrawable, int64_t, int64_t, int64_t);
extern Bool glXWaitForMscOML (X11_Display *, GLXDrawable, int64_t, int64_t, int64_t, int64_t *, int64_t *, int64_t *);
extern Bool glXWaitForSbcOML (X11_Display *, GLXDrawable, int64_t, int64_t *, int64_t *, int64_t *);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef Bool (* PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
typedef Bool (* PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
typedef int64_t (* PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
typedef Bool (* PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
typedef Bool (* PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
typedef Bool (* PFNGLXGETSYNCVALUESOMLPROC) (X11_Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
typedef Bool (* PFNGLXGETMSCRATEOMLPROC) (X11_Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
typedef int64_t (* PFNGLXSWAPBUFFERSMSCOMLPROC) (X11_Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
typedef Bool (* PFNGLXWAITFORMSCOMLPROC) (X11_Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
typedef Bool (* PFNGLXWAITFORSBCOMLPROC) (X11_Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
#endif
#endif /* C99 version test */

View File

@ -86,7 +86,7 @@ bool TinyXGraphicsWindow::
begin_frame(FrameMode mode, Thread *current_thread) {
PStatTimer timer(_make_current_pcollector, current_thread);
if (_xwindow == (Window)NULL) {
if (_xwindow == (X11_Window)NULL) {
return false;
}
@ -158,7 +158,7 @@ end_frame(FrameMode mode, Thread *current_thread) {
////////////////////////////////////////////////////////////////////
void TinyXGraphicsWindow::
begin_flip() {
if (_xwindow == (Window)NULL) {
if (_xwindow == (X11_Window)NULL) {
return;
}
@ -217,7 +217,7 @@ process_events() {
GraphicsWindow::process_events();
if (_xwindow == (Window)0) {
if (_xwindow == (X11_Window)0) {
return;
}

View File

@ -19,7 +19,7 @@
// Description: Returns a pointer to the X display associated with
// the pipe: the display on which to create the windows.
////////////////////////////////////////////////////////////////////
INLINE Display *x11GraphicsPipe::
INLINE X11_Display *x11GraphicsPipe::
get_display() const {
return _display;
}
@ -40,7 +40,7 @@ get_screen() const {
// Description: Returns the handle to the root window on the pipe's
// display.
////////////////////////////////////////////////////////////////////
INLINE Window x11GraphicsPipe::
INLINE X11_Window x11GraphicsPipe::
get_root() const {
return _root;
}
@ -63,7 +63,7 @@ get_im() const {
// Description: Returns an invisible Cursor suitable for assigning to
// windows that have the cursor_hidden property set.
////////////////////////////////////////////////////////////////////
INLINE Cursor x11GraphicsPipe::
INLINE X11_Cursor x11GraphicsPipe::
get_hidden_cursor() {
if (_hidden_cursor == None) {
make_hidden_cursor();

View File

@ -17,14 +17,6 @@
#include "config_x11display.h"
#include "frameBufferProperties.h"
#ifdef HAVE_XRANDR
// Ugly workaround around the conflicting definition
// of Connection that randr.h provides.
#define Connection XConnection
#include <X11/extensions/Xrandr.h>
#undef Connection
#endif
TypeHandle x11GraphicsPipe::_type_handle;
bool x11GraphicsPipe::_error_handlers_installed = false;
@ -66,7 +58,7 @@ x11GraphicsPipe(const string &display) {
_supported_types = OT_window | OT_buffer | OT_texture_buffer;
_display = NULL;
_screen = 0;
_root = (Window)NULL;
_root = (X11_Window)NULL;
_im = (XIM)NULL;
_hidden_cursor = None;
@ -258,7 +250,7 @@ install_error_handlers() {
// non-fatal Xlib error.
////////////////////////////////////////////////////////////////////
int x11GraphicsPipe::
error_handler(Display *display, XErrorEvent *error) {
error_handler(X11_Display *display, XErrorEvent *error) {
++_x_error_count;
static const int msg_len = 80;
@ -292,7 +284,7 @@ error_handler(Display *display, XErrorEvent *error) {
// fatal Xlib error.
////////////////////////////////////////////////////////////////////
int x11GraphicsPipe::
io_error_handler(Display *display) {
io_error_handler(X11_Display *display) {
x11display_cat.fatal()
<< "X fatal error on display " << (void *)display << "\n";

View File

@ -21,12 +21,10 @@
#include "lightMutex.h"
#include "lightReMutex.h"
#include "windowHandle.h"
#include "get_x11.h"
class FrameBufferProperties;
#include <X11/Xlib.h>
#include <X11/Xutil.h>
////////////////////////////////////////////////////////////////////
// Class : x11GraphicsPipe
// Description : This graphics pipe represents the interface for
@ -37,12 +35,12 @@ public:
x11GraphicsPipe(const string &display = string());
virtual ~x11GraphicsPipe();
INLINE Display *get_display() const;
INLINE X11_Display *get_display() const;
INLINE int get_screen() const;
INLINE Window get_root() const;
INLINE X11_Window get_root() const;
INLINE XIM get_im() const;
INLINE Cursor get_hidden_cursor();
INLINE X11_Cursor get_hidden_cursor();
static INLINE int disable_x_error_messages();
static INLINE int enable_x_error_messages();
@ -65,23 +63,23 @@ public:
Atom _net_wm_state_remove;
protected:
Display *_display;
X11_Display *_display;
int _screen;
Window _root;
X11_Window _root;
XIM _im;
Cursor _hidden_cursor;
X11_Cursor _hidden_cursor;
private:
void make_hidden_cursor();
void release_hidden_cursor();
static void install_error_handlers();
static int error_handler(Display *display, XErrorEvent *error);
static int io_error_handler(Display *display);
static int error_handler(X11_Display *display, XErrorEvent *error);
static int io_error_handler(X11_Display *display);
typedef int ErrorHandlerFunc(Display *, XErrorEvent *);
typedef int IOErrorHandlerFunc(Display *);
typedef int ErrorHandlerFunc(X11_Display *, XErrorEvent *);
typedef int IOErrorHandlerFunc(X11_Display *);
static bool _error_handlers_installed;
static ErrorHandlerFunc *_prev_error_handler;
static IOErrorHandlerFunc *_prev_io_error_handler;

View File

@ -18,7 +18,7 @@
// Access: Public
// Description: Returns the X11 Window handle.
////////////////////////////////////////////////////////////////////
INLINE Window x11GraphicsWindow::
INLINE X11_Window x11GraphicsWindow::
get_xwindow() const {
return _xwindow;
}

View File

@ -26,29 +26,11 @@
#include "lightReMutexHolder.h"
#include "nativeWindowHandle.h"
#include "virtualFileSystem.h"
#include "get_x11.h"
#include <errno.h>
#include <fcntl.h>
#include <sys/time.h>
#include <X11/keysym.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#ifdef HAVE_XCURSOR
#include <X11/Xcursor/Xcursor.h>
#endif
#ifdef HAVE_XF86DGA
#include <X11/extensions/xf86dga.h>
#endif
#ifdef HAVE_XRANDR
// Ugly workaround around the conflicting definition
// of Connection that randr.h provides.
#define Connection XConnection
#include <X11/extensions/Xrandr.h>
#undef Connection
#endif
#ifdef HAVE_LINUX_INPUT_H
#include <linux/input.h>
@ -106,7 +88,7 @@ x11GraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
DCAST_INTO_V(x11_pipe, _pipe);
_display = x11_pipe->get_display();
_screen = x11_pipe->get_screen();
_xwindow = (Window)NULL;
_xwindow = (X11_Window)NULL;
_ic = (XIC)NULL;
_visual_info = NULL;
#ifdef HAVE_XRANDR
@ -137,7 +119,7 @@ x11GraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
////////////////////////////////////////////////////////////////////
x11GraphicsWindow::
~x11GraphicsWindow() {
pmap<Filename, Cursor>::iterator it;
pmap<Filename, X11_Cursor>::iterator it;
for (it = _cursor_filenames.begin(); it != _cursor_filenames.end(); it++) {
XFreeCursor(_display, it->second);
@ -267,7 +249,7 @@ process_events() {
GraphicsWindow::process_events();
if (_xwindow == (Window)0) {
if (_xwindow == (X11_Window)0) {
return;
}
@ -685,7 +667,7 @@ set_properties_now(WindowProperties &properties) {
} else if (!cursor_filename.empty()) {
// Note that if the cursor fails to load, cursor will be None
Cursor cursor = get_cursor(cursor_filename);
X11_Cursor cursor = get_cursor(cursor_filename);
XDefineCursor(_display, _xwindow, cursor);
} else {
@ -735,7 +717,7 @@ mouse_mode_relative() {
int major_ver, minor_ver;
if (XF86DGAQueryVersion(_display, &major_ver, &minor_ver)) {
Cursor cursor = None;
X11_Cursor cursor = None;
if (_properties.get_cursor_hidden()) {
x11GraphicsPipe *x11_pipe;
DCAST_INTO_V(x11_pipe, _pipe);
@ -785,9 +767,9 @@ close_window() {
_ic = (XIC)NULL;
}
if (_xwindow != (Window)NULL) {
if (_xwindow != (X11_Window)NULL) {
XDestroyWindow(_display, _xwindow);
_xwindow = (Window)NULL;
_xwindow = (X11_Window)NULL;
// This may be necessary if we just closed the last X window in an
// application, so the server hears the close request.
@ -798,7 +780,7 @@ close_window() {
// Change the resolution back to what it was.
// Don't remove the SizeID typecast!
if (_orig_size_id != (SizeID) -1) {
Window root;
X11_Window root;
if (_pipe != NULL) {
x11GraphicsPipe *x11_pipe;
DCAST_INTO_V(x11_pipe, _pipe);
@ -874,7 +856,7 @@ open_window() {
}
#endif
Window parent_window = x11_pipe->get_root();
X11_Window parent_window = x11_pipe->get_root();
WindowHandle *window_handle = _properties.get_parent_window();
if (window_handle != NULL) {
x11display_cat.info()
@ -889,7 +871,7 @@ open_window() {
parent_window = x11_handle->get_handle();
} else if (os_handle->is_of_type(NativeWindowHandle::IntHandle::get_class_type())) {
NativeWindowHandle::IntHandle *int_handle = DCAST(NativeWindowHandle::IntHandle, os_handle);
parent_window = (Window)int_handle->get_handle();
parent_window = (X11_Window)int_handle->get_handle();
}
}
}
@ -919,7 +901,7 @@ open_window() {
0, _visual_info->depth, InputOutput,
_visual_info->visual, attrib_mask, &wa);
if (_xwindow == (Window)0) {
if (_xwindow == (X11_Window)0) {
x11display_cat.error()
<< "failed to create X window.\n";
return false;
@ -948,7 +930,7 @@ open_window() {
} else if (_properties.has_cursor_filename() && !_properties.get_cursor_filename().empty()) {
// Note that if the cursor fails to load, cursor will be None
Cursor cursor = get_cursor(_properties.get_cursor_filename());
X11_Cursor cursor = get_cursor(_properties.get_cursor_filename());
XDefineCursor(_display, _xwindow, cursor);
}
@ -1194,7 +1176,7 @@ void x11GraphicsWindow::
setup_colormap(XVisualInfo *visual) {
x11GraphicsPipe *x11_pipe;
DCAST_INTO_V(x11_pipe, _pipe);
Window root_window = x11_pipe->get_root();
X11_Window root_window = x11_pipe->get_root();
_colormap = XCreateColormap(_display, root_window,
visual->visual, AllocNone);
@ -1876,7 +1858,7 @@ get_mouse_button(XButtonEvent &button_event) {
// window.
////////////////////////////////////////////////////////////////////
Bool x11GraphicsWindow::
check_event(Display *display, XEvent *event, char *arg) {
check_event(X11_Display *display, XEvent *event, char *arg) {
const x11GraphicsWindow *self = (x11GraphicsWindow *)arg;
// We accept any event that is sent to our window.
@ -1886,18 +1868,18 @@ check_event(Display *display, XEvent *event, char *arg) {
////////////////////////////////////////////////////////////////////
// Function: x11GraphicsWindow::get_cursor
// Access: Private
// Description: Loads and returns an Cursor corresponding to the
// Description: Loads and returns a Cursor corresponding to the
// indicated filename. If the file cannot be loaded,
// returns None.
////////////////////////////////////////////////////////////////////
Cursor x11GraphicsWindow::
X11_Cursor x11GraphicsWindow::
get_cursor(const Filename &filename) {
#ifndef HAVE_XCURSOR
return None;
}
#else
// First, look for the unresolved filename in our index.
pmap<Filename, Cursor>::iterator fi = _cursor_filenames.find(filename);
pmap<Filename, X11_Cursor>::iterator fi = _cursor_filenames.find(filename);
if (fi != _cursor_filenames.end()) {
return fi->second;
}
@ -1935,7 +1917,7 @@ get_cursor(const Filename &filename) {
}
str->seekg(0, istream::beg);
Cursor h = None;
X11_Cursor h = None;
if (memcmp(magic, "Xcur", 4) == 0) {
// X11 cursor.
x11display_cat.debug()
@ -1979,7 +1961,7 @@ get_cursor(const Filename &filename) {
// indicated stream and returns it as an X11 Cursor.
// If the file cannot be loaded, returns None.
////////////////////////////////////////////////////////////////////
Cursor x11GraphicsWindow::
X11_Cursor x11GraphicsWindow::
read_ico(istream &ico) {
// Local structs, this is just POD, make input easier
typedef struct {
@ -2014,7 +1996,7 @@ read_ico(istream &ico) {
char *curXor, *curAnd;
char *xorBmp = NULL, *andBmp = NULL;
XcursorImage *image = NULL;
Cursor ret = None;
X11_Cursor ret = None;
int def_size = XcursorGetDefaultSize(_display);

View File

@ -48,7 +48,7 @@ public:
virtual void process_events();
virtual void set_properties_now(WindowProperties &properties);
INLINE Window get_xwindow() const;
INLINE X11_Window get_xwindow() const;
protected:
virtual void close_window();
@ -69,21 +69,21 @@ protected:
ButtonHandle map_button(KeySym key);
ButtonHandle get_mouse_button(XButtonEvent &button_event);
static Bool check_event(Display *display, XEvent *event, char *arg);
static Bool check_event(X11_Display *display, XEvent *event, char *arg);
void open_raw_mice();
void poll_raw_mice();
private:
Cursor get_cursor(const Filename &filename);
X11_Cursor get_cursor(const Filename &filename);
#ifdef HAVE_XCURSOR
Cursor read_ico(istream &ico);
X11_Cursor read_ico(istream &ico);
#endif
protected:
Display *_display;
X11_Display *_display;
int _screen;
Window _xwindow;
X11_Window _xwindow;
Colormap _colormap;
XIC _ic;
XVisualInfo *_visual_info;
@ -134,7 +134,7 @@ private:
// Since the Panda API requests icons and cursors by filename, we
// need a table mapping filenames to handles, so we can avoid
// re-reading the file each time we change icons.
pmap<Filename, Cursor> _cursor_filenames;
pmap<Filename, X11_Cursor> _cursor_filenames;
};
#include "x11GraphicsWindow.I"