diff --git a/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/contextmodeWsmode.xml b/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/contextmodeWsmode.xml index d3551f7bfe3132824e6e41f402258b249112eb7d..ebe8e423087448bfe9e6a9668fc0794d9b57c489 100644 --- a/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/contextmodeWsmode.xml +++ b/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/contextmodeWsmode.xml @@ -1,16 +1,12 @@ - - - - - - - - - - - - + + + + + + + + diff --git a/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/editorWsmode.xml b/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/editorWsmode.xml index a42b09e71d2e0a32b5c5748c000a0f9881efdca7..f142740ac9125ac630ce8d7f807151546c72552f 100644 --- a/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/editorWsmode.xml +++ b/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/editorWsmode.xml @@ -1,10 +1,12 @@ - - - - - + + + + + + + diff --git a/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/filtersmodeWsmode.xml b/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/filtersmodeWsmode.xml index 97bb795ca6e38e92ce6ee1f53b38df034f8faaf0..cdaf6a332c782d40620fa05c3706ce0238a87059 100644 --- a/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/filtersmodeWsmode.xml +++ b/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/filtersmodeWsmode.xml @@ -1,16 +1,13 @@ - - - - - - - - - - - + + + + + + + + diff --git a/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/layoutmodeWsmode.xml b/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/layoutmodeWsmode.xml index 69cc241d52563d1f747b523addf83b329ab6ef4b..ff03b2af968ab9cf094c223dc6a28020987a613e 100644 --- a/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/layoutmodeWsmode.xml +++ b/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/layoutmodeWsmode.xml @@ -1,14 +1,13 @@ - - - - - - - - - + + + + + + + + diff --git a/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/rankingmodeWsmode.xml b/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/rankingmodeWsmode.xml index 80e72945f88ab5250803df0dc6c65db14cf230bf..8bebf2bb184a7c90c8bafecbe1f2e1fafdaa7271 100644 --- a/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/rankingmodeWsmode.xml +++ b/modules/DesktopBranding/src/main/resources/org/gephi/branding/desktop/rankingmodeWsmode.xml @@ -1,14 +1,12 @@ - - - - - - - - - - + + + + + + + + diff --git a/modules/VisualizationImpl/pom.xml b/modules/VisualizationImpl/pom.xml index 493022084e4949fc5bb26754a68ec1cd7f8aca54..d5d9da1f2dfe187b01c20883e35ba140ad838ff8 100644 --- a/modules/VisualizationImpl/pom.xml +++ b/modules/VisualizationImpl/pom.xml @@ -16,9 +16,8 @@ VisualizationImpl - 2.4.0-rc-20210111 + v2.4.0-rc4 2.4.0-rc-20221118 - 2.4.0-rc4 @@ -86,6 +85,26 @@ org.netbeans.api org-openide-util-ui + + org.netbeans.api + org-openide-dialogs + + + ${project.groupId} + project-api + + + ${project.groupId} + desktop-project + + + ${project.groupId} + utils-longtask + + + org.netbeans.api + org-openide-modules + org.jogamp.gluegen @@ -94,33 +113,28 @@ org.jogamp.gluegen - gluegen-rt + gluegen-rt-natives-linux-amd64 ${jogl.version} - natives-linux-amd64 org.jogamp.gluegen - gluegen-rt + gluegen-rt-natives-linux-i586 ${jogl.version} - natives-linux-i586 org.jogamp.gluegen - gluegen-rt - ${jogl.version.natives.macos} - natives-macosx-universal + gluegen-rt-natives-macosx-universal + ${jogl.version} org.jogamp.gluegen - gluegen-rt + gluegen-rt-natives-windows-amd64 ${jogl.version} - natives-windows-amd64 org.jogamp.gluegen - gluegen-rt + gluegen-rt-natives-windows-i586 ${jogl.version} - natives-windows-i586 @@ -130,53 +144,28 @@ org.jogamp.jogl - jogl-all + jogl-all-natives-linux-amd64 ${jogl.version} - natives-linux-amd64 org.jogamp.jogl - jogl-all + jogl-all-natives-linux-i586 ${jogl.version} - natives-linux-i586 org.jogamp.jogl - jogl-all - ${jogl.version.natives.macos} - natives-macosx-universal + jogl-all-natives-macosx-universal + ${jogl.version} org.jogamp.jogl - jogl-all + jogl-all-natives-windows-amd64 ${jogl.version} - natives-windows-amd64 org.jogamp.jogl - jogl-all + jogl-all-natives-windows-i586 ${jogl.version} - natives-windows-i586 - - - org.netbeans.api - org-openide-dialogs - - - ${project.groupId} - project-api - - - ${project.groupId} - desktop-project - - - ${project.groupId} - utils-longtask - - - org.netbeans.api - org-openide-modules @@ -215,4 +204,14 @@ + + + jogl-jzy3d + JOGL Jzy3d + https://maven.jzy3d.org/releases + + false + + + diff --git a/modules/VisualizationImpl/src/main/java/org/gephi/visualization/apiimpl/GraphDrawable.java b/modules/VisualizationImpl/src/main/java/org/gephi/visualization/apiimpl/GraphDrawable.java index 32eed13426b8bdbcbc52dcadcbf0489592d8ed42..6ab23f907b046dc8d2454759b1ca38591dad9bf8 100644 --- a/modules/VisualizationImpl/src/main/java/org/gephi/visualization/apiimpl/GraphDrawable.java +++ b/modules/VisualizationImpl/src/main/java/org/gephi/visualization/apiimpl/GraphDrawable.java @@ -92,10 +92,14 @@ public interface GraphDrawable { public void initConfig(GL2 gl); + public void initMouseEvents(); + public GraphicalConfiguration getGraphicalConfiguration(); public void destroy(); + public boolean isDestroyed(); + public Point getLocationOnScreen(); public void reinitWindow(); diff --git a/modules/VisualizationImpl/src/main/java/org/gephi/visualization/component/GraphTopComponent.java b/modules/VisualizationImpl/src/main/java/org/gephi/visualization/component/GraphTopComponent.java index ff5b9e378563dc68962e67bba9cee9dfeb43293f..e2b43279919aa3e2be9ab23ce5251d599a6685b7 100644 --- a/modules/VisualizationImpl/src/main/java/org/gephi/visualization/component/GraphTopComponent.java +++ b/modules/VisualizationImpl/src/main/java/org/gephi/visualization/component/GraphTopComponent.java @@ -49,12 +49,10 @@ import java.awt.event.KeyEvent; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingUtilities; -import javax.swing.UIManager; import org.gephi.project.api.ProjectController; import org.gephi.project.api.Workspace; import org.gephi.project.api.WorkspaceListener; import org.gephi.tools.api.ToolController; -import org.gephi.ui.utils.UIUtils; import org.gephi.visualization.VizController; import org.gephi.visualization.apiimpl.GraphDrawable; import org.gephi.visualization.opengl.AbstractEngine; @@ -63,6 +61,7 @@ import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.util.Lookup; import org.openide.util.NbBundle; +import org.openide.util.Utilities; import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; @@ -94,36 +93,36 @@ public class GraphTopComponent extends TopComponent implements AWTEventListener initComponents(); setName(NbBundle.getMessage(GraphTopComponent.class, "CTL_GraphTopComponent")); -// setToolTipText(NbBundle.getMessage(GraphTopComponent.class, "HINT_GraphTopComponent")); //Request component activation and therefore initialize JOGL2 component - WindowManager.getDefault().invokeWhenUIReady(new Runnable() { + if (!Utilities.isMac()) { + WindowManager.getDefault().invokeWhenUIReady(this::initDrawable); + } + initKeyEventContextMenuActionMappings(); + } + + private void initDrawable() { + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - open(); - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - //Init - initCollapsePanel(); - initToolPanels(); - drawable = VizController.getInstance().getDrawable(); - engine = VizController.getInstance().getEngine(); - - requestActive(); - add(drawable.getGraphComponent(), BorderLayout.CENTER); - remove(waitingLabel); - } - }); + //Init + initCollapsePanel(); + initToolPanels(); + drawable = VizController.getInstance().getDrawable(); + engine = VizController.getInstance().getEngine(); + + requestActive(); + add(drawable.getGraphComponent(), BorderLayout.CENTER); + remove(waitingLabel); + drawable.initMouseEvents(); } }); - initKeyEventContextMenuActionMappings(); - -// add(drawable.getGraphComponent(), BorderLayout.CENTER); -// remove(waitingLabel); } private void initCollapsePanel() { + if (vizBarController != null) { + return; + } vizBarController = new VizBarController(); if (VizController.getInstance().getVizConfig().isShowVizVar()) { collapsePanel.init(vizBarController.getToolbar(), vizBarController.getExtendedBar(), false); @@ -150,6 +149,9 @@ public class GraphTopComponent extends TopComponent implements AWTEventListener // } private void initToolPanels() { + if (toolbar != null) { + return; + } final ToolController tc = Lookup.getDefault().lookup(ToolController.class); if (tc != null) { if (VizController.getInstance().getVizConfig().isToolbar()) { @@ -308,4 +310,28 @@ public class GraphTopComponent extends TopComponent implements AWTEventListener String version = p.getProperty("version"); // TODO read your settings according to their version } + + @Override + protected void componentClosed() { + super.componentClosed(); + + // On Mac we dispose the canvas to avoid haning issues + if (Utilities.isMac()) { + engine.stopDisplay(); + drawable.destroy(); + remove(drawable.getGraphComponent()); + add(waitingLabel, BorderLayout.CENTER); + } + } + + @Override + protected void componentOpened() { + super.componentOpened(); + + // On Mac we destroy and reinit the drawable here instead than once + // to address freeze issues within JOGL + if (Utilities.isMac()) { + initDrawable(); + } + } } diff --git a/modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GLAbstractListener.java b/modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GLAbstractListener.java index bef4111ef915f1b7621d8fafd78d0d3c69a9d3c3..65157065e6ec1fbe9292da580878fb71ba53093b 100644 --- a/modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GLAbstractListener.java +++ b/modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GLAbstractListener.java @@ -110,6 +110,7 @@ public abstract class GLAbstractListener implements GLEventListener, VizArchitec private boolean showGLLog = true; private volatile boolean resizing = false; private double aspectRatio = 0; + private boolean destroyed = false; public GLAbstractListener() { this.vizController = VizController.getInstance(); @@ -129,9 +130,14 @@ public abstract class GLAbstractListener implements GLEventListener, VizArchitec cameraLocation = vizController.getVizConfig().getDefaultCameraPosition(); cameraTarget = vizController.getVizConfig().getDefaultCameraTarget(); + initMouseEvents(); + } + + @Override + public void initMouseEvents() { //Mouse events - if (vizController.getVizConfig().isReduceFpsWhenMouseOut() || - vizController.getVizConfig().isPauseLoopWhenMouseOut()) { + if (graphMouseAdapter == null && (vizController.getVizConfig().isReduceFpsWhenMouseOut() || + vizController.getVizConfig().isPauseLoopWhenMouseOut())) { graphMouseAdapter = new GraphMouseAdapter(); if (window != null) { graphMouseAdapterNewt = new MouseAdapter() { @@ -179,6 +185,7 @@ public abstract class GLAbstractListener implements GLEventListener, VizArchitec caps.setAlphaBits(8); //if NOT opaque caps.setDoubleBuffered(true); caps.setHardwareAccelerated(true); + caps.setOnscreen(true); //FSAA int antialisaing = vizController.getVizConfig().getAntialiasing(); @@ -386,6 +393,7 @@ public abstract class GLAbstractListener implements GLEventListener, VizArchitec @Override public void destroy() { + destroyed = true; if (graphMouseAdapterNewt != null) { window.removeMouseListener(graphMouseAdapterNewt); } else if (graphMouseAdapterCanvas != null) { @@ -395,6 +403,11 @@ public abstract class GLAbstractListener implements GLEventListener, VizArchitec drawable.destroy(); } + @Override + public boolean isDestroyed() { + return destroyed; + } + public void renderTestCube(GL2 gl) { float cubeSize = 1f; diff --git a/modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GraphCanvas.java b/modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GraphCanvas.java index 4955cebed7a9e9570d6f833f1c820c32705de1b7..acbc08879830a5243a93ffea1774d462cf3e1442 100644 --- a/modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GraphCanvas.java +++ b/modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GraphCanvas.java @@ -124,10 +124,4 @@ public class GraphCanvas extends GLAbstractListener { } } } - - @Override - public void destroy() { - super.destroy(); - glCanvas.destroy(); - } } diff --git a/modules/application/src/main/resources/gephi.conf b/modules/application/src/main/resources/gephi.conf index 792b4c70b635a0d84615d0b9a0971c6b1165a856..7e2f8c70a0eef1e503f6a2dd9b1042e7ba3002d6 100644 --- a/modules/application/src/main/resources/gephi.conf +++ b/modules/application/src/main/resources/gephi.conf @@ -8,7 +8,7 @@ default_cachedir="${DEFAULT_CACHEDIR_ROOT}/${gephi.minor.version}" # options used by the launcher by default, can be overridden by explicit # command line switches -default_options="--branding ${branding.token} -J-Dsun.java2d.metal=true -J-Dsun.java2d.noddraw=true -J-Dsun.awt.noerasebackground=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dnetbeans.indexing.noFileRefresh=true -J-Dplugin.manager.check.interval=EVERY_DAY -J-Dapple.awt.application.appearance=system -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-opens=java.base/java.nio=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED" +default_options="--branding ${branding.token} -J-Dsun.java2d.metal=true -J-Dsun.java2d.noddraw=true -J-Dsun.awt.noerasebackground=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dnetbeans.indexing.noFileRefresh=true -J-Dnetbeans.winsys.hideEmptyDocArea=true -J-Dplugin.manager.check.interval=EVERY_DAY -J-Dapple.awt.application.appearance=system -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-opens=java.base/java.nio=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED" # for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea # default location of JDK/JRE, can be overridden by using --jdkhome switch