<AWT Dev> Review request #2: 6402325 (Swing toolbars vs native toolbars on Windows)

Anthony Petrov Anthony.Petrov at Sun.COM
Wed Oct 28 09:13:15 PDT 2009


Thanks for your review, Artem! Here's the next version of the fix. Some 
comments follow.

On 10/27/2009 02:55 PM, Artem Ananiev wrote:
> 1. Window.Type seems not to be a perfect name for the enum, it's too 
> generic. What about Window.WindowType?

That's exactly what I want to avoid: having it read as Window.WindowType
- too many "window" words, imo. Besides, take a look at the 
Thread.State, for instance. The concept of a "state" is quite common 
also, however, since this is an inner enum, that does not bring any 
problems.


> 2. Could you move the declaration of the enum to the top of Window.java, 
> so it can be easily located, please?

Sure.


> 3. I don't see a strong reason to use the proposed approach, when we 
> store the window type at java.awt level and then use AWTAccessor to get 
> its value at the peers level. Why don't you want to add a method to 
> WindowPeer interface which is called when Window.setType() is invoked? 
> It would eliminate AWTAccessor and getType_NoClientCode().

Indeed, I got rid of the AWTAccessor and reworked the X-side peers to 
avoid its usage in that case. However, we can't just introduce a peer's 
level method because:

a) Calling Window.setType() is prohibited after the peer goes live.
b) MS Window restricts tweaking some window styles after the window has 
been created. And the WS_POPUP is exactly that kind of style.

Therefore, we need the window type information before we create the 
hwnd. But the hwnd is created at the time of creation of the native part 
(the AwtWindow class instance). Since we don't want to directly access 
the Window.windowType field via JNI, we just don't have any other option 
but to cache the value of the type in the WWindowPeer.


So, the updated version is available at:

http://cr.openjdk.java.net/~anthony/7-33-utilityWindows-6402325.2/

Also, last time I forgot to mention that the POPUP window type on X11 
also means the override-redirect sort of window.

--
best regards,
Anthony



More information about the awt-dev mailing list