From 8e01c3d9a5feb6dbe5a1fbe36a63a0e2bd937597 Mon Sep 17 00:00:00 2001 From: Thomas Adam Date: Thu, 17 Oct 2024 21:27:02 +0100 Subject: [PATCH] ConfigWinPacket: no longer send monitor_name Because of the padding and the alignment in the CongfigWinPacket, trying to fit a monitor name >8 characters would truncate. Instead, if modules need to look up the monitor from the window packet, do so via the monitor_id which was already being sent down. Currently, only FvwmIconMan is affected. Noticed by jns and somiaj on IRC. --- fvwm/module_interface.c | 2 -- libs/vpacket.h | 1 - modules/FvwmIconMan/fvwm.c | 11 ++++++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/fvwm/module_interface.c b/fvwm/module_interface.c index 3eb11d13d..a37cfff34 100644 --- a/fvwm/module_interface.c +++ b/fvwm/module_interface.c @@ -320,8 +320,6 @@ action_flags *_get_allowed_actions(const FvwmWindow *fw) (unsigned long)(0), \ &(*(_fw))->m->si->rr_output, \ (unsigned long)(sizeof(unsigned long)),\ - (*(_fw))->m->si->name, \ - (unsigned long)(0), \ &(*(_fw))->layer, \ (unsigned long)(0), \ &(*(_fw))->hints.base_width, \ diff --git a/libs/vpacket.h b/libs/vpacket.h index 98eb590cc..3f969850d 100644 --- a/libs/vpacket.h +++ b/libs/vpacket.h @@ -30,7 +30,6 @@ typedef struct ConfigWinPacket unsigned long frame_height; unsigned long desk; unsigned long monitor_id; - unsigned long monitor_name; unsigned long layer; unsigned long hints_base_width; unsigned long hints_base_height; diff --git a/modules/FvwmIconMan/fvwm.c b/modules/FvwmIconMan/fvwm.c index 879299c17..5edd79530 100644 --- a/modules/FvwmIconMan/fvwm.c +++ b/modules/FvwmIconMan/fvwm.c @@ -181,7 +181,16 @@ WinData *id_to_win(Ulong id) static void set_win_configuration(WinData *win, FvwmPacketBody *body) { - copy_string(&win->monitor, (char *)&(body->add_config_data.monitor_name)); + struct monitor *m = monitor_by_output(body->add_config_data.monitor_id); + + if (m == NULL) { + fprintf(stderr, + "FvwmIconMan: %s: couldn't find mon with id: %ld\n", + __func__, body->add_config_data.monitor_id); + copy_string(&win->monitor, "Unknown"); + } else + copy_string(&win->monitor, m->si->name); + win->desknum = body->add_config_data.desk; win->x = body->add_config_data.frame_x; win->y = body->add_config_data.frame_y;