I wonder if there are any known cases where the glass platform is set to Monocle, but where prism is expected to use X11? That sounds like a contradiction
Agreed that this seems like a mismatch.
I suggest we remove the "embedded" property and the PlatforumUtil.getEmbeddedType() method (note that this is unrelated to PlatformUtil.isEmbedded()), and that we replace the checks on the 2 places mentioned above with a check on glass.platform being monocle.
I think this seems fine. It does seem a little odd to query glass platform in Prism, but I don't see a problem with it as long as Prism doesn't call into glass directly, at least not during initialization (Prism is necessarily initialized before glass).
-- Kevin On 12/15/2021 6:16 AM, Johan Vos wrote:
Hi, The separation between Glass and Prism is slightly broken by Monocle and that restricts the number of possible combinations. I wonder if there are any known cases where the glass platform is set to Monocle, but where prism is expected to use X11? That sounds like a contradiction, as Monocle is intended for platforms without a window manager, where X11 is afaik almost always bundled with a window manager. The confusing part is that if you want to use prism-es2 with (glass platform) monocle, you need to specify not only -Dglass.platform=Monocle but also -Dembedded=monocle (note the difference in upper/lowercase M/m) The latter is needed because of a check in GLFactory: if (PlatformUtil.isUnix()) { if ("monocle".equals(PlatformUtil.getEmbeddedType())) factoryClassName = "com.sun.prism.es2.MonocleGLFactory"; else factoryClassName = "com.sun.prism.es2.X11GLFactory"; } Hence, on Unix, we always go for the X11GLFactory, unless the system property "embedded" equals "monocle" -- regardless of what glass platform we are using. The PlatformUtil.getEmbeddedType() is used in 1 other place: in ES2Pipeline<clinit> itself: if ("monocle".equals(eglType)) { isEglfb = true; libName = "prism_es2_monocle"; } I suggest we remove the "embedded" property and the PlatforumUtil.getEmbeddedType() method (note that this is unrelated to PlatformUtil.isEmbedded()), and that we replace the checks on the 2 places mentioned above with a check on glass.platform being monocle. The drawback of this is that it introduces a glass concept in prism. However, this is already happening, as the differences between the X11GLFactory and the MonocleGLFactory are related to querying window information. An alternative approach is to remove the MonocleGLFactory, and make the X11GLFactory slightly more generic so that it can be used with Monocle as well. That sounds a bit silly because of the "X11" in the name, but since this factory also works with WayLand, the name is misleading already. Thoughts? - Johan