Added support for getting all windows and hiding the cursor
This commit is contained in:
@@ -333,6 +333,25 @@ void GraphicsWindowX11::setWindowDecoration(bool flag)
|
||||
osg::notify(osg::NOTICE)<<"Error: GraphicsWindowX11::setBorder(" << flag << ") - couldn't change decorations." << std::endl;
|
||||
}
|
||||
|
||||
void GraphicsWindowX11::useCursor(bool cursorOn)
|
||||
{
|
||||
if (cursorOn)
|
||||
{
|
||||
_currentCursor = _defaultCursor;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentCursor = _nullCursor;
|
||||
}
|
||||
|
||||
if (_display && _window)
|
||||
{
|
||||
XDefineCursor( _display, _window, _currentCursor );
|
||||
XFlush(_display);
|
||||
XSync(_display,0);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsWindowX11::init()
|
||||
{
|
||||
if (_initialized) return;
|
||||
@@ -461,17 +480,7 @@ void GraphicsWindowX11::init()
|
||||
_nullCursor = XCreatePixmapCursor( _display, pixmap, pixmap, &ncol, &ncol, 0, 0 );
|
||||
}
|
||||
|
||||
#if 1
|
||||
_currentCursor = _defaultCursor;
|
||||
#else
|
||||
_currentCursor = _nullCursor;
|
||||
#endif
|
||||
|
||||
{
|
||||
XDefineCursor( _display, _window, _currentCursor );
|
||||
XFlush(_display);
|
||||
XSync(_display,0);
|
||||
}
|
||||
useCursor(true);
|
||||
|
||||
XSelectInput( _display, _window, ExposureMask | StructureNotifyMask |
|
||||
KeyPressMask | KeyReleaseMask |
|
||||
|
||||
@@ -94,6 +94,39 @@ void Viewer::getContexts(Contexts& contexts)
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::getWindows(Windows& windows)
|
||||
{
|
||||
typedef std::set<osgViewer::GraphicsWindow*> WindowSet;
|
||||
WindowSet windowSet;
|
||||
|
||||
if (_camera.valid() && _camera->getGraphicsContext())
|
||||
{
|
||||
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(_camera->getGraphicsContext());
|
||||
if (gw) windowSet.insert(gw);
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<getNumSlaves(); ++i)
|
||||
{
|
||||
Slave& slave = getSlave(i);
|
||||
if (slave._camera.valid() && slave._camera->getGraphicsContext())
|
||||
{
|
||||
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(slave._camera->getGraphicsContext());
|
||||
if (gw) windowSet.insert(gw);
|
||||
}
|
||||
}
|
||||
|
||||
windows.clear();
|
||||
windows.reserve(windowSet.size());
|
||||
|
||||
for(WindowSet::iterator itr = windowSet.begin();
|
||||
itr != windowSet.end();
|
||||
++itr)
|
||||
{
|
||||
windows.push_back(const_cast<osgViewer::GraphicsWindow*>(*itr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OpenThreads::Mutex mutex;
|
||||
|
||||
// Compile operation, that compile OpenGL objects.
|
||||
|
||||
Reference in New Issue
Block a user