gama-platform / gama

Main repository for developing the 2024+ versions of GAMA
https://gama-platform.org
GNU General Public License v3.0
16 stars 5 forks source link

Disabling the tabs in the layout hides the contents of some Java2D displays #35

Open lesquoyb opened 2 years ago

lesquoyb commented 2 years ago

Describe the bug When using the layout statement, having the facet tabs set at false give some strange behaviours. Here an example with the heatmap.gaml model from Library Models: image If you run it as is, the first two displays do not show. Clicking on them makes them appear.

image Same with the vertical layout. If you click on a display it will appear, but if you then click on another display, the new one will appear and the previous one disappear

image with an horizontal layout it's the 3 first display that do not work. As with the vertical layout, clicking on a display will make it appear, but in addition it will make disappear the only one that appeared in the initialisation.

The stack layout is exactly as the horizontal one (which is probably normal with the tabs disabled).

If you change one non-working display to an opengl one it will crash gama with the same error message as in gama-platform/gama#3447 But if you comment the chart from a display you changed to opengl, then it will be displayed normally:

image

And everything seems to come from the tabs facet being false, as commenting it solves the problem

AlexisDrogoul commented 2 years ago

When tabs are hidden, Eclipse considers views to be in a somewhat strange status. Somewhere between the normal status and the "detached" status. As a matter of fact, it is not considered a "correct" state. From my observation, on all OSes, it seems that a hidden event is (wrongly) sent to the last opened view whenever a new one is selected. Now, on macOS and Linux, this event is immediately followed by a show event (probably due to the layout resizing or something similar) ... but for some reason, not on Windows. This does not affect OpenGL displays, because we manually manage whether OpenGL surfaces are hidden or not in response to hide/show events (allowing to "filter out" bad events), but I still havent found how to catch or revert the wrong event on Windows in case of Java2D displays;

lesquoyb commented 1 year ago

@AlexisDrogoul the recent changes in eclipse/swt changed a bit the final result, but didn't fix it, do you think it's fixable in a short amount of time ? Else we could temporarily go for a warning when setting tabs to false and force opengl on the library models so at least the next release is "clean"

lesquoyb commented 1 year ago

I added back the tabs in the library models that were having that issue in my last commit, we'll need to remove them again once the issue fixed. Note: I noticed that the problem was not happening in 1.8.2-RC1, so probably something introduced with the big changes in displays between RC1 and RC2 (like the sync statement becoming global for example)

AlexisDrogoul commented 1 year ago

@AlexisDrogoul the recent changes in eclipse/swt changed a bit the final result, but didn't fix it, do you think it's fixable in a short amount of time ? Else we could temporarily go for a warning when setting tabs to false and force opengl on the library models so at least the next release is "clean"

I have issued a commit that does exactly this. The warning is only active when a 2d display is detected in output or permanent (whether it is explicit or set by default in the preferences), in conjunction with tabs: false set in layout. And of course only on Windows.

lesquoyb commented 1 year ago

Good enough for gama 1.9.0, leaving it open for later fix