Skip to content

Commit ca5e3a8

Browse files
Scale Table.HEADER_MARGIN by zoom level instead of using fixed pixels
The Table.HEADER_MARGIN constant defines the extra fixed-width spacing for table headers, while the Table.HEADER_EXTRA constant specifies the additional spacing applied to the header area. Previously, both were defined as fixed pixel values, which worked at 100% zoom but did not scale properly on high-DPI monitors. This change redefines HEADER_MARGIN and HEADER_EXTRA in points and converts them to pixels based on the current zoom level, ensuring consistent header spacing across different display scales.
1 parent d5dc661 commit ca5e3a8

File tree

1 file changed

+2
-2
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ public void pack () {
405405
long hwnd = parent.handle;
406406
int oldWidth = (int)OS.SendMessage (hwnd, OS.LVM_GETCOLUMNWIDTH, index, 0);
407407
TCHAR buffer = new TCHAR (parent.getCodePage (), text, true);
408-
int headerWidth = (int)OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer) + Table.HEADER_MARGIN;
409-
if (OS.IsAppThemed ()) headerWidth += Table.HEADER_EXTRA;
408+
int headerWidth = (int)OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer) + Win32DPIUtils.pointToPixel(Table.HEADER_MARGIN, getZoom());
409+
if (OS.IsAppThemed ()) headerWidth += Win32DPIUtils.pointToPixel(Table.HEADER_EXTRA, getZoom());
410410
boolean hasHeaderImage = false;
411411
if (image != null || parent.sortColumn == this) {
412412
hasHeaderImage = true;

0 commit comments

Comments
 (0)