Added WindowData structures to GraphicsWindowX11,Win32 and Carbon to help support

GraphicsWindow inheriting their window handles from an external toolkit
This commit is contained in:
Robert Osfield
2007-03-16 13:22:05 +00:00
parent bfdc645a09
commit aa28f60357
7 changed files with 45 additions and 11 deletions

View File

@@ -32,13 +32,14 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow
public:
GraphicsWindowCarbon(osg::GraphicsContext::Traits* traits):
_ownWindow(true),
_valid(false),
_initialized(false),
_realized(false)
{
_traits = traits;
init();
init(traits ? dynamic_cast<WindowData*>(traits->inheritedWindowData.get()) : 0);
if (valid())
{
@@ -98,9 +99,18 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow
bool handleMouseEvent(EventRef theEvent);
bool handleKeyboardEvent(EventRef theEvent);
/** WindowData is used to pass in the X11 window handle attached the GraphicsContext::Traits structure. */
struct WindowData : public osg::Referenced
{
WindowData(Window window):
_window(window) {}
Window _window;
};
protected:
void init();
void init(WindowData* inheritedWindowData=0);
void transformMouseXY(float& x, float& y);
@@ -111,6 +121,7 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow
bool _realized;
bool _useWindowDecoration;
bool _ownsWindow;
WindowRef _window;
AGLContext _context;
AGLPixelFormat _pixelFormat;