Skip to content

Commit 2d95f10

Browse files
ShahzaibIbrahimakoch-yatta
authored andcommitted
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 3f52224 commit 2d95f10

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
@@ -401,8 +401,8 @@ public void pack () {
401401
long hwnd = parent.handle;
402402
int oldWidth = (int)OS.SendMessage (hwnd, OS.LVM_GETCOLUMNWIDTH, index, 0);
403403
TCHAR buffer = new TCHAR (parent.getCodePage (), text, true);
404-
int headerWidth = (int)OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer) + Table.HEADER_MARGIN;
405-
if (OS.IsAppThemed ()) headerWidth += Table.HEADER_EXTRA;
404+
int headerWidth = (int) (OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer) + Win32DPIUtils.pointToPixel(Table.HEADER_MARGIN, getZoom()));
405+
if (OS.IsAppThemed ()) headerWidth += Win32DPIUtils.pointToPixel(Table.HEADER_EXTRA, getZoom());
406406
boolean hasHeaderImage = false;
407407
if (image != null) {
408408
hasHeaderImage = true;

0 commit comments

Comments
 (0)