Bug 1199 - Add setting to disable default window icons
Summary: Add setting to disable default window icons
Status: RESOLVED FIXED
Alias: None
Product: Newt
Classification: JogAmp
Component: core (show other bugs)
Version: 1
Hardware: All all
: --- enhancement
Assignee: Sven Gothel
URL:
Depends on: 1238
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-25 22:02 CEST by mbastian
Modified: 2015-10-03 12:09 CEST (History)
1 user (show)

See Also:
Type: FEATURE
SCM Refs:
24d30eec425ca6c62f72e7c218a9149777dbec52
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mbastian 2015-08-25 22:02:42 CEST
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]));
Comment 1 Julien Gouesse 2015-08-26 10:25:05 CEST
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.
Comment 2 mbastian 2015-08-26 10:31:11 CEST
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)
Comment 3 Julien Gouesse 2015-08-26 16:29:44 CEST
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?
Comment 5 mbastian 2015-08-26 16:55:14 CEST
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.
Comment 6 Sven Gothel 2015-10-03 12:09:08 CEST
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"