Commit 4ab4e5c
committed
Adjusted computation of horizontal toolbar size.
The first part ensures the toolbar becomes tall enough to fit controls
like Combo or Text, whose height is often larger than the native toolbar
button height returned by TB_GETITEMRECT. Without this check, the
toolbar height is based only on Windows’ button metrics, which are
smaller, causing embedded controls to be clipped. By taking the max of
the toolbar height and each control’s actual height, the final toolbar
size always accommodates the tallest embedded control.
In the second part, the original code centered the control vertically,
but when the control (like a combo box) was taller than the toolbar item
height, the centering calculation produced a negative offset, shifting
the control upward and causing clipping. Your fix uses Math.max(0, …) to
prevent negative offsets, ensuring the control is never positioned above
the item’s top. As a result, taller controls are aligned safely without
being cut off.1 parent 833d748 commit 4ab4e5c
File tree
2 files changed
+7
-1
lines changed- bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets
2 files changed
+7
-1
lines changedLines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
258 | 264 | | |
259 | 265 | | |
260 | 266 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
586 | | - | |
| 586 | + | |
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
| |||
0 commit comments