Skip to content

Commit fc0098c

Browse files
amartya4256HeikoKlare
authored andcommitted
Removed and replaced autoScaleUpUsingNativeDPI
This commit replaces the DPIUtil.autoScaleUpUsingNativeDPI calls from clients in win32 with DPIUtil.scaleUp utilizing the zoom available within the clients. It additionally removes the method DPIUtil.autoScaleUpUsingNativeDPI since it's not used anymore. contributes to #62 and #127
1 parent c66545b commit fc0098c

File tree

5 files changed

+4
-13
lines changed

5 files changed

+4
-13
lines changed

bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -393,15 +393,6 @@ public static int scaleUp(int size, int zoom) {
393393
return Math.round (size * scaleFactor);
394394
}
395395

396-
/**
397-
* Auto-scale up int dimensions using Native DPI
398-
*/
399-
public static int autoScaleUpUsingNativeDPI (int size) {
400-
if (nativeDeviceZoom == 100 || size == SWT.DEFAULT) return size;
401-
float nativeScaleFactor = nativeDeviceZoom / 100f;
402-
return Math.round (size * nativeScaleFactor);
403-
}
404-
405396
/**
406397
* Auto-scale up int dimensions if enabled for Drawable class.
407398
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ private int getCheckboxTextOffset(long hdc) {
13141314
OS.GetThemePartSize(display.hButtonTheme(), hdc, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, null, OS.TS_TRUE, size);
13151315
result += size.cx;
13161316
} else {
1317-
result += DPIUtil.autoScaleUpUsingNativeDPI(13);
1317+
result += DPIUtil.scaleUp(13, nativeZoom);
13181318
}
13191319

13201320
// Windows uses half width of '0' as checkbox-to-text distance.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ LRESULT wmMeasureChild (long wParam, long lParam) {
11611161
* NOTE: autoScaleUpUsingNativeDPI() is used to avoid problems
11621162
* with applications that disable automatic scaling.
11631163
*/
1164-
struct.itemWidth = DPIUtil.autoScaleUpUsingNativeDPI(5);
1164+
struct.itemWidth = DPIUtil.scaleUp(5, nativeZoom);
11651165
OS.MoveMemory (lParam, struct, MEASUREITEMSTRUCT.sizeof);
11661166
return null;
11671167
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6915,7 +6915,7 @@ LRESULT wmNotifyHeader (NMHDR hdr, long wParam, long lParam) {
69156915
* Sort indicator size needs to scale as per the Native Windows OS DPI level
69166916
* when header is custom drawn. For more details refer bug 537097.
69176917
*/
6918-
int leg = DPIUtil.autoScaleUpUsingNativeDPI(3);
6918+
int leg = DPIUtil.scaleUp(3, nativeZoom);
69196919
if (sortDirection == SWT.UP) {
69206920
OS.Polyline(nmcd.hdc, new int[] {center-leg, 1+leg, center+1, 0}, 2);
69216921
OS.Polyline(nmcd.hdc, new int[] {center+leg, 1+leg, center-1, 0}, 2);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7884,7 +7884,7 @@ LRESULT wmNotifyHeader (NMHDR hdr, long wParam, long lParam) {
78847884
* Sort indicator size needs to scale as per the Native Windows OS DPI level
78857885
* when header is custom drawn. For more details refer bug 537097.
78867886
*/
7887-
int leg = DPIUtil.autoScaleUpUsingNativeDPI(3);
7887+
int leg = DPIUtil.scaleUp(3, nativeZoom);
78887888
if (sortDirection == SWT.UP) {
78897889
OS.Polyline(nmcd.hdc, new int[] {center-leg, 1+leg, center+1, 0}, 2);
78907890
OS.Polyline(nmcd.hdc, new int[] {center+leg, 1+leg, center-1, 0}, 2);

0 commit comments

Comments
 (0)