Skip to content

Commit f7ba974

Browse files
Remove the additional SORT_WIDTH spacing logic in Tree column rendering.
Since Windows 7, the sort indicator in tree columns is rendered above the column header text, whereas in Windows XP it was placed next to the text. The original SWT implementation added extra pixels (SORT_WIDTH) to the column width to make space for the indicator.
1 parent f6de513 commit f7ba974

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ public class Tree extends Composite {
114114
static final int TIMER_MAX_COUNT = 8;
115115
static final int INSET = 3;
116116
static final int GRID_WIDTH = 1;
117-
static final int SORT_WIDTH = 10;
118117
static final int HEADER_MARGIN = 12;
119118
static final int HEADER_EXTRA = 3;
120119
static final int INCREMENT = 5;

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -377,17 +377,9 @@ public void pack () {
377377
OS.DrawText (hDC, buffer, buffer.length, rect, flags);
378378
int headerWidth = rect.right - rect.left + Tree.HEADER_MARGIN;
379379
if (OS.IsAppThemed ()) headerWidth += Tree.HEADER_EXTRA;
380-
if (image != null || parent.sortColumn == this) {
381-
Image headerImage = null;
382-
if (parent.sortColumn == this && parent.sortDirection != SWT.NONE) {
383-
headerWidth += Tree.SORT_WIDTH;
384-
} else {
385-
headerImage = image;
386-
}
387-
if (headerImage != null) {
388-
Rectangle bounds = Win32DPIUtils.pointToPixel(headerImage.getBounds(), getZoom());
389-
headerWidth += bounds.width;
390-
}
380+
if (image != null) {
381+
Rectangle bounds = Win32DPIUtils.pointToPixel(image.getBounds(), getZoom());
382+
headerWidth += bounds.width;
391383
int margin = 0;
392384
if (hwndHeader != 0) {
393385
margin = (int)OS.SendMessage (hwndHeader, OS.HDM_GETBITMAPMARGIN, 0, 0);

0 commit comments

Comments
 (0)