<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Why is this sent to swing-dev ? That's completely the wrong list.<br>
You want 2d-dev. I'll am replying on 2d-dev not swing-dev.<br>
<br>
<br>
<br>
I wonder why I don't see this when I have my Mac closed and connect
to an external monitor ?<br>
What is special here ?<br>
<br>
> Now, when the main display is closed, the
CGDisplayIDToOpenGLDisplayMask(displayID) is returning 2 as glMask<br>
<br>
The phrasing here is misleading suggesting that "glMask" is an API
name.<br>
<br>
The method is returning the value 2, which we then store in a
variable we call glMask .. <br>
and then hand off as the value for NSOpenGLPFAScreenMask <br>
<br>
Why would the call error out on this ? It seems like the right thing
to do <br>
<br>
<br>
What is the implication of not having glMask ? If we don't need it,
why specify it at all ?<br>
<br>
What will happen if the second call fails too ? Won't we be back to
the crash ?<br>
<br>
Nits: <br>
<br>
1) Can we split that very long debugging trace statement ?<br>
<br>
2) I guess we don't need to free "attrs" or "attrs1" since it is
stack allocated .. <br>
Unfortunate that we have to repeat the entire initialisation minus
glMask.<br>
Can you think of a better way to do this ?<br>
<br>
-phil.<br>
<br>
On 9/25/19, 3:49 AM, Prasanta Sadhukhan wrote:
<blockquote
cite="mid:d06c8817-44dc-bbfa-efbd-3a7949db3a9a@oracle.com"
type="cite">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p>Hi All,</p>
Please review a fix for an issue where it is seen that if a
MacBookPro is attached to an external monitor via dock and macbook
lid is closed, <br>
no Java swing applications will start.
<p>It was found
GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration()
is returning null in this particular setup.</p>
<p>Since it was difficult to reproduce locally, enabling tracing
reveals that CGLGraphicsConfig#getCGLConfigInfo() was failing in
NSOpenGLPixelFormat.initWithAttributes()</p>
Appkit documentation
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://developer.apple.com/documentation/appkit/nsopenglpixelformat/1436219-initwithattributes?language=objc">https://developer.apple.com/documentation/appkit/nsopenglpixelformat/1436219-initwithattributes?language=objc</a><br>
says that it will return "<code class="code-voice"><span>nil</span></code>
if an object with the desired attributes could not be
initialized".<br>
Now, when the main display is closed, the <br>
CGDisplayIDToOpenGLDisplayMask(displayID)<br>
is returning 2 as glMask which when passed as an attribute to
NSOpenGLPixelFormat, it fails to initialize.<br>
Normally, with main Display being used, glMask is 1.<br>
<br>
Proposed fix is to see if first initialization fails, then retry
initialization without the offending glMask value for
NSOpenGLPFAScreenMask attributes,<br>
as documentation
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://developer.apple.com/documentation/appkit/1436213-opengl_pixel_format_attributes/nsopenglpfascreenmask?language=objc">https://developer.apple.com/documentation/appkit/1436213-opengl_pixel_format_attributes/nsopenglpfascreenmask?language=objc</a><br>
says "All screens specified in the bit mask are guaranteed to be
supported by the pixel format.", so if it is not guranteed to be
supported, initAttributes() might fail.<br>
<br>
Bug: <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://bugs.openjdk.java.net/browse/JDK-8223158">https://bugs.openjdk.java.net/browse/JDK-8223158</a><br>
<p>webrev: <a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://cr.openjdk.java.net/%7Epsadhukhan/8223158/webrev.0/">http://cr.openjdk.java.net/~psadhukhan/8223158/webrev.0/</a></p>
Regards<br>
Prasanta<br>
</blockquote>
</body>
</html>