Ejemplo n.º 1
0
        private static async Task <uint?> FindContentWindow(X11Client x11Client, uint wagahighWindow)
        {
            var children = (await x11Client.QueryTreeAsync(wagahighWindow).ConfigureAwait(false)).Children;
            var count    = children.Count;

            if (count == 0)
            {
                return(null);
            }

            var maxArea  = 0;
            var maxIndex = 0;

            for (var i = 0; i < count; i++)
            {
                var g = await x11Client.GetGeometryAsync(children[i]).ConfigureAwait(false);

                var area = g.Width * g.Height;
                if (area > maxArea)
                {
                    maxArea  = area;
                    maxIndex = i;
                }
            }

            return(children[maxIndex]);
        }
Ejemplo n.º 2
0
        private static async Task PrintTree(X11Client client, uint window, int depth)
        {
            var windowNameAtom = await client.InternAtomAsync("_NET_WM_NAME", false).ConfigureAwait(false);

            var windowName = await client.GetStringPropertyAsync(window, windowNameAtom).ConfigureAwait(false);

            var geometry = await client.GetGeometryAsync(window).ConfigureAwait(false);

            for (var i = 0; i < depth; i++)
            {
                Console.Write("  ");
            }

            Console.WriteLine("0x{0:x} {1} {2}x{3}+{4}+{5} {6} {7}",
                              window, windowName,
                              geometry.Width, geometry.Height,
                              geometry.X, geometry.Y,
                              geometry.BorderWidth,
                              geometry.Depth);

            var result = await client.QueryTreeAsync(window).ConfigureAwait(false);

            foreach (var child in result.Children)
            {
                await PrintTree(client, child, depth + 1).ConfigureAwait(false);
            }
        }
Ejemplo n.º 3
0
        private static async Task <uint> FindWagahighWindow(X11Client client, uint root)
        {
            var windowNameAtom = await client.InternAtomAsync("_NET_WM_NAME", false).ConfigureAwait(false);

            foreach (var child in (await client.QueryTreeAsync(root).ConfigureAwait(false)).Children)
            {
                if ((await client.GetStringPropertyAsync(child, windowNameAtom).ConfigureAwait(false)) == "ワガママハイスペック")
                {
                    return(child);
                }
            }

            throw new Exception();
        }
Ejemplo n.º 4
0
        private static async Task <uint?> FindWagahighWindow(X11Client x11Client, uint root)
        {
            var windowNameAtom = await x11Client.InternAtomAsync("_NET_WM_NAME", false).ConfigureAwait(false);

            foreach (var child in (await x11Client.QueryTreeAsync(root).ConfigureAwait(false)).Children)
            {
                var netWmName = await x11Client.GetStringPropertyAsync(child, windowNameAtom).ConfigureAwait(false);

                if (netWmName == "ワガママハイスペック")
                {
                    return(child);
                }
            }

            return(null);
        }