File fvwm3-iconbox.patch of Package fvwm3

From 0000000000000000000000000000000000000000 Tue Sep 11 14:21:00 2025
From: Werner Fink <werner@suse.de>
Date: Tue, 11 Sep 2025 14:21:00 +0000
Subject: [PATCH] Make screen option of icon boxes work again
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Make IconBox screen option working again even with several monitors.

Signed-off-by: Werner Fink

---
 fvwm/icons.c   |   24 ++++++++++++++++++++++--
 fvwm/style.c   |    4 +++-
 libs/FScreen.c |    9 ++++++---
 3 files changed, 31 insertions(+), 6 deletions(-)

--- fvwm/icons.c
+++ fvwm/icons.c	2025-09-12 09:26:10.843963963 +0000
@@ -1786,13 +1786,31 @@ void AutoPlaceIcon(
     icon_boxes_ptr = NULL;              /* init */
     while(do_all_iconboxes(t, &icon_boxes_ptr))
     {
+      fscreen_scr_t screen;
       if (loc_ok == True)
       {
 	/* leave for loop */
 	break;
       }
       /* get the screen dimensions for the icon box */
-      FScreenGetScrRect(fscr, FSCREEN_CURRENT,
+      screen = FSCREEN_CURRENT;
+      if (icon_boxes_ptr->IconScreen) {
+	 char *name = icon_boxes_ptr->IconScreen;
+	 if (*name == '@')
+	   name++;
+        if (strcmp(name, "global") == 0)
+	   screen = FSCREEN_GLOBAL;
+        else if (strcmp(name, "primary") == 0)
+	   screen = FSCREEN_PRIMARY;
+        else if (strcmp(name, "current") == 0 || *name == 'w')
+	   screen = FSCREEN_CURRENT;
+        else if (fscr)
+        {
+	   screen = FSCREEN_BY_NAME;
+	   fscr->name = name;
+        }
+      }
+      FScreenGetScrRect(fscr, screen,
 		        &ref.x, &ref.y, &ref.width, &ref.height);
       dim[1].screen_offset = ref.y;
       dim[1].screen_dimension = ref.height;
@@ -1940,7 +1958,7 @@ void AutoPlaceIcon(
 	  }
 
 	  /* this may be a good location */
-	  if (FScreenIsRectangleOnScreen(fscr, FSCREEN_XYPOS, &ref))
+	  if (FScreenIsRectangleOnScreen(fscr, screen, &ref))
 	  {
 	    loc_ok = True;
 	  }
@@ -2035,6 +2053,8 @@ do_all_iconboxes(FvwmWindow *t, icon_box
 		global_icon_box_ptr->IconGrid[0] = 80;
 		global_icon_box_ptr->IconGrid[1] = 80;
 		global_icon_box_ptr->IconFlags = ICONFILLHRZ;
+		global_icon_box_ptr->IconScreen = "@primary";
+		global_icon_box_ptr->do_free_screen = 0;
 	}
 	if (*icon_boxes_ptr == NULL)
 	{
--- fvwm/style.c
+++ fvwm/style.c	2025-09-11 12:16:36.413226821 +0000
@@ -1976,7 +1976,9 @@ static char *style_parse_icon_box_style(
 		is_screen_given = True;
 		option = PeekToken(rest, &rest); /* skip screen */
 		option = PeekToken(rest, &rest); /* get the screen spec */
-		IconBoxes->IconScreen = option;
+		/* GetIntegerArguments() below removes screen */
+		IconBoxes->IconScreen = fxstrdup(option);
+		IconBoxes->do_free_screen = 1;
 	}
 
 	/* try for 4 numbers x y x y */
--- libs/FScreen.c
+++ libs/FScreen.c	2025-09-12 09:25:32.476697667 +0000
@@ -255,15 +255,18 @@ monitor_resolve_name(const char *scr)
 	if (errstr == NULL)
 		return (monitor_by_number(pos));
 
+	if (*scr == '@')
+		scr++;
+
 	/* "@g" is for the global screen. */
-	if (strcmp(scr, "g") == 0) {
+	if (strcmp(scr, "global") == 0 || *scr == 'g') {
 		m = monitor_get_global();
 	}
 	/* "@c" is for the current screen. */
-	else if (strcmp(scr, "c") == 0)
+	else if (strcmp(scr, "current") == 0 || *scr == 'c')
 		m = monitor_get_current();
 	/* "@p" is for the primary screen. */
-	else if (strcmp(scr, "p") == 0)
+	else if (strcmp(scr, "primary") == 0 || *scr == 'p')
 		m = monitor_by_primary();
 	else
 		/* Assume the monitor name is a literal RandR name (such as
openSUSE Build Service is sponsored by