Skip to content

Commit

Permalink
JBR-8189 revert "8296972: [macos13] java/awt/Frame/MaximizedToIconifi…
Browse files Browse the repository at this point in the history
…ed/MaximizedToIconified.java: getExtendedState() != 6 as expected."

This reverts commit 488baa5.
  • Loading branch information
vprovodin committed Jan 28, 2025
1 parent 325a55a commit 4873ae7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import java.awt.Window;
import java.awt.event.FocusEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;
import java.awt.peer.ComponentPeer;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
Expand Down Expand Up @@ -1067,33 +1066,6 @@ public boolean isFullScreenMode() {
return isFullScreenMode;
}

private void waitForWindowState(int state) {
if (peer.getState() == state) {
return;
}

Object lock = new Object();
WindowStateListener wsl = new WindowStateListener() {
public void windowStateChanged(WindowEvent e) {
synchronized (lock) {
if (e.getNewState() == state) {
lock.notifyAll();
}
}
}
};

target.addWindowStateListener(wsl);
if (peer.getState() != state) {
synchronized (lock) {
try {
lock.wait();
} catch (InterruptedException ie) {}
}
}
target.removeWindowStateListener(wsl);
}

@Override
public void setWindowState(int windowState) {
if (peer == null || !peer.isVisible()) {
Expand All @@ -1115,16 +1087,13 @@ public void setWindowState(int windowState) {
// let's return into the normal states first
// the zoom call toggles between the normal and the max states
unmaximize();
waitForWindowState(Frame.NORMAL);
}
execute(CWrapper.NSWindow::miniaturize);
break;
case Frame.MAXIMIZED_BOTH:
if (prevWindowState == Frame.ICONIFIED) {
// let's return into the normal states first
execute(CWrapper.NSWindow::deminiaturize);
waitForWindowState(Frame.NORMAL);

}
maximize();
break;
Expand Down
1 change: 1 addition & 0 deletions test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ java/awt/Focus/FocusOwnerFrameOnClick/FocusOwnerFrameOnClick.java 8081489 generi
java/awt/Focus/IconifiedFrameFocusChangeTest/IconifiedFrameFocusChangeTest.java 6849364 generic-all
java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusToFrontTest.java 6848406 generic-all
java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusSetVisibleTest.java 6848407 generic-all
java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java 8296972 macosx-all
java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java 8022302 generic-all
java/awt/Frame/RestoreToOppositeScreen/RestoreToOppositeScreen.java 8286840 linux-all
java/awt/FileDialog/FileDialogIconTest/FileDialogIconTest.java 8160558 windows-all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

public class MaximizedToIconified
{
static volatile int lastFrameState;
static volatile int lastFrameState = Frame.NORMAL;
static volatile boolean failed = false;
static volatile Toolkit myKit;
private static Robot robot;
Expand Down Expand Up @@ -77,8 +77,6 @@ private static void examineStates(int states[]) {
frame.setSize(200, 200);
frame.setVisible(true);

lastFrameState = Frame.NORMAL;

robot.waitForIdle();

frame.addWindowStateListener(new WindowStateListener() {
Expand Down Expand Up @@ -116,12 +114,7 @@ private static void doTest() {
// because Toolkit.isFrameStateSupported() method reports these states
// as not supported. And such states will simply be skipped.
examineStates(new int[] {Frame.MAXIMIZED_BOTH, Frame.ICONIFIED, Frame.NORMAL});
System.out.println("------");
examineStates(new int[] {Frame.ICONIFIED, Frame.MAXIMIZED_BOTH, Frame.NORMAL});
System.out.println("------");
examineStates(new int[] {Frame.NORMAL, Frame.MAXIMIZED_BOTH, Frame.ICONIFIED});
System.out.println("------");
examineStates(new int[] {Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH});

}

Expand Down

0 comments on commit 4873ae7

Please sign in to comment.