Setting a default window icon is not desirable for developers using JOGL in applications that already have icons set. The JOGL default icons are overriding existing icons. Can this behavior be disabled with a setting, or be made optional? There isn't a clean workaround at the moment, both commands below throw exceptions: NewtFactory.setWindowIcons(null); NewtFactory.setWindowIcons(new IOUtil.ClassResources(Foo.class, new String[0]));
Maybe it could be covered by this RFE: https://jogamp.org/bugzilla/show_bug.cgi?id=1163 Please post the stack traces of the exceptions.
Just to be clear, the commands above don't throw an exception right away but when the window is initialized. Stack trace for the first case: java.lang.NullPointerException at jogamp.newt.driver.macosx.DisplayDriver.<clinit>(DisplayDriver.java:72) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at com.jogamp.newt.NewtFactory.getCustomClass(NewtFactory.java:111) at jogamp.newt.DisplayImpl.getDisplayClass(DisplayImpl.java:260) at jogamp.newt.DisplayImpl.create(DisplayImpl.java:270) at com.jogamp.newt.NewtFactory.createDisplay(NewtFactory.java:203) at com.jogamp.newt.NewtFactory.createWindowImpl(NewtFactory.java:309) at com.jogamp.newt.NewtFactory.createWindow(NewtFactory.java:234) at com.jogamp.newt.opengl.GLWindow.create(GLWindow.java:168) Stack trace for the second case: java.lang.ArrayIndexOutOfBoundsException: -1 at com.jogamp.common.util.IOUtil$ClassResources.resolve(IOUtil.java:458) at jogamp.newt.driver.macosx.DisplayDriver.<clinit>(DisplayDriver.java:72) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at com.jogamp.newt.NewtFactory.getCustomClass(NewtFactory.java:111) at jogamp.newt.DisplayImpl.getDisplayClass(DisplayImpl.java:260) at jogamp.newt.DisplayImpl.create(DisplayImpl.java:270) at com.jogamp.newt.NewtFactory.createDisplay(NewtFactory.java:203) at com.jogamp.newt.NewtFactory.createWindowImpl(NewtFactory.java:309) at com.jogamp.newt.NewtFactory.createWindow(NewtFactory.java:234) at com.jogamp.newt.opengl.GLWindow.create(GLWindow.java:168)
In my humble opinion, it would be nice to be able to stop overriding the window icon when newt.window.icons is set to "". Then, you wouldn't have to set it once again by using this property. In the meantime, please tell me what happens when you set newt.window.icons to "", you can still set this property to a valid value in order to use your icon, can't you?
I suggest the following changes: https://github.com/sgothel/jogl/blob/master/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java#L71 https://github.com/sgothel/jogl/blob/master/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java#L68 https://github.com/sgothel/jogl/blob/master/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java#L80 The code above should be modified to support "null" and the documentation of this method should be updated: https://github.com/sgothel/jogl/blob/master/src/newt/classes/com/jogamp/newt/NewtFactory.java#L99
I tried to set the newt.window.icons to "" and I also got an exception at startup. java.lang.IllegalArgumentException: Property 'newt.window.icons' did not specify at least two PNG icons, but [] at com.jogamp.newt.NewtFactory$1.run(NewtFactory.java:72) I could potentially set the property to a valid values but I would prefer not because my application is built on top of Netbeans Platform, which does provide it's own window icons mechanism. I would stop using the default built-in mechanism if I was to use the JOGL property and I would find this less robust and clean.
See Bug 1238 comment 3. Fix for Bug 1238 also solves this bug's issue. +++ commit 24d30eec425ca6c62f72e7c218a9149777dbec52 Bug 1238 - Fix NPE for Window-Icon's PNGPixelRect for unresolved location; Bug 1199 - Add setting to disable default window icons Bug 1238 - Fix NPE for Window-Icon's PNGPixelRect for unresolved location, i.e. null URLConnections Testing w/ jogl/make/scripts/tests.sh USE_BUILDDIR=1, discloses this issue - since the icons are available in jar only. Handling all unresolved resources, i.e. null URLConnection, is required. Further more, the icon list passed via property 'newt.window.icons' shall be separated by comma as well. This allows passing the list via scripts more conveniently. -Dnewt.window.icons="newt/data/jogamp-16x16.png,newt/data/jogamp-32x32.png" +++ Bug 1199 - Add setting to disable default window icons This patch also allows disabling JogAmp's own window icons by simply defining a non-existing location, i.e. -Dnewt.window.icons="null,null"