From b73e167b67d4f88cb501a99b21405cf2e459b020 Mon Sep 17 00:00:00 2001 From: "shahzaib.ibrahim" Date: Thu, 2 May 2024 17:07:30 +0200 Subject: [PATCH] Ticket#39: Adapt GetSystemMetrics call to be DPI dependent Using GetSystemMetrics method in Combo, Table and list to make them DPI dependent vi-eclipse/Eclipse-Platform#39 --- .../Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java | 8 ++++---- .../Eclipse SWT/win32/org/eclipse/swt/widgets/List.java | 4 ++-- .../Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java index 5317e5c9368..3d66cdb25de 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java @@ -655,8 +655,8 @@ public void clearSelection () { width += pcbi.itemLeft + (pcbi.buttonRight - pcbi.buttonLeft); height = (pcbi.buttonBottom - pcbi.buttonTop) + pcbi.buttonTop * 2; } else { - int border = OS.GetSystemMetrics (OS.SM_CXEDGE); - width += OS.GetSystemMetrics (OS.SM_CXVSCROLL) + border * 2; + int border = getSystemMetrics (OS.SM_CXEDGE); + width += getSystemMetrics (OS.SM_CXVSCROLL) + border * 2; int textHeight = (int)OS.SendMessage (handle, OS.CB_GETITEMHEIGHT, -1, 0); if ((style & SWT.DROP_DOWN) != 0) { height = textHeight + 6; @@ -665,7 +665,7 @@ public void clearSelection () { } } if ((style & SWT.SIMPLE) != 0 && (style & SWT.H_SCROLL) != 0) { - height += OS.GetSystemMetrics (OS.SM_CYHSCROLL); + height += getSystemMetrics (OS.SM_CYHSCROLL); } return new Point (width, height); } @@ -2188,7 +2188,7 @@ void setScrollWidth (int scrollWidth) { OS.SendMessage (handle, OS.CB_SETDROPPEDWIDTH, 0, 0); OS.SendMessage (handle, OS.CB_SETHORIZONTALEXTENT, scrollWidth, 0); } else { - scrollWidth += OS.GetSystemMetrics (OS.SM_CYHSCROLL); + scrollWidth += getSystemMetrics (OS.SM_CYHSCROLL); OS.SendMessage (handle, OS.CB_SETDROPPEDWIDTH, scrollWidth, 0); OS.SendMessage (handle, OS.CB_SETHORIZONTALEXTENT, 0, 0); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java index 63d9d090161..c5cd8ea1a3b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java @@ -260,10 +260,10 @@ static int checkStyle (int style) { width += border * 2 + INSET; height += border * 2; if ((style & SWT.V_SCROLL) != 0) { - width += OS.GetSystemMetrics (OS.SM_CXVSCROLL); + width += getSystemMetrics (OS.SM_CXVSCROLL); } if ((style & SWT.H_SCROLL) != 0) { - height += OS.GetSystemMetrics (OS.SM_CYHSCROLL); + height += getSystemMetrics (OS.SM_CYHSCROLL); } return new Point (width, height); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java index f4739b8b6f6..a641afc610b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java @@ -1479,10 +1479,10 @@ public void clearAll () { int border = getBorderWidthInPixels (); width += border * 2; height += border * 2; if ((style & SWT.V_SCROLL) != 0) { - width += OS.GetSystemMetrics (OS.SM_CXVSCROLL); + height += getSystemMetrics (OS.SM_CYHSCROLL); } if ((style & SWT.H_SCROLL) != 0) { - height += OS.GetSystemMetrics (OS.SM_CYHSCROLL); + height += getSystemMetrics (OS.SM_CYHSCROLL); } return new Point (width, height); }