Skip to content

Commit 92eaae8

Browse files
ShahzaibIbrahimakoch-yatta
authored andcommitted
Scale Tree.HEADER_MARGIN by zoom level instead of using fixed pixels
The Tree.HEADER_MARGIN constant defines extra fixed-width spacing for tree headers. Previously, this was a fixed pixel value, which worked at 100% zoom but did not scale properly on high-DPI monitors. This change redefines HEADER_MARGIN in points and converts it to pixels based on the current zoom level, ensuring consistent header spacing across different display scales.
1 parent eb0f6a6 commit 92eaae8

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/TreeColumn.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,8 @@ public void pack () {
375375
int flags = OS.DT_CALCRECT | OS.DT_NOPREFIX;
376376
char [] buffer = text.toCharArray ();
377377
OS.DrawText (hDC, buffer, buffer.length, rect, flags);
378-
int headerWidth = rect.right - rect.left + Tree.HEADER_MARGIN;
379-
if (OS.IsAppThemed ()) headerWidth += Tree.HEADER_EXTRA;
378+
int headerWidth = rect.right - rect.left + Win32DPIUtils.pointToPixel(Tree.HEADER_MARGIN, getZoom());
379+
if (OS.IsAppThemed ()) headerWidth += Win32DPIUtils.pointToPixel(Tree.HEADER_EXTRA, getZoom());
380380
if (image != null || parent.sortColumn == this) {
381381
Image headerImage = null;
382382
if (parent.sortColumn == this && parent.sortDirection != SWT.NONE) {

0 commit comments

Comments
 (0)