<html><head>
<style type="text/css"><!--#x74a97db6f65d497 p.MsoNormal
{margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;}
#x74a97db6f65d497 a:link
{color: blue; text-decoration: underline;}
#x74a97db6f65d497 li.MsoListParagraph
{margin: 0in 0in 0in 0.5in; font-size: 11pt; font-family: Calibri, sans-serif;}
#x74a97db6f65d497 div.WordSection1
{page: WordSection1;}
#x74a97db6f65d497 ol
{margin-bottom: 0in;}
--></style><style id="css_styles" type="text/css"><!--blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc }
blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; }
a img { border: 0px; }
li[style='text-align: center;'], li[style='text-align: center; '], li[style='text-align: right;'], li[style='text-align: right; '] { list-style-position: inside;}
body { font-family: Helvetica; font-size: 9pt; }
.quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb solid; padding-left: 0.3em; }
--></style>
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>Harshitha,</div><div><br /></div><div>Thanks for the suggestions. I think those don’t really resolve the problem, though.</div><div><br /></div><div>In the original sample program (having only 1 frame) watching the keyboard focus could help identify when there’s a change, but if there’s a second frame: that second window could retain the focus and the first window still can’t answer the question, “Are you minimized now?”</div><div><div id="xb7307ab26ea540968109403190bd3a01"><div><br /></div><div>(I have an updated <a href="https://drive.google.com/file/d/1uzUUDnAlPoHlFdbVgunwpFKvn4Ies-6-/view?usp=sharing">sample program</a> here with two frames if anyone’s interested.)</div><div><br /></div></div></div><div>Further: the window could lose the focus at any time (if a system dialog came up), so I don’t think focus should act as a proxy for visibility.</div><div></div><div><br /></div><div>I did find tonight a work-around for our app a few hours ago. We have some native code that identifies all visible windows, their bounds and their title. If I consult that list: I see a window that matches our (sufficiently unique) window title. And its bounds do not at all match with what Java says our window’s bounds are. And it is positioned so 99% of it overlaps with a window called “Gesture Blocking Overlay”. (All Stage Manager thumbnails appear to have an overlay window with this title.) So it’s a very kludgy and brittle work around, for for the time being it works.</div><div><br /></div><div>This leads me to believe the Mac OS windowing system doesn’t consider the frame to be “hidden”. I think the window remains technically visible. And Mac OS knows it has new bounds. But the peer in Java is oblivious to the new bounds/state. (I examined the peer LWWindowPeer in a debugger: it still thinks the window is visible (technically true) and its bounds are unchanged (not true).)</div><div><br /></div><div>The more I look at this: I’m afraid the crux of this problem is Stage Manager has introduced a new window state that Java’s AWT architecture can’t really describe yet. (But I’d love to be proved wrong…?)</div><div><br /></div><div> - Jeremy</div>
<div><br /></div>
<div>
<div>------ Original Message ------</div>
<div>From "Harshitha Onkar" <<a href="mailto:harshitha.onkar@oracle.com">harshitha.onkar@oracle.com</a>></div>
<div>To "Jeremy Wood" <<a href="mailto:mickleness@gmail.com">mickleness@gmail.com</a>></div>
<div>Cc "<a href="mailto:client-libs-dev@openjdk.org">client-libs-dev@openjdk.org</a>" <<a href="mailto:client-libs-dev@openjdk.org">client-libs-dev@openjdk.org</a>></div>
<div>Date 2/16/2023 1:57:56 AM</div>
<div>Subject RE: Stage Manager Problems</div></div><div><br /></div>
<div id="x74a97db6f65d497" style="word-wrap:break-word"><blockquote cite="BYAPR10MB3350EEB6F196F7440CF1E9AC80A09@BYAPR10MB3350.namprd10.prod.outlook.com" type="cite" class="cite2">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:12.0pt">Hi Jeremy,<o:p xmlns:o="#unknown"></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p xmlns:o="#unknown"> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Does any of the following options help in your case to determine whether or not the frame is iconified?
<o:p xmlns:o="#unknown"></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p xmlns:o="#unknown"> </o:p></span></p>
<ol style="margin-top:0in" start="1" type="1">
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l1 level1 lfo2"><span style="font-size:12.0pt">frame.isActive()
<o:p xmlns:o="#unknown"></o:p></span></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l1 level1 lfo2"><span style="font-size:12.0pt">frame.isFocused()
<o:p xmlns:o="#unknown"></o:p></span></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l1 level1 lfo2"><span style="font-size:12.0pt">frame.isAlwaysOnTop()<o:p xmlns:o="#unknown"></o:p></span></li></ol>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p xmlns:o="#unknown"> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Thanks & Regards,<o:p xmlns:o="#unknown"></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Harshitha Onkar<o:p xmlns:o="#unknown"></o:p></span></p>
<p class="MsoNormal"><o:p xmlns:o="#unknown"> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> client-libs-dev <<a href="mailto:client-libs-dev-retn@openjdk.org">client-libs-dev-retn@openjdk.org</a>>
<b>On Behalf Of </b>Jeremy Wood<br />
<b>Sent:</b> Wednesday, February 15, 2023 10:08 PM<br />
<b>To:</b> <a href="mailto:client-libs-dev@openjdk.org">client-libs-dev@openjdk.org</a><br />
<b>Subject:</b> Stage Manager Problems<o:p xmlns:o="#unknown"></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p xmlns:o="#unknown"> </o:p></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">We’re experiencing problems related JFrames while <a href="https://www.computerworld.com/article/3667999/what-is-apple-stage-manager-and-how-is-it-used.html">Stage Manager</a>
is active Mac.<o:p xmlns:o="#unknown"></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><o:p xmlns:o="#unknown"> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">When Stage Manager is active the yellow minimize button on our JFrame’s appears to “minimize” our app. But as far as our Frame is concerned:<o:p xmlns:o="#unknown"></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">1. Frame.getExtendedState() does not indicate we’re in an ICONIFIED state<o:p xmlns:o="#unknown"></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">2. Frame.isShowing() returns true<o:p xmlns:o="#unknown"></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">3. a java.awt.desktop.AppForegroundListener believes our app is in the foreground.<o:p xmlns:o="#unknown"></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><o:p xmlns:o="#unknown"> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">We want to identify when we’re in this hidden state. Is there any other property we can consult to help identify this state?<o:p xmlns:o="#unknown"></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><o:p xmlns:o="#unknown"> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">I’m happy to submit an openjdk ticket if needed, but first I wanted to sanity check that I’m not missing something. (I also tried
<a href="https://bugs.openjdk.org/issues/?jql=text%20~%20%22%5C%22Stage%20Manager%5C%22%22">
querying</a> the openJDK bug database, but didn’t see any hits.)<o:p xmlns:o="#unknown"></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><o:p xmlns:o="#unknown"> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">I tried rummaging around in Mac-specific classes (like CPlatformWindow), but I didn’t see any promising leads. It’s always possible I missed something, though.<o:p xmlns:o="#unknown"></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><o:p xmlns:o="#unknown"> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">Attached is a small 200-line demo app.<o:p xmlns:o="#unknown"></o:p></span></p>
</div>
</div>
</blockquote></div>
</body></html>