From 364a5b968158d0dc8d7bb1da2172fee00417c2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Mon, 29 Jun 2026 19:09:28 +0300 Subject: [PATCH] CTabFolder overlap calculations change Update chevron image before deciding visible tabs so size reservations are correct. --- .../common/org/eclipse/swt/custom/CTabFolder.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java index 618d42f4215..1e61652cef8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java @@ -2678,7 +2678,7 @@ int getChevronCount() { private void updateChevronImage(boolean styleChange) { if (styleChange && chevronImage == null) return; int newCount = getChevronCount(); - if (!styleChange && chevronCount == newCount) return; + if (!styleChange && chevronImage != null && chevronCount == newCount) return; if (chevronImage != null) chevronImage.dispose(); chevronImage = createButtonImage(getDisplay(), CTabFolderRenderer.PART_CHEVRON_BUTTON); chevronItem.setImage(chevronImage); @@ -3999,6 +3999,15 @@ boolean updateItems (int showIndex) { changed |= setItemSize(gc); } } + if (showChevron) { + // Give the chevron its image (and thus its real preferred size) before + // setItemLocation decides how many tabs are showing. Both setItemLocation + // and computeControlBounds reserve space for the chevron via + // getRightItemEdge(); an image-less chevron measures much smaller than the + // final one, which would let an extra tab remain visible and make the + // chevron overlap the trailing controls (e.g. the min/max toolbar). + updateChevronImage(false); + } changed |= setItemLocation(gc); setButtonBounds(); changed |= chevronChanged;