0

High resolution screens are old news, but for some reason we (and the Eclipse guys) ignored them until now. Well, we can't any longer.

What we want to do is create Eclipse applications that work for "normal" displays, but for high resolution ones, too. Right now the icons are way to small to see or click.

This bug links to this (rather sparse) documentation states we only need to use a new constructor for Image. Okay, so we need to create our own implementation of ImageDataProvider.

While that might work for the images we created ourselves, it does not work for the main tool bar icons.

So let's say we'll start a completely new application from scratch: how would we set up everything to make the toolbar work with the new API and so with all kinds of screens?

(There is a similar question, but it's from the perspective of an Eclipse user, while this question is from the perspective of a developer of an Eclipse application.)

Community
  • 1
  • 1
Stefan S.
  • 3,950
  • 5
  • 25
  • 77
  • Surely you've been here long enough to know that this question is waaaaaaaay to broad for this site. – Joe C Apr 26 '17 at 06:35
  • @JoeC What's too broad? I found the API to use, I just don't know how to get the main toolbar to use it? – Stefan S. Apr 26 '17 at 06:36
  • If that's the case, may I suggest you edit your question with the information you have and a more specific problem. – Joe C Apr 26 '17 at 06:38

1 Answers1

0

When HiDPI mode scaling is in use anything using ImageDescriptor.createFromURL to load images will look for a image with @2x or @1.5x appended to the name depending on the current scaling (so, for example, remove.png and remove@2x.png). This is used to create an ImageDataProvider.

Eclipse will use this for the tool bar images and many other things.

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • I tried that already after taking a look at the `URLImageDataProvider`, yet it doesn't work (at least not for the main toolbar). I don't think it would be a viable option either way, because creating an image for each possible scaling factor is just not possible (my screen alone has 8 of them). – Stefan S. Apr 26 '17 at 07:01
  • This only works when scaling is being used on the screen. On my Mac the screen is 5120 x 2880 but is reported as 2560 x 1440. The @2x images are used. My understanding is that the ImageDataProvider API is intended for this scaling. – greg-449 Apr 26 '17 at 07:07
  • Weird. My 3840 x 2160 screen is reported as 5760 x 3234 (scaling is 1.5), yet `DPIUtil.getDeviceZoom()` returns 100. So the image resizing does not work because the framework does not realize the screen is scaled? – Stefan S. Apr 26 '17 at 07:15
  • The reported size is expected to be smaller than the real size. I don't know what the code on Windows/Linux supports. Code in `Display` should call `DPIUtil.setDeviceZoom` – greg-449 Apr 26 '17 at 07:21
  • I think the 2nd monitor is the problem. Without it, 3840 x 2160 gets reported as 3840 x 2160, even though scaling is still active. I'm not sure what to do with this information and how to progress. At least it explains why Eclipse and our applications won't scale. – Stefan S. Apr 26 '17 at 07:58