Skip to content

Commit ee0fdb8

Browse files
committed
Do not use DPIUtil.getNativeDeviceZoom() to get the cursor handle #2057
Pass the native zoom to Cursor.win32_getHandle(Cursor, int) instead Fixes #2057
1 parent d675f85 commit ee0fdb8

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,12 @@ public Cursor(Device device, ImageData source, int hotspotX, int hotspotY) {
355355
* Get the handle for a cursor given a zoom level.
356356
*
357357
* @param cursor the cursor
358+
* @param zoom zoom level (in %) of the monitor the cursor is currently in.
358359
* @return The handle of the cursor.
359360
*
360361
* @noreference This method is not intended to be referenced by clients.
361362
*/
362-
public static Long win32_getHandle (Cursor cursor) {
363-
// The size of the cursor should match the zoom of the current monitor
364-
int zoom = DPIUtil.getNativeDeviceZoom();
363+
public static Long win32_getHandle (Cursor cursor, int zoom) {
365364
if (cursor.isDisposed()) {
366365
return cursor.handle;
367366
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5475,7 +5475,7 @@ LRESULT WM_SETCURSOR (long wParam, long lParam) {
54755475
if (control == null) return null;
54765476
Cursor cursor = control.findCursor ();
54775477
if (cursor != null) {
5478-
OS.SetCursor (Cursor.win32_getHandle(cursor));
5478+
OS.SetCursor (Cursor.win32_getHandle(cursor, getNativeZoom()));
54795479
return LRESULT.ONE;
54805480
}
54815481
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2659,7 +2659,7 @@ LRESULT WM_SETCURSOR (long wParam, long lParam) {
26592659
RECT rect = new RECT ();
26602660
OS.GetClientRect (handle, rect);
26612661
if (OS.PtInRect (rect, pt)) {
2662-
OS.SetCursor (Cursor.win32_getHandle(cursor));
2662+
OS.SetCursor (Cursor.win32_getHandle(cursor, getNativeZoom()));
26632663
switch (msg) {
26642664
case OS.WM_LBUTTONDOWN:
26652665
case OS.WM_RBUTTONDOWN:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ public void setCursor(Cursor newCursor) {
823823
checkWidget();
824824
clientCursor = newCursor;
825825
if (newCursor != null) {
826-
if (inEvent) OS.SetCursor (Cursor.win32_getHandle(clientCursor));
826+
if (inEvent) OS.SetCursor (Cursor.win32_getHandle(clientCursor, getNativeZoom()));
827827
}
828828
}
829829

@@ -892,7 +892,7 @@ long transparentProc (long hwnd, long msg, long wParam, long lParam) {
892892
break;
893893
case OS.WM_SETCURSOR:
894894
if (clientCursor != null) {
895-
OS.SetCursor (Cursor.win32_getHandle(clientCursor));
895+
OS.SetCursor (Cursor.win32_getHandle(clientCursor, getNativeZoom()));
896896
return 1;
897897
}
898898
if (resizeCursor != 0) {

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
@@ -4663,7 +4663,7 @@ void setCursor () {
46634663
* is IDC_ARROW.
46644664
*/
46654665
Cursor cursor = findCursor ();
4666-
long hCursor = cursor == null ? OS.LoadCursor (0, OS.IDC_ARROW) : Cursor.win32_getHandle(cursor);
4666+
long hCursor = cursor == null ? OS.LoadCursor (0, OS.IDC_ARROW) : Cursor.win32_getHandle(cursor, getNativeZoom());
46674667
OS.SetCursor (hCursor);
46684668
}
46694669

0 commit comments

Comments
 (0)