Skip to content

Improve Send_WindowList Performance#1273

Draft
ThomasAdam wants to merge 2 commits intomainfrom
ta/send-windowlist-perf
Draft

Improve Send_WindowList Performance#1273
ThomasAdam wants to merge 2 commits intomainfrom
ta/send-windowlist-perf

Conversation

@ThomasAdam
Copy link
Copy Markdown
Member

This PR tries to improve the performance of the internal Send_WindowList
command by allowing a filter at source, to explicitly denote which monitor
should be used. This is useful for certain modules; currently FvwmRearrange
is using this, but FvwmPager might benefit from it in the future.

The more connected (and active) monitors there are, the slower this operation
becomes -- although this is always going to be the case where modules are
operating over the global monitor.

  • Send_WindowList: allow for optional monitor

Augments the Send_WindowList to allow for an optional monitor name which can
be used to ignore other monitors.

  • FvwmRearrange: send monitor with Send_WindowList

Make FvwmRearrange use the opt-in Send_WindowList command to supply a
monitor name.

@ThomasAdam ThomasAdam added this to the 1.1.5 milestone Dec 20, 2025
Comment on lines -945 to +951
SendText(fd, "Send_WindowList", 0);
char *scr_name = mon->si->name;
char msg[4096];

if (is_global)
scr_name = "";
snprintf(msg, sizeof(msg), "Send_WindowList %s", scr_name);
SendText(fd, msg, 0);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use

char msg[4096];

if (is_global)
    msg = "Send_WindowList"
else
    msg = snprintf(msg, sizeof(msg), "Send_WindowList %s", mon->si->name);

Keeps the msg from having an extra space, "Send_WindowList ", in the global case, though probably doesn't matter, just a thought I had.

When modules send a request for all windows, this can be computationally
expensive as this was sent for all monitors.  It was expected that
modules would filter these packets out.

However, this operation is expensive the more monitors which are
attached with windows.

Allow for modules to opt-in to immediately filtering out a specific
monitor at source, by appending the name of a monitor to the end of the
"Send_WindowList" command.
When requesting a list of windows to operate on, explicitly send the
monitor name to use.  This is only applicable if -screen is set or none
is provided (defaulting to the current monitor).

This is ignored in the case where the global screen has been requested.
@ThomasAdam ThomasAdam force-pushed the ta/send-windowlist-perf branch from 752b441 to a370c8f Compare December 20, 2025 16:51
@ThomasAdam ThomasAdam self-assigned this Dec 20, 2025
@ThomasAdam ThomasAdam added the type:enhancement Augmenting an existing feature label Dec 20, 2025
@ThomasAdam ThomasAdam added this to FVWM3 Dec 20, 2025
@github-project-automation github-project-automation bot moved this to PRs in FVWM3 Dec 20, 2025
@ThomasAdam ThomasAdam marked this pull request as draft December 20, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:enhancement Augmenting an existing feature

Projects

Status: PRs

Development

Successfully merging this pull request may close these issues.

2 participants