From Jutta Sauer, "We added a raise window method to GraphicsWindow. And added two
implementations for Win32 and X11. "
This commit is contained in:
@@ -668,8 +668,8 @@ bool GraphicsWindowX11::createWindow()
|
||||
_traits->y,
|
||||
_traits->width, _traits->height, 0,
|
||||
_visualInfo->depth, InputOutput,
|
||||
_visualInfo->visual, mask, &swatt );
|
||||
|
||||
_visualInfo->visual, mask, &swatt );
|
||||
|
||||
if (!_window)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Error: Unable to create Window."<<std::endl;
|
||||
@@ -1744,3 +1744,33 @@ extern "C" void graphicswindow_X11(void)
|
||||
{
|
||||
osg::GraphicsContext::setWindowingSystemInterface(new X11WindowingSystemInterface);
|
||||
}
|
||||
|
||||
|
||||
void GraphicsWindowX11::raiseWindow()
|
||||
{
|
||||
Display* display = getDisplayToUse();
|
||||
XWindowAttributes winAttrib;
|
||||
|
||||
Window root_return, parent_return, *children;
|
||||
unsigned int nchildren, i=0;
|
||||
XTextProperty windowName;
|
||||
bool xraise = false;
|
||||
|
||||
|
||||
XQueryTree(display, _parent, &root_return, &parent_return, &children, &nchildren);
|
||||
while (!xraise && i<nchildren)
|
||||
{
|
||||
XGetWMName(display,children[i++],&windowName);
|
||||
if ((windowName.nitems != 0) && (strcmp(_traits->windowName.c_str(),(const char *)windowName.value) == 0)) xraise = true;
|
||||
}
|
||||
if (xraise) XRaiseWindow(display,_window);
|
||||
else
|
||||
{
|
||||
XGetWindowAttributes(display, _window, &winAttrib);
|
||||
XReparentWindow(display, _window, _parent, winAttrib.x, winAttrib.y);
|
||||
}
|
||||
XFree(children);
|
||||
|
||||
XFlush(display);
|
||||
XSync(display,0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user