3

I am trying to fix a problem I found with a Java application. It has a too low res icon. After reading the source of it I modified it to have a bigger icon. SWT uses the gtk_window_set_icon() function of GTK to set the icon.

However, the high resolution icon is not used.

There is a work around of using a .desktop file to have a nice icon described here. And others describe the problem on the Ubuntu forums.

So how can I have a nice icon without having to place a .desktop file in the filesystem? Where should I report the bug for this? In which package is the code downscaling the icon that I intend to pass to the window manager?

I appreciate some help on this.

This can be reproduced with the following code:

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Test {
  public static void main(String[] args) {
    Display display = new Display();

    final int SIZE = 256;
    Image large = new Image(display, SIZE, SIZE);
    GC gc = new GC(large);
    gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
    gc.fillArc(0, 0, SIZE, SIZE, 45, 270);
    gc.dispose();

    Shell shell = new Shell(display);
    shell.setImages(new Image[] {  large });

    shell.open();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }

    large.dispose();
    display.dispose();
  }
}
  • It's probably GTK down-sizing it to something that makes sense in a window's title bar. Why don't you want to use the .desktop file? – mhall119 Jan 22 '13 at 00:11
  • 1
    As it is a Java project most the time it is not even installed. So I cannot copy the .desktop file to the appropriate places in the system. Moreover, I am actually using gtk_window_set_icon_list () which passes many icons to GTK, so the right (bigger) one should be chosen for ALT-TAB. – Felix Möller Jan 22 '13 at 06:45
  • @FelixMöller I feel that's more of an answer! Please post answers as answers. – gertvdijk Jan 22 '13 at 09:16
  • I see no solution at all. I just tried to explain why I do not want to use a .desktop file. – Felix Möller Jan 22 '13 at 17:44

0 Answers0