On Mon, 5 Apr 2021 10:29:20 GMT, Alexey Ushakov <[email protected]> wrote:
>> src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m line 1171:
>>
>>> 1169: layer.leftInset =
>>> (jint)(screenContentRect.origin.x - frame.origin.x);
>>> 1170: }
>>> 1171: }
>>
>> Can you check that it will work in the "new" tabbed mode on big sur as well?
>> Probably it is possible to swap coordinates during rendering in the layer
>> and get rid of this field?
>
>> Can you check that it will work in the "new" tabbed mode on big sur as well?
>
> Could you suggest any working test scenario? My simple test (below) just
> hangs even with OGL:
>
> import java.awt.FlowLayout;
> import java.util.Objects;
> import javax.swing.*;
> import javax.swing.border.EmptyBorder;
>
> public class TestWindowInsets
> extends JDialog
> {
>
> public TestWindowInsets()
> {
> JComponent contentPane = (JComponent) getContentPane();
> contentPane.setBorder(new EmptyBorder(50, 50, 50, 50));
> JButton b = new JButton("Test");
> b.addActionListener(e -> toggle());
> add(b);
> JButton c = new JButton("Win");
> c.addActionListener(e -> win());
> add(c);
>
> setLayout(new FlowLayout());
> setSize(800, 600);
>
> setVisible(true);
>
> }
>
> void toggle()
> {
> SwingUtilities.invokeLater(() -> {
> JRootPane rp = getRootPane();
> String name = "apple.awt.fullWindowContent";
> Object value = rp.getClientProperty(name);
> if (Objects.equals(value, "true")) {
> value = "false";
> } else {
> value = "true";
> }
> rp.putClientProperty(name, value);
> });
> }
>
> void win()
> {
> SwingUtilities.invokeLater(TestWindowInsets::new);
> }
>
> public static void main(String[] args)
> {
> SwingUtilities.invokeLater(TestWindowInsets::new);
> }
> }
> Probably it is possible to swap coordinates during rendering in the layer and
> get rid of this field?
I don't see a way how we can do it. Because of the inverted y coordinate in
metal, we need to place the origin of the drawing with the appropriate offset
that depends on the title height, even if we invert the y coordinate to match
java2d coordinate system.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3308