[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Getting notified on a window being grabbed and moved / resized
From:       Kirill Grouchnikov <kirill.grouchnikov () gmail ! com>
Date:       2022-06-28 15:19:02
Message-ID: CAMRG33ZWw1vikdJPjUfkPrXVMsY1TWW9JWsvemux=8LQLZ0HqA () mail ! gmail ! com
[Download RAW message or body]

Is there a public / supported way to get notified when an OS-decorated
window (native title pane from macOS, Windows, etc) is moved around or
resized by the user grabbing the title bar or the border?

I want to get notified on that process starting so that I can hide all the
popups. What I see is that at [1] this is how Swing's popup menu registers
itself to get notified on window grabbing. Note that it's using internal,
undocumented and inaccessible event mask. Then at [2] it gets notified that
the window has been ungrabbed so that it can hide itself. Again, internal
and inaccessible event class. And there's also APIs at [3] to grab / ungrab
windows to have the whole process rolling.

Are there alternatives to these internal APIs that have been exposed as
part of hiding the implementation details?

The only thing I could find so far is adding a component listener to the
frame, but "componentMoved" is called with a noticeable lag, hundreds of
milliseconds after the window has started moving.

[1]
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java#L790
 [2]
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java#L861
 [3]
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/sun/awt/SunToolkit.java#L1641



[Attachment #3 (text/html)]

<div dir="ltr"><div>Is there a public / supported way to get notified when an \
OS-decorated window (native title pane from macOS, Windows, etc) is moved around or \
resized by the user grabbing the title bar or the border?</div><div><br></div><div>I \
want to get notified on that process starting so that I can hide all the popups. What \
I see is that at [1]  this is how Swing&#39;s popup menu registers itself to get \
notified on  window grabbing. Note that it&#39;s using internal, undocumented and 
inaccessible event mask. Then at [2] it gets notified that the window has been \
ungrabbed so that it can hide  itself. Again, internal and inaccessible event class. \
And there&#39;s also APIs at [3] to grab / ungrab windows to have the whole process \
rolling.</div><div><br></div><div>Are there alternatives to these internal APIs that \
have been exposed as part of hiding the implementation \
details?</div><div><br></div><div>The only thing I could find so far is adding a \
component listener to the frame, but &quot;componentMoved&quot; is called with a \
noticeable lag, hundreds of milliseconds after the window has started \
moving.</div><div><br></div><div>[1] <a \
href="https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/ \
swing/plaf/basic/BasicPopupMenuUI.java#L790">https://github.com/openjdk/jdk/blob/maste \
r/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java#L790</a></div><div>[2] \
<a href="https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/jav \
ax/swing/plaf/basic/BasicPopupMenuUI.java#L861">https://github.com/openjdk/jdk/blob/ma \
ster/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java#L861</a></div><div>[3] \
<a href="https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/sun \
/awt/SunToolkit.java#L1641">https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/sun/awt/SunToolkit.java#L1641</a></div></div>




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic