Skip to content

Commit f878858

Browse files
ShahzaibIbrahimakoch-yatta
authored andcommitted
Scale Table.EXPLORER_EXTRA by zoom level instead of using fixed pixels
The Table.VISTA_EXTRA and Table.EXPLORER_EXTRA constants specify additional spacing applied to table items when using the Vista or Explorer themes. 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 VISTA_EXTRA and EXPLORER_EXTRA in points and converts them to pixels based on the current zoom level, ensuring consistent spacing for themed table items across different display scales.
1 parent de3812d commit f878858

File tree

1 file changed

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

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3545,6 +3545,7 @@ void sendEraseItemEvent (TableItem item, NMLVCUSTOMDRAW nmcd, long lParam, Event
35453545
boolean backgroundWanted = !ignoreDrawHot || drawDrophilited || (!ignoreDrawSelection && clrSelectionBk != -1);
35463546

35473547
if (backgroundWanted) {
3548+
int explorerExtraInPixels = Win32DPIUtils.pointToPixel(EXPLORER_EXTRA, getZoom());
35483549
RECT pClipRect = new RECT ();
35493550
OS.SetRect (pClipRect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
35503551
RECT rect = new RECT ();
@@ -3561,10 +3562,10 @@ void sendEraseItemEvent (TableItem item, NMLVCUSTOMDRAW nmcd, long lParam, Event
35613562
OS.MapWindowPoints (hwndHeader, handle, headerRect, 2);
35623563
rect.left = headerRect.left;
35633564
pClipRect.left = cellRect.left;
3564-
pClipRect.right += EXPLORER_EXTRA;
3565+
pClipRect.right += explorerExtraInPixels;
35653566
} else {
3566-
rect.right += EXPLORER_EXTRA;
3567-
pClipRect.right += EXPLORER_EXTRA;
3567+
rect.right += explorerExtraInPixels;
3568+
pClipRect.right += explorerExtraInPixels;
35683569
}
35693570
long hTheme = OS.OpenThemeData (handle, Display.TREEVIEW, getZoom());
35703571
int iStateId = selected ? OS.LISS_SELECTED : OS.LISS_HOT;
@@ -4880,7 +4881,7 @@ boolean setScrollWidth (TableItem item, boolean force) {
48804881
*/
48814882
newWidth++;
48824883
}
4883-
newWidth += INSET * 2 + VISTA_EXTRA;
4884+
newWidth += INSET * 2 + Win32DPIUtils.pointToPixel(VISTA_EXTRA, getZoom());
48844885
int oldWidth = (int)OS.SendMessage (handle, OS.LVM_GETCOLUMNWIDTH, 0, 0);
48854886
if (newWidth > oldWidth) {
48864887
setScrollWidth (newWidth);

0 commit comments

Comments
 (0)