Skip to content

Commit e13d50f

Browse files
committed
Use SystemParametersInfoForDpi in Caret win32 #62
This commit adds the usage of the new API SystemParametersInfoForDpi in Caret for resizing the caret and other places. contributes to #62 and #128
1 parent 51f7439 commit e13d50f

File tree

1 file changed

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

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Rectangle getBoundsInPixels () {
131131
}
132132
if (width == 0) {
133133
int [] buffer = new int [1];
134-
if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) {
134+
if (OS.SystemParametersInfoForDpi (OS.SPI_GETCARETWIDTH, 0, buffer, 0, DPIUtil.mapZoomToDPI(getNativeZoom()))) {
135135
return new Rectangle (getXInPixels(), getYInPixels(), buffer [0], getHeightInPixels());
136136
}
137137
}
@@ -225,7 +225,7 @@ Point getSizeInPixels () {
225225
}
226226
if (width == 0) {
227227
int [] buffer = new int [1];
228-
if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) {
228+
if (OS.SystemParametersInfoForDpi (OS.SPI_GETCARETWIDTH, 0, buffer, 0, DPIUtil.mapZoomToDPI(getNativeZoom()))) {
229229
return new Point (buffer [0], getHeightInPixels());
230230
}
231231
}
@@ -369,7 +369,7 @@ void resize () {
369369
int widthInPixels = this.getWidthInPixels();
370370
if (image == null && widthInPixels == 0) {
371371
int [] buffer = new int [1];
372-
if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) {
372+
if (OS.SystemParametersInfoForDpi (OS.SPI_GETCARETWIDTH, 0, buffer, 0, DPIUtil.mapZoomToDPI(getNativeZoom()))) {
373373
widthInPixels = buffer [0];
374374
}
375375
}
@@ -448,7 +448,7 @@ void setFocus () {
448448
int widthInPixels = this.getWidthInPixels();
449449
if (image == null && widthInPixels == 0) {
450450
int [] buffer = new int [1];
451-
if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) {
451+
if (OS.SystemParametersInfoForDpi (OS.SPI_GETCARETWIDTH, 0, buffer, 0, DPIUtil.mapZoomToDPI(getNativeZoom()))) {
452452
widthInPixels = buffer [0];
453453
}
454454
}

0 commit comments

Comments
 (0)