Skip to content

Conversation

ShahzaibIbrahim
Copy link
Contributor

Cursor(Device, ImageData, ImageData, int, int) was deprecated recently which is still used in some of the snippets testing that exact constructor. That's why the warnings are being suppressed.

Cursor(Device, ImageData, ImageData, int, int) was deprecated recently
which is still used in some of the snippets testing that exact
constructor. That's why the warnings are being suppressed.
@akurtakov
Copy link
Member

Would you please migrate the snippets to the new way ? This is the place where people using SWT should come to see how things are used so showing them these deprecated APIs is counterproductive.

Copy link
Contributor

github-actions bot commented Oct 9, 2025

Test Results

  115 files  ±0    115 suites  ±0   11m 18s ⏱️ -28s
4 546 tests ±0  4 530 ✅ ±0  16 💤 ±0  0 ❌ ±0 
  311 runs  ±0    308 ✅ ±0   3 💤 ±0  0 ❌ ±0 

Results for commit ae9d15f. ± Comparison against base commit 3a013ef.

@ShahzaibIbrahim
Copy link
Contributor Author

@akurtakov we recently implemented Snippet386 covering all kind of Cursors. Also Snippet92 was to show how this specific cursor with source and mask should work. We either remove it completely but I don't see the reason to migrate it to new way since we already have example in Snippet386 for others.

@fedejeanne
Copy link
Member

I'm with Alex on this one: why show the deprecated constructor in the snippets in the first place? It's not like we want new users to learn how to use a deprecated constructor.

Instead, I would:

  • Remove the 1st option (usage of deprecated constructor) from Snippet386
  • Delete Snippet92

One other detail: I just noticed that there is no explanation as to why has the constructor been deprecated (no linked GH issue either). That would be a nice addition to the JavaDocs, don't you think?

@fedejeanne
Copy link
Member

One other detail: I just noticed that there is no explanation as to why has the constructor been deprecated (no linked GH issue either). That would be a nice addition to the JavaDocs, don't you think?

To answer my own question: there's the commit message

image

... so we're good, no more "nice additions" required :-)

@HeikoKlare
Copy link
Contributor

Snippet92 may be migrated by integrating the mask data into the the source image data. The it would still reflect the source + mask use case.

For Snippet386 it does not really make sense to migrate something as that snippet shows the behavior of all constructors in comparison. And in my opinion it's still valuable to the deprecated constructor in there in case someone wants to compare those behaviors, e.g., because they still use separate image and mask files and want to compare differences or the like.

@ShahzaibIbrahim
Copy link
Contributor Author

I would then like to remove the Snippet92 completely. Since we have enough (~3) snippets covering how the constructor with source data only works.

@HeikoKlare
Copy link
Contributor

I would then like to remove the Snippet92 completely. Since we have enough (~3) snippets covering how the constructor with source data only works.

Okay, can you please point to the one that shows how to create cursor with source + mask based on the single-ImageData constructor?

@ShahzaibIbrahim
Copy link
Contributor Author

Okay, can you please point to the one that shows how to create cursor with source + mask based on the single-ImageData constructor?

In Snippet119, reflecting source + mask based on the single-ImageData constructor.

See,

ImageData sourceData = new ImageData (16, 16, 4, palette, 1, srcData);
//Create a mask ImageData of depth 1 (monochrome)
palette = new PaletteData (black.getRGB(), white.getRGB());
ImageData maskData = new ImageData (16, 16, 1, palette, 1, mskData);
//Set mask
sourceData.maskData = maskData.data;
sourceData.maskPad = maskData.scanlinePad;
//Create cursor
Cursor cursor = new Cursor(display, sourceData, 10, 10);

@HeikoKlare
Copy link
Contributor

Thank you! Then I would be fine with removing the snippet.

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.

Remove warnings in Snippet92 and Snippet386 for deprecated constructors

4 participants