Monocle properties in glass and prism
Johan Vos
johan.vos at gluonhq.com
Wed Dec 15 14:16:14 UTC 2021
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
More information about the openjfx-dev
mailing list