@@ -132,7 +132,9 @@ Rectangle getBoundsInPixels () {
132
132
if (width == 0 ) {
133
133
int [] buffer = new int [1 ];
134
134
if (OS .SystemParametersInfo (OS .SPI_GETCARETWIDTH , 0 , buffer , 0 )) {
135
- return new Rectangle (getXInPixels (), getYInPixels (), buffer [0 ], getHeightInPixels ());
135
+ int width = DPIUtil .pixelToPoint (buffer [0 ], Display .getPrimaryMonitorZoomAtStartup ());
136
+ int widthInPixels = Win32DPIUtils .pointToPixel (width , getNativeZoom ());
137
+ return new Rectangle (getXInPixels (), getYInPixels (), widthInPixels , getHeightInPixels ());
136
138
}
137
139
}
138
140
return new Rectangle (getXInPixels (), getYInPixels (), getWidthInPixels (), getHeightInPixels ());
@@ -226,7 +228,9 @@ Point getSizeInPixels () {
226
228
if (width == 0 ) {
227
229
int [] buffer = new int [1 ];
228
230
if (OS .SystemParametersInfo (OS .SPI_GETCARETWIDTH , 0 , buffer , 0 )) {
229
- return new Point (buffer [0 ], getHeightInPixels ());
231
+ int width = DPIUtil .pixelToPoint (buffer [0 ], Display .getPrimaryMonitorZoomAtStartup ());
232
+ int widthInPixels = Win32DPIUtils .pointToPixel (width , getNativeZoom ());
233
+ return new Point (widthInPixels , getHeightInPixels ());
230
234
}
231
235
}
232
236
return new Point (getWidthInPixels (), getHeightInPixels ());
@@ -370,7 +374,8 @@ void resize () {
370
374
if (image == null && widthInPixels == 0 ) {
371
375
int [] buffer = new int [1 ];
372
376
if (OS .SystemParametersInfo (OS .SPI_GETCARETWIDTH , 0 , buffer , 0 )) {
373
- widthInPixels = buffer [0 ];
377
+ int width = DPIUtil .pixelToPoint (buffer [0 ], Display .getPrimaryMonitorZoomAtStartup ());
378
+ widthInPixels = Win32DPIUtils .pointToPixel (width , getNativeZoom ());
374
379
}
375
380
}
376
381
OS .CreateCaret (hwnd , hBitmap , widthInPixels , getHeightInPixels ());
@@ -449,7 +454,8 @@ void setFocus () {
449
454
if (image == null && widthInPixels == 0 ) {
450
455
int [] buffer = new int [1 ];
451
456
if (OS .SystemParametersInfo (OS .SPI_GETCARETWIDTH , 0 , buffer , 0 )) {
452
- widthInPixels = buffer [0 ];
457
+ int width = DPIUtil .pixelToPoint (buffer [0 ], Display .getPrimaryMonitorZoomAtStartup ());
458
+ widthInPixels = Win32DPIUtils .pointToPixel (width , getNativeZoom ());
453
459
}
454
460
}
455
461
OS .CreateCaret (hwnd , hBitmap , widthInPixels , getHeightInPixels ());
0 commit comments