[PATCH] Only put child windows in EWMH client lists
Thorsten Wißmann
edu at thorsten-wissmann.de
Mon Mar 10 11:53:58 CET 2014
On Sat, Mar 08, 2014 at 02:31:48PM +0100, Hans-Peter Deifel wrote:
> Previously, only our own decoration windows showed up in the
> _NET_CLIENT_LIST_STACKING property. This confused pagers like
> xfce4-panel.
And of course it was not EWMH conform :) Thanks, great patch!
331e8bf Only put child windows in EWMH client lists
Cheers,
Thorsten
>
> The responsible function 'stack_to_window_buf' is also used in a context
> where we want to have only children of the root window in the result
> buffer. Now stack_to_window_buf and it's helpers accept a parameter
> specifying if they should return real_clients (aka application windows)
> or other windows.
> ---
> src/monitor.c | 8 ++++----
> src/monitor.h | 4 ++--
> src/stack.c | 22 +++++++++++++---------
> src/stack.h | 4 ++--
> 4 files changed, 21 insertions(+), 17 deletions(-)
>
> diff --git a/src/monitor.c b/src/monitor.c
> index 85e6af7..3a64599 100644
> --- a/src/monitor.c
> +++ b/src/monitor.c
> @@ -1292,13 +1292,13 @@ int detect_monitors_command(int argc, char **argv, GString* output) {
> return ret;
> }
>
> -int monitor_stack_window_count(bool only_clients) {
> - return stack_window_count(g_monitor_stack, only_clients);
> +int monitor_stack_window_count(bool real_clients) {
> + return stack_window_count(g_monitor_stack, real_clients);
> }
>
> -void monitor_stack_to_window_buf(Window* buf, int len, bool only_clients,
> +void monitor_stack_to_window_buf(Window* buf, int len, bool real_clients,
> int* remain_len) {
> - stack_to_window_buf(g_monitor_stack, buf, len, only_clients, remain_len);
> + stack_to_window_buf(g_monitor_stack, buf, len, real_clients, remain_len);
> }
>
> HSStack* get_monitor_stack() {
> diff --git a/src/monitor.h b/src/monitor.h
> index 5d715d3..6a4579e 100644
> --- a/src/monitor.h
> +++ b/src/monitor.h
> @@ -101,8 +101,8 @@ void all_monitors_replace_previous_tag(struct HSTag* old, struct HSTag* new);
> void drop_enternotify_events();
>
> void monitor_restack(HSMonitor* monitor);
> -int monitor_stack_window_count(bool only_clients);
> -void monitor_stack_to_window_buf(Window* buf, int len, bool only_clients,
> +int monitor_stack_window_count(bool real_clients);
> +void monitor_stack_to_window_buf(Window* buf, int len, bool real_clients,
> int* remain_len);
> struct HSStack* get_monitor_stack();
>
> diff --git a/src/stack.c b/src/stack.c
> index 7d31e2d..223805b 100644
> --- a/src/stack.c
> +++ b/src/stack.c
> @@ -216,9 +216,9 @@ int print_stack_command(int argc, char** argv, GString* output) {
> return 0;
> }
>
> -int stack_window_count(HSStack* stack, bool only_clients) {
> +int stack_window_count(HSStack* stack, bool real_clients) {
> int counter = 0;
> - stack_to_window_buf(stack, NULL, 0, only_clients, &counter);
> + stack_to_window_buf(stack, NULL, 0, real_clients, &counter);
> return -counter;
> }
>
> @@ -227,7 +227,7 @@ struct s2wb {
> int len;
> Window* buf;
> int missing; /* number of slices that could not find space in buf */
> - bool only_clients; /* whether to include windows that aren't clients */
> + bool real_clients; /* whether to include windows that aren't clients */
> HSLayer layer; /* the layer the slice should be added to */
> };
>
> @@ -241,7 +241,11 @@ static void slice_to_window_buf(HSSlice* s, struct s2wb* data) {
> switch (s->type) {
> case SLICE_CLIENT:
> if (data->len) {
> - data->buf[0] = s->data.client->dec.decwin;
> + if (data->real_clients) {
> + data->buf[0] = s->data.client->window;
> + } else {
> + data->buf[0] = s->data.client->dec.decwin;
> + }
> data->buf++;
> data->len--;
> } else {
> @@ -249,7 +253,7 @@ static void slice_to_window_buf(HSSlice* s, struct s2wb* data) {
> }
> break;
> case SLICE_WINDOW:
> - if (!data->only_clients) {
> + if (!data->real_clients) {
> if (data->len) {
> data->buf[0] = s->data.window;
> data->buf++;
> @@ -261,7 +265,7 @@ static void slice_to_window_buf(HSSlice* s, struct s2wb* data) {
> break;
> case SLICE_MONITOR:
> tag = s->data.monitor->tag;
> - if (!data->only_clients) {
> + if (!data->real_clients) {
> if (data->len) {
> data->buf[0] = s->data.monitor->stacking_window;
> data->buf++;
> @@ -272,7 +276,7 @@ static void slice_to_window_buf(HSSlice* s, struct s2wb* data) {
> }
> int remain_len = 0; /* remaining length */
> stack_to_window_buf(tag->stack, data->buf, data->len,
> - data->only_clients, &remain_len);
> + data->real_clients, &remain_len);
> int len_used = data->len - remain_len;
> if (remain_len >= 0) {
> data->buf += len_used;
> @@ -286,12 +290,12 @@ static void slice_to_window_buf(HSSlice* s, struct s2wb* data) {
> }
>
> void stack_to_window_buf(HSStack* stack, Window* buf, int len,
> - bool only_clients, int* remain_len) {
> + bool real_clients, int* remain_len) {
> struct s2wb data = {
> .len = len,
> .buf = buf,
> .missing = 0,
> - .only_clients = only_clients,
> + .real_clients = real_clients,
> };
> for (int i = 0; i < LAYER_COUNT; i++) {
> data.layer = i;
> diff --git a/src/stack.h b/src/stack.h
> index fca3168..41748c2 100644
> --- a/src/stack.h
> +++ b/src/stack.h
> @@ -69,8 +69,8 @@ void stack_clear_layer(HSStack* stack, HSLayer layer);
> int print_stack_command(int argc, char** argv, GString* output);
>
> // returns the number of windows in this stack
> -int stack_window_count(HSStack* stack, bool only_clients);
> -void stack_to_window_buf(HSStack* stack, Window* buf, int len, bool only_clients,
> +int stack_window_count(HSStack* stack, bool real_clients);
> +void stack_to_window_buf(HSStack* stack, Window* buf, int len, bool real_clients,
> int* remain_len);
> void stack_restack(HSStack* stack);
> Window stack_lowest_window(HSStack* stack);
> --
> 1.9.0
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: not available
URL: <https://listi.jpberlin.de/pipermail/hlwm/attachments/20140310/6e874917/attachment.sig>
More information about the hlwm
mailing list