1
0
Fork 0

Platform/Unix/Xlib: Adding getParentWindow()

This commit is contained in:
Henrik Hautakoski 2022-10-01 16:00:57 +02:00
parent 05b59a4677
commit 46bc8eb5d8
2 changed files with 18 additions and 0 deletions

View file

@ -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);

View file

@ -15,6 +15,8 @@ void shutdown();
::Display* getDisplay();
::Window getParentWindow(::Window win);
::Atom getAtom(const std::string& name, bool onlyIfExists = false);
} } // namespace sp::xlib