From d32706888f83b91d6feab93067d1207c507335fa Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 26 Jun 2019 18:50:44 +0200 Subject: Screen.c: add nxagentIsParentOf helper --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 6ec4b245f..4e466b502 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -297,6 +297,28 @@ void nxagentSetPixmapFormats(ScreenInfo *screenInfo) } } +/* check if possible_parent is parent of candidate */ +Bool nxagentIsParentOf(Display *d, Window possible_parent, Window candidate) +{ + Window parent, root, *children = NULL; + unsigned int num_children; + + if (XQueryTree(d, candidate, &root, &parent, &children, &num_children)) + { + if (children) + XFree((char *)children); + + #ifdef TEST + fprintf(stderr, "%s: parent of full screen window [%p] root [%p] possible_parent [%p] candidate [%p]\n", __func__, parent, root, possible_parent, candidate); + #endif + return (parent == possible_parent); + } + else + { + return False; + } +} + void nxagentMinimizeFromFullScreen(ScreenPtr pScreen) { XUnmapWindow(nxagentDisplay, nxagentFullscreenWindow); -- cgit v1.2.3