Skip to content

Commit 9164303

Browse files
ShahzaibIbrahimfedejeanne
authored andcommitted
Remove the SORT_WIDTH spacing logic in Table 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 d39363c commit 9164303

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public class Table extends Composite {
9595
static /*final*/ long HeaderProc;
9696
static final int INSET = 4;
9797
static final int GRID_WIDTH = 1;
98-
static final int SORT_WIDTH = 10;
9998
static final int HEADER_MARGIN = 12;
10099
static final int HEADER_EXTRA = 3;
101100
static final int VISTA_EXTRA = 2;

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -408,14 +408,10 @@ public void pack () {
408408
int headerWidth = (int)OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer) + Table.HEADER_MARGIN;
409409
if (OS.IsAppThemed ()) headerWidth += Table.HEADER_EXTRA;
410410
boolean hasHeaderImage = false;
411-
if (image != null || parent.sortColumn == this) {
411+
if (image != null) {
412412
hasHeaderImage = true;
413-
if (parent.sortColumn == this && parent.sortDirection != SWT.NONE) {
414-
headerWidth += Win32DPIUtils.pointToPixel(Table.SORT_WIDTH, getZoom());
415-
} else if (image != null) {
416-
Rectangle bounds = Win32DPIUtils.pointToPixel(image.getBounds(), getZoom());
417-
headerWidth += bounds.width;
418-
}
413+
Rectangle bounds = Win32DPIUtils.pointToPixel(image.getBounds(), getZoom());
414+
headerWidth += bounds.width;
419415
long hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);
420416
int margin = (int)OS.SendMessage (hwndHeader, OS.HDM_GETBITMAPMARGIN, 0, 0);
421417
headerWidth += margin * 4;

0 commit comments

Comments
 (0)