You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "neilcsmith-net (via GitHub)" <gi...@apache.org> on 2026/03/31 17:34:33 UTC
[PR] Move setting of awtAppClassName from MainWindow to Main [netbeans]
neilcsmith-net opened a new pull request, #9314:
URL: https://github.com/apache/netbeans/pull/9314
Move the setting of awtAppClassName for XToolkit into Main so that it is set before splash and import dialogs are created. This should fix issues with duplicate dock icons caused by incorrect WM_CLASS derived from this field value that need to be worked around in the various package builds.
Follow up to discussion in #9303 Draft for now. Should probably wait for and rebase on that change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Move setting of awtAppClassName from MainWindow to Main [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #9314:
URL: https://github.com/apache/netbeans/pull/9314#discussion_r3018344919
##########
platform/core.startup/src/org/netbeans/core/startup/Main.java:
##########
@@ -363,6 +366,24 @@ private static final Class getKlass(String cls) {
}
}
+ // moved from MainWindow::init to handle splash, etc.
+ private static void configureAWTAppClassName() {
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ Class<?> xtoolkit = toolkit.getClass();
+ if (xtoolkit.getName().equals("sun.awt.X11.XToolkit")) { //NOI18N
+ // TODO those add --add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED
+
+ //#183739 / JDK-6528430 - provide proper app name on Linux
+ try {
+ final Field awtAppClassName = xtoolkit.getDeclaredField("awtAppClassName"); //NOI18N
Review Comment:
i find it curious that the field isn't final -> we are lucky here since final might mean final in not too far future.
https://github.com/openjdk/jdk/blob/20c3082aac4381a5d38ed3abb34b3651b2d28e08/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java#L164
I think this is ok since it is only moving code around. But all those hacks have to go away. Every `--add-opens` flag we set is a red flag.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Move setting of awtAppClassName from MainWindow to Main [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #9314:
URL: https://github.com/apache/netbeans/pull/9314#discussion_r3058560856
##########
platform/core.startup/src/org/netbeans/core/startup/Main.java:
##########
@@ -363,6 +366,24 @@ private static final Class getKlass(String cls) {
}
}
+ // moved from MainWindow::init to handle splash, etc.
+ private static void configureAWTAppClassName() {
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ Class<?> xtoolkit = toolkit.getClass();
+ if (xtoolkit.getName().equals("sun.awt.X11.XToolkit")) { //NOI18N
+ // TODO those add --add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED
+
+ //#183739 / JDK-6528430 - provide proper app name on Linux
+ try {
+ final Field awtAppClassName = xtoolkit.getDeclaredField("awtAppClassName"); //NOI18N
Review Comment:
actually. discard that thought. First call to `invokeLater()` would have similar init paths.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Move setting of awtAppClassName from MainWindow to Main [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on code in PR #9314:
URL: https://github.com/apache/netbeans/pull/9314#discussion_r3020720628
##########
platform/core.startup/src/org/netbeans/core/startup/Main.java:
##########
@@ -363,6 +366,24 @@ private static final Class getKlass(String cls) {
}
}
+ // moved from MainWindow::init to handle splash, etc.
+ private static void configureAWTAppClassName() {
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ Class<?> xtoolkit = toolkit.getClass();
+ if (xtoolkit.getName().equals("sun.awt.X11.XToolkit")) { //NOI18N
+ // TODO those add --add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED
+
+ //#183739 / JDK-6528430 - provide proper app name on Linux
+ try {
+ final Field awtAppClassName = xtoolkit.getDeclaredField("awtAppClassName"); //NOI18N
Review Comment:
It's such a commonly used workaround that it's probably deliberately kept like that. An API or system property would be great for this, but it doesn't look like it's happening anytime soon! https://bugs.openjdk.org/browse/JDK-6528430 :smile: This will also need consideration if/when there's a move from XWayland to Wakefield.
The only other workaround is to ensure the toolkit is initialized from the main thread, but that would lead to a shared `WM_CLASS` across all platform applications.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Move setting of awtAppClassName from MainWindow to Main [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net merged PR #9314:
URL: https://github.com/apache/netbeans/pull/9314
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Move setting of awtAppClassName from MainWindow to Main [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on PR #9314:
URL: https://github.com/apache/netbeans/pull/9314#issuecomment-4197871673
Rebased and fixed (minor) conflict following merge of #9303
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Move setting of awtAppClassName from MainWindow to Main [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #9314:
URL: https://github.com/apache/netbeans/pull/9314#discussion_r3057686005
##########
platform/core.startup/src/org/netbeans/core/startup/Main.java:
##########
@@ -363,6 +366,24 @@ private static final Class getKlass(String cls) {
}
}
+ // moved from MainWindow::init to handle splash, etc.
+ private static void configureAWTAppClassName() {
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ Class<?> xtoolkit = toolkit.getClass();
+ if (xtoolkit.getName().equals("sun.awt.X11.XToolkit")) { //NOI18N
+ // TODO those add --add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED
+
+ //#183739 / JDK-6528430 - provide proper app name on Linux
+ try {
+ final Field awtAppClassName = xtoolkit.getDeclaredField("awtAppClassName"); //NOI18N
Review Comment:
startup metrics for this:
- getLocalGraphicsEnvironment() 23 ms
- configureAWTAppClassName() 9 ms
i am wondering if this too could be queued onto EDT so that it executes before splash. The reason why this block existed seems to be (see comment above) to log a custom msg if JDK can't initialize graphics. This might not be a big concern anymore.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Move setting of awtAppClassName from MainWindow to Main [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on code in PR #9314:
URL: https://github.com/apache/netbeans/pull/9314#discussion_r3058978871
##########
platform/core.startup/src/org/netbeans/core/startup/Main.java:
##########
@@ -363,6 +366,24 @@ private static final Class getKlass(String cls) {
}
}
+ // moved from MainWindow::init to handle splash, etc.
+ private static void configureAWTAppClassName() {
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ Class<?> xtoolkit = toolkit.getClass();
+ if (xtoolkit.getName().equals("sun.awt.X11.XToolkit")) { //NOI18N
+ // TODO those add --add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED
+
+ //#183739 / JDK-6528430 - provide proper app name on Linux
+ try {
+ final Field awtAppClassName = xtoolkit.getDeclaredField("awtAppClassName"); //NOI18N
Review Comment:
Yes, had already had and discarded same thought for similar reason. 😆
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists