Skip to content

Commit

Permalink
DesktopName: don't duplicate entries with same name
Browse files Browse the repository at this point in the history
If a DesktopName command was issued multiple times, such as:

FvwmCommand 'DesktopName 2 SirLoin'
FvwmCommand 'DesktopName 2 SirLoin'
FvwmCommand 'DesktopName 2 SirLoin'
FvwmCommand 'DesktopName 2 SirLoin'

Subsequent calls to change 'DesktopName 2' to something would take `n`
times, due to the fact that repeated calls to store the same DesktopName
for a given desktop were accumulating rather than replacing.

Change the logic for this such that there is no string comparison when
setting DesktopNames.

Fixes #606
  • Loading branch information
ThomasAdam committed Aug 31, 2021
1 parent 18fe8fd commit f033dd9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fvwm/virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -2801,10 +2801,8 @@ store_desktop_cmd(int desk, char *name)
}

TAILQ_FOREACH(dc_loop, &desktop_cmd_q, entry) {
/* Update the name for an existing desktop, only if it
* differs.
*/
if (dc_loop->desk == desk && (strcmp(dc_loop->name, name) != 0)) {
/* Update the name for an existing desktop. */
if (dc_loop->desk == desk) {
free(dc_loop->name);
dc_loop->name = fxstrdup(name);

Expand Down

0 comments on commit f033dd9

Please sign in to comment.