8214046: [macosx] Undecorated Frame does not Iconify when set to
authorserb
Thu, 25 Apr 2019 15:15:53 -0700
changeset 54861 769dbf384c44
parent 54860 1372fbbde8dd
child 54862 3464146f4a1c
8214046: [macosx] Undecorated Frame does not Iconify when set to Reviewed-by: dmarkov
src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m
test/jdk/java/awt/Frame/NormalToIconified/NormalToIconifiedTest.java
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Thu Apr 25 15:13:36 2019 -0700
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Thu Apr 25 15:15:53 2019 -0700
@@ -205,13 +205,13 @@
     if (IS(styleBits, DECORATED)) {
         type |= NSTitledWindowMask;
         if (IS(styleBits, CLOSEABLE))            type |= NSClosableWindowMask;
-        if (IS(styleBits, MINIMIZABLE))          type |= NSMiniaturizableWindowMask;
         if (IS(styleBits, RESIZABLE))            type |= NSResizableWindowMask;
         if (IS(styleBits, FULL_WINDOW_CONTENT))  type |= NSFullSizeContentViewWindowMask;
     } else {
         type |= NSBorderlessWindowMask;
     }
 
+    if (IS(styleBits, MINIMIZABLE))   type |= NSMiniaturizableWindowMask;
     if (IS(styleBits, TEXTURED))      type |= NSTexturedBackgroundWindowMask;
     if (IS(styleBits, UNIFIED))       type |= NSUnifiedTitleAndToolbarWindowMask;
     if (IS(styleBits, UTILITY))       type |= NSUtilityWindowMask;
--- a/test/jdk/java/awt/Frame/NormalToIconified/NormalToIconifiedTest.java	Thu Apr 25 15:13:36 2019 -0700
+++ b/test/jdk/java/awt/Frame/NormalToIconified/NormalToIconifiedTest.java	Thu Apr 25 15:15:53 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /**
  * @test
  * @key headful
- * @bug 8171949
+ * @bug 8171949 8214046
  * @summary Tests that bitwise mask is set and state listener is notified during state transition.
  * @author Dmitry Markov
  * @library ../../regtesthelpers
@@ -41,12 +41,18 @@
 import test.java.awt.regtesthelpers.Util;
 
 public class NormalToIconifiedTest {
-    private static final AtomicBoolean listenerNotified = new AtomicBoolean(false);
 
     public static void main(String[] args) {
-        Robot robot = Util.createRobot();
+        test(false);
+        test(true);
+    }
 
+    private static void test(final boolean undecorated) {
+        AtomicBoolean listenerNotified = new AtomicBoolean(false);
+
+        Robot robot = Util.createRobot();
         Frame testFrame = new Frame("Test Frame");
+        testFrame.setUndecorated(undecorated);
         testFrame.setSize(200, 200);
         testFrame.addWindowStateListener(new WindowStateListener() {
             @Override
@@ -58,14 +64,11 @@
             }
         });
         testFrame.setVisible(true);
-
         Frame mainFrame = new Frame("Main Frame");
         mainFrame.setSize(200, 200);
         mainFrame.setLocationRelativeTo(null);
         mainFrame.setVisible(true);
-
         Util.waitForIdle(robot);
-
         try {
             Util.clickOnComp(mainFrame, robot);
             Util.waitForIdle(robot);