00001 // Filename: glxGraphicsWindow.h 00002 // Created by: mike (09Jan97) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef GLXGRAPHICSWINDOW_H 00020 #define GLXGRAPHICSWINDOW_H 00021 00022 #include "pandabase.h" 00023 00024 #include "graphicsWindow.h" 00025 #include "buttonHandle.h" 00026 00027 #include <X11/Xlib.h> 00028 #include <GL/glx.h> 00029 00030 class glxGraphicsPipe; 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Class : glxGraphicsWindow 00034 // Description : An interface to the glx system for managing GL 00035 // windows under X. 00036 //////////////////////////////////////////////////////////////////// 00037 class glxGraphicsWindow : public GraphicsWindow { 00038 public: 00039 glxGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg); 00040 virtual ~glxGraphicsWindow(); 00041 00042 virtual void make_current(); 00043 virtual void release_gsg(); 00044 00045 virtual bool begin_frame(); 00046 virtual void begin_flip(); 00047 00048 virtual void process_events(); 00049 virtual void set_properties_now(WindowProperties &properties); 00050 00051 protected: 00052 virtual void close_window(); 00053 virtual bool open_window(); 00054 00055 private: 00056 void set_wm_properties(const WindowProperties &properties); 00057 00058 void setup_colormap(XVisualInfo *visual); 00059 ButtonHandle get_button(XKeyEvent *key_event); 00060 00061 static Bool check_event(Display *display, XEvent *event, char *arg); 00062 00063 private: 00064 Display *_display; 00065 int _screen; 00066 Window _xwindow; 00067 Colormap _colormap; 00068 long _event_mask; 00069 bool _awaiting_configure; 00070 Atom _wm_delete_window; 00071 00072 00073 public: 00074 static TypeHandle get_class_type() { 00075 return _type_handle; 00076 } 00077 static void init_type() { 00078 GraphicsWindow::init_type(); 00079 register_type(_type_handle, "glxGraphicsWindow", 00080 GraphicsWindow::get_class_type()); 00081 } 00082 virtual TypeHandle get_type() const { 00083 return get_class_type(); 00084 } 00085 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00086 00087 private: 00088 static TypeHandle _type_handle; 00089 }; 00090 00091 #include "glxGraphicsWindow.I" 00092 00093 #endif