Platform/Unix/Xlib: Adding getParentWindow()
This commit is contained in:
parent
05b59a4677
commit
46bc8eb5d8
2 changed files with 18 additions and 0 deletions
|
|
@ -26,6 +26,22 @@ void shutdown()
|
|||
return _priv::display;
|
||||
}
|
||||
|
||||
// Implementation borrowed from SFML :)
|
||||
::Window getParentWindow(::Window win)
|
||||
{
|
||||
::Window root, parent;
|
||||
::Window* children = nullptr;
|
||||
unsigned int numChildren;
|
||||
|
||||
::XQueryTree(getDisplay(), win, &root, &parent, &children, &numChildren);
|
||||
|
||||
// Children information is not used, so must be freed.
|
||||
if (children != nullptr)
|
||||
XFree(children);
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
::Atom getAtom(const std::string& name, bool onlyIfExists)
|
||||
{
|
||||
return XInternAtom(getDisplay(), name.c_str(), onlyIfExists);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ void shutdown();
|
|||
|
||||
::Display* getDisplay();
|
||||
|
||||
::Window getParentWindow(::Window win);
|
||||
|
||||
::Atom getAtom(const std::string& name, bool onlyIfExists = false);
|
||||
|
||||
} } // namespace sp::xlib
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue