8378386: Remove AppContext from AWT ModalEventFilter.java

Reviewed-by: serb, dnguyen
This commit is contained in:
Phil Race 2026-03-01 17:49:33 +00:00
parent 9cf9fbec1f
commit d6246b35da

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2026, 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
@ -26,8 +26,6 @@ package java.awt;
import java.awt.event.*;
import sun.awt.AppContext;
abstract class ModalEventFilter implements EventFilter {
protected Dialog modalDialog;
@ -129,20 +127,14 @@ abstract class ModalEventFilter implements EventFilter {
private static class ToolkitModalEventFilter extends ModalEventFilter {
private AppContext appContext;
ToolkitModalEventFilter(Dialog modalDialog) {
super(modalDialog);
appContext = modalDialog.appContext;
}
protected FilterAction acceptWindow(Window w) {
if (w.isModalExcluded(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE)) {
return FilterAction.ACCEPT;
}
if (w.appContext != appContext) {
return FilterAction.REJECT;
}
while (w != null) {
if (w == modalDialog) {
return FilterAction.ACCEPT_IMMEDIATELY;
@ -155,27 +147,21 @@ abstract class ModalEventFilter implements EventFilter {
private static class ApplicationModalEventFilter extends ModalEventFilter {
private AppContext appContext;
ApplicationModalEventFilter(Dialog modalDialog) {
super(modalDialog);
appContext = modalDialog.appContext;
}
protected FilterAction acceptWindow(Window w) {
if (w.isModalExcluded(Dialog.ModalExclusionType.APPLICATION_EXCLUDE)) {
return FilterAction.ACCEPT;
}
if (w.appContext == appContext) {
while (w != null) {
if (w == modalDialog) {
return FilterAction.ACCEPT_IMMEDIATELY;
}
w = w.getOwner();
while (w != null) {
if (w == modalDialog) {
return FilterAction.ACCEPT_IMMEDIATELY;
}
return FilterAction.REJECT;
w = w.getOwner();
}
return FilterAction.ACCEPT;
return FilterAction.REJECT;
}
}