Skip to content

Conversation

ShahzaibIbrahim
Copy link
Contributor

The value in the registry for CursorBaseSize is not always divisible by 32, so integer division was causing loss of precision in pointer scaling. This commit changes getPointerSizeScaleFactor() to return a float using floating-point division, and ensures all usages of this method in Cursor.java handle the scale as a float. The float is then cast to int only when calling DPIUtil.scaleImageData, which only accepts integer zoom values. This preserves as much precision as possible and avoids rounding errors in pointer scaling for accessibility settings.

Description
Recently I commited: 6e4241d, where we read the cursor size value from accessibility setting of windows. I assumed that each value is multiple of 32 which was wrong.

Here for the cursor size 4 is 80
Image

Image

and my method will return 2 (i assumed it should return 4). Changing it to float will return us 2.4 which is more precise when trying to scale up the size.

The value in the registry for CursorBaseSize is not always divisible by
32, so integer division was causing loss of precision in pointer
scaling. This commit changes getPointerSizeScaleFactor() to return a
float using floating-point division, and ensures all usages of this
method in Cursor.java handle the scale as a float. The float is then
cast to int only when calling DPIUtil.scaleImageData, which only accepts
integer zoom values. This preserves as much precision as possible and
avoids rounding errors in pointer scaling for accessibility settings.
@ShahzaibIbrahim
Copy link
Contributor Author

Test failures are unrelated: #2516

Copy link
Contributor

Test Results

  115 files   -  3    115 suites   - 3   7m 44s ⏱️ - 5m 56s
4 544 tests  - 37  4 525 ✅  - 35  15 💤  - 2  4 ❌ ±0 
  312 runs   - 18    305 ✅  - 17   3 💤  - 1  4 ❌ ±0 

For more details on these failures, see this check.

Results for commit 9d0c24a. ± Comparison against base commit 60de8f9.

This pull request removes 37 tests.
AllGTKTests Test_GtkConverter ‑ test_HeuristicASCII_dollarSign
AllGTKTests Test_GtkConverter ‑ test_HeuristicASCII_emptyString
AllGTKTests Test_GtkConverter ‑ test_HeuristicASCII_letterA
AllGTKTests Test_GtkConverter ‑ test_HeuristicASCII_letters
AllGTKTests Test_GtkConverter ‑ test_HeuristicUTF16LE_null
AllGTKTests Test_GtkConverter ‑ test_HeuristicUTF16_AsciiLetters
AllGTKTests Test_GtkConverter ‑ test_HeuristicUTF16_Asciiletter
AllGTKTests Test_GtkConverter ‑ test_HeuristicUTF16_LotsOfLetters
AllGTKTests Test_GtkConverter ‑ test_HeuristicUTF16_letter
AllGTKTests Test_GtkConverter ‑ test_HeuristicUTF16_letters
…

@fedejeanne
Copy link
Member

Test failures are unrelated

@fedejeanne fedejeanne merged commit c3cebe8 into eclipse-platform:master Sep 30, 2025
14 of 17 checks passed
@fedejeanne fedejeanne deleted the master-mouse-pointer branch September 30, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update getPointerSizeScaleFactor to return float value in order to avoid loosing precision
2 participants