Guest User

systray-icon-size-overflow-fix.patch

a guest
May 1st, 2026
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.66 KB | None | 0 0
  1. From: zackattackz
  2. Subject: [PATCH] systray: fix icon overflow when systray_icon_size < panel height
  3.  
  4. systray_get_geometry() uses a chain assignment to set both the local
  5. variable icon_size and systray.icon_size to the raw available height.
  6. It then caps icon_size with MIN(icon_size, systray_max_icon_size*scale)
  7. but forgets to propagate the cap back to systray.icon_size.
  8.  
  9. This causes a mismatch:
  10.   - the width formula uses the capped icon_size (e.g. 32 px)
  11.   - on_change_systray() reads systray.icon_size (e.g. 42 px) for both
  12.     traywin->width/height and the per-icon step (pos)
  13.  
  14. With systray_icon_size=32 and a 42 px panel the step is 44 px instead
  15. of 34 px, so each extra icon pushes 10 px more than the width formula
  16. reserves.  With n icons the last one overflows the tray area by
  17. (n-1)*10 px and gets clipped on the right.
  18.  
  19. Fix: write the capped value back to systray.icon_size so the width
  20. formula and the placement loop stay in sync.
  21.  
  22. Also fixes the icon size advertised to docked clients via
  23. _NET_SYSTEM_TRAY_ICON_SIZE and the size of the parent windows created
  24. in add_icon(), both of which read systray.icon_size.
  25. ---
  26. src/systray/systraybar.c | 2 +-
  27.  1 file changed, 1 insertion(+), 1 deletion(-)
  28.  
  29. diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c
  30. --- a/src/systray/systraybar.c
  31. +++ b/src/systray/systraybar.c
  32. @@ -152,7 +152,7 @@ void systray_get_geometry(int *size)
  33.                      - 2 * systray.area.paddingy * scale;
  34.      if (systray_max_icon_size)
  35. -        icon_size = MIN( icon_size, systray_max_icon_size * scale);
  36. +        icon_size = systray.icon_size = MIN( icon_size, systray_max_icon_size * scale);
  37.  
  38.      int count = 0;
  39.  
Advertisement
Add Comment
Please, Sign In to add comment