[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/3] Include all clients in _NET_CLIENT_LIST_STACKING



Hi Hans-Peter,

On Sun, Nov 18, 2012 at 07:21:54PM +0100, Hans-Peter Deifel wrote:
> Also include clients that are not in the current stack. Now,
> _NET_CLIENT_LIST_STACKING should contain exactly the same windows as
> _NET_CLIENT_LIST.

> +static Window* ewmh_merge_stacking_list(Window *buf, int count, int *new_count) {
> +    int last = count;
> +
> +    buf = g_renew(Window, buf, count + g_window_count);

If ..LIST_STACKING contains exactly the same windows as ..LIST, then why
don't you realloc the buf size directly to g_window_count? (Of course
you additionally should check how many windows are finally added to
the buf).

> +    for (int i = 0; i < g_window_count; i++) {
> +        if (array_find(buf, count, sizeof(Window), g_windows + i) < 0) {
> +            buf[last++] = g_windows[i];
> +        }
> +    }

That's OK for now. If there are n clients, that needs O(n²) run-time,
but a O(n*m) way (with m monitors) isn't difficult (and not long) to
implement, because you know which tags are visible on monitors and which
aren't (You can check it with find_monitor_with_tag() in O(m)). I'll fix
that in near (or far) future.

Regards,
Thorsten