Changeset 6366

Show
Ignore:
Timestamp:
03/16/07 14:22:05
Author:
robert
Message:

Added WindowData? structures to GraphicsWindowX11,Win32 and Carbon to help support
GraphicsWindow? inheriting their window handles from an external toolkit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OpenSceneGraph/trunk/include/osg/GraphicsContext

    r6337 r6366  
    126126            GraphicsContext* sharedContext; 
    127127             
    128             osg::ref_ptr<osg::Referenced> inhertedWindowData; 
     128            osg::ref_ptr<osg::Referenced> inheritedWindowData; 
    129129        }; 
    130130     
  • OpenSceneGraph/trunk/include/osgViewer/GraphicsWindowCarbon

    r6204 r6366  
    3333 
    3434        GraphicsWindowCarbon(osg::GraphicsContext::Traits* traits): 
     35            _ownWindow(true), 
    3536            _valid(false), 
    3637            _initialized(false), 
     
    3940            _traits = traits; 
    4041 
    41             init(); 
     42            init(traits ? dynamic_cast<WindowData*>(traits->inheritedWindowData.get()) : 0); 
    4243             
    4344            if (valid()) 
     
    99100        bool handleKeyboardEvent(EventRef theEvent); 
    100101 
     102        /** WindowData is used to pass in the X11 window handle attached the GraphicsContext::Traits structure. */ 
     103        struct WindowData : public osg::Referenced 
     104        { 
     105            WindowData(Window window): 
     106                _window(window) {} 
     107                 
     108            Window          _window; 
     109        }; 
     110 
    101111    protected: 
    102112     
    103         void init(); 
     113        void init(WindowData* inheritedWindowData=0); 
    104114         
    105115        void transformMouseXY(float& x, float& y); 
     
    112122        bool            _useWindowDecoration; 
    113123 
     124        bool            _ownsWindow; 
    114125        WindowRef       _window; 
    115126        AGLContext      _context; 
  • OpenSceneGraph/trunk/include/osgViewer/GraphicsWindowWin32

    r6205 r6366  
    7979        virtual LRESULT handleNativeWindowingEvent( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); 
    8080         
     81        /** WindowData is used to pass in the Win32 window handle attached the GraphicsContext::Traits structure.*/ 
     82        struct WindowData : public osg::Referenced 
     83        { 
     84            WindowData(HWND window): 
     85                _hwnd(window) {} 
     86                 
     87            HWND    _hwnd; 
     88        }; 
     89         
     90         
    8191    protected: 
    8292     
    83         void init(); 
     93        void init(WindowData* inheritedWindowData=0); 
    8494         
    8595        void registerWindowClass(); 
     
    101111        HGLRC getWGLContext() { return _hglrc; } 
    102112         
     113        bool            _ownsWindow;         
    103114        HWND            _hwnd; 
    104115        HDC             _hdc; 
  • OpenSceneGraph/trunk/include/osgViewer/GraphicsWindowX11

    r6204 r6366  
    5151            _traits = traits; 
    5252 
    53             init(); 
     53            init(traits ? dynamic_cast<WindowData*>(traits->inheritedWindowData.get()) : 0); 
    5454             
    5555            if (valid()) 
     
    109109        virtual void useCursor(bool cursorOn); 
    110110         
     111        /** WindowData is used to pass in the X11 window handle attached the GraphicsContext::Traits structure. */ 
     112        struct WindowData : public osg::Referenced 
     113        { 
     114            WindowData(Window window): 
     115                _window(window) {} 
     116                 
     117            Window          _window; 
     118        }; 
     119 
    111120    public: 
    112121     
     
    128137     
    129138        bool createVisualInfo(); 
    130         void init(); 
     139         
     140        void init(WindowData* inheritedWindowData=0); 
    131141 
    132142        void transformMouseXY(float& x, float& y); 
  • OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowCarbon.cpp

    r6220 r6366  
    537537} 
    538538 
    539 void GraphicsWindowCarbon::init(
     539void GraphicsWindowCarbon::init(WindowData* inheritedWindowData
    540540{ 
    541541    _closeRequested = false; 
  • OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowWin32.cpp

    r6205 r6366  
    981981 
    982982GraphicsWindowWin32::GraphicsWindowWin32( osg::GraphicsContext::Traits* traits ) 
    983 : _hwnd(0), 
     983:  
     984  _ownsWindow(true), 
     985  _hwnd(0), 
    984986  _hdc(0), 
    985987  _hglrc(0), 
     
    10011003    _traits = traits; 
    10021004 
    1003     init(); 
     1005    init(traits ? dynamic_cast<WindowData*>(traits->inheritedWindowData.get()) : 0); 
    10041006     
    10051007    if (valid()) 
     
    10261028} 
    10271029 
    1028 void GraphicsWindowWin32::init(
     1030void GraphicsWindowWin32::init(WindowData* inheritedWindowData
    10291031{ 
    10301032    if (!_initialized) 
  • OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowX11.cpp

    r6204 r6366  
    368368} 
    369369 
    370 void GraphicsWindowX11::init(
     370void GraphicsWindowX11::init(WindowData* inheritedWindowData
    371371{ 
    372372    if (_initialized) return;