@@ -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 }
@@ -682,6 +682,7 @@ private static void handleDPIChange(Widget widget, int newZoom, float scalingFac
682682 if (caret .font != null ) {
683683 caret .setFont (caret .font );
684684 }
685+ caret .resize ();
685686}
686687}
687688
0 commit comments