Re: Please make window id visible (DVDGetOutputWindowInfo?)

Seth Kingsley <[email protected]> Sat, 14 Aug 2004 09:43:19 -0700
Newsgroups gmane.comp.video.ogle.devel
Message-ID <[email protected]>
On Sat, Aug 14, 2004 at 12:54:14PM +0200, Martin Piskernig wrote:
> I _really_ need the window-id for further oKle development because of 
> changes in the KDE window manager in respect to fullscreen mode.

Here's a stopgap until it's added to the API:

Call _x11_win_find(dpy, "Ogle") which returns either a valid window-id or
None.  Qt should have functions to grab the current display, or create a
window object from a foreign X11 Window, just as GTK+ does.

static Window
_x11_win_find_recurse(Display *d, Window w, char *class)
{
    Window junk;
    Window *cws;
    u_int ncw;
    register u_int i;

    if (!XQueryTree(d, w, &junk, &junk, &cws, &ncw))
    return None;

    for (i = 0; i < ncw; ++i)
    {
	XClassHint res;

	if (XGetClassHint(d, cws[i], &res) && !strcmp(res.res_class, class))
	    return cws[i];
	else if ((w = _x11_win_find_recurse(d, cws[i], class)) != None)
	    return w;
    }

    return None;
}

static Window
_x11_win_find(Display *d, char *class)
{
    register u_int s;

    for (s = 0; s < ScreenCount(d); ++s)
    {
	Window root = RootWindow(d, s);
	Window w;

	if ((w = _x11_win_find_recurse(d, root, class)) != None)
	    return w;
    }

    return None;
}

-- 
|| Seth Kingsley || [email protected] ||
|| http://www.meowfishies.com/ | Meow ^_^ ||
signature.asc (application/pgp-signature, 187 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQFBHkEnD1AymFxBOwgRAogTAKCAh9TUMdI9bduwRSts6Th44vjh2wCfUad1
U/5AYo49hycHOhVmAJUr5X8=
=v0zB
-----END PGP SIGNATURE-----