Skip to content

Conversation

ShahzaibIbrahim
Copy link
Contributor

@ShahzaibIbrahim ShahzaibIbrahim commented Sep 9, 2025

This snippet demonstrates several ways to construct and use cursors in an SWT application, including system cursors, custom image cursors, and DPI-aware cursors using ImageDataProvider. The user interface allows interactive selection of the cursor construction method, and updates the shell’s cursor in real time based on the current choice. The snippet displays the current system zoom level (DPI) and the expected cursor size, and draws reference ticks to help visualize scaling effects. It also responds to system DPI changes, ensuring accurate display and behavior at different zoom levels. The code is structured for clarity and modularity, making it suitable for direct use with the SWT Snippet Explorer.

Preview

image

@ShahzaibIbrahim ShahzaibIbrahim linked an issue Sep 9, 2025 that may be closed by this pull request
Copy link
Contributor

github-actions bot commented Sep 9, 2025

Test Results

   546 files  ±0     546 suites  ±0   41m 39s ⏱️ + 9m 23s
 4 431 tests ±0   4 410 ✅  - 4   17 💤 ±0  4 ❌ +4 
16 764 runs  ±0  16 633 ✅  - 4  127 💤 ±0  4 ❌ +4 

For more details on these failures, see this check.

Results for commit 2445626. ± Comparison against base commit 508ad4a.

♻️ This comment has been updated with latest results.

@ShahzaibIbrahim ShahzaibIbrahim force-pushed the master-437 branch 2 times, most recently from aaa9b2a to c1b8100 Compare September 11, 2025 11:37
Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the snippet looks good and is really helpful for testing. I have few comments on potentialy flaws and OS-specifics, and some more rather nitpicky ones on code style.

@ShahzaibIbrahim ShahzaibIbrahim force-pushed the master-437 branch 2 times, most recently from 3eb4eba to 5e7f5e7 Compare September 15, 2025 11:16
@ShahzaibIbrahim
Copy link
Contributor Author

@HeikoKlare I have addressed all the comments, also made some UI improvements and it is now ready for review.

Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the for a snippet the code is okay now. Please auto-format the code as it does currently not conform to the auto-formatting settings. I have some minor proposals for improvement, which you could also apply with the formatting.

As the snippet perfectly shows the wrong cursor size when using the (Device, ImageData, ImageData, int, int) constructor: do we already have a ticket for analyzing/improving that?

@ShahzaibIbrahim
Copy link
Contributor Author

As the snippet perfectly shows the wrong cursor size when using the (Device, ImageData, ImageData, int, int) constructor: do we already have a ticket for analyzing/improving that?

I already have a ticket for that. See, vi-eclipse/Eclipse-Platform#441

This snippet demonstrates several ways to construct and use cursors in
an SWT application, including system cursors, custom image cursors, and
DPI-aware cursors using ImageDataProvider. The user interface allows
interactive selection of the cursor construction method, and updates the
shell’s cursor in real time based on the current choice. The snippet
displays the current system zoom level (DPI) and the expected cursor
size, and draws reference ticks to help visualize scaling effects. It
also responds to system DPI changes, ensuring accurate display and
behavior at different zoom levels. The code is structured for clarity
and modularity, making it suitable for direct use with the SWT Snippet
Explorer.
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.

Create snippet for cursor testing
3 participants