[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Help for fixing JDK-8227366
From:       Thiago Milczarek Sayao <thiago.sayao () clamed ! com ! br>
Date:       2019-07-28 20:00:22
Message-ID: CP2P15201MB222872943C76B4F748680A97DEC20 () CP2P15201MB2228 ! LAMP152 ! PROD ! OUTLOOK ! COM
[Download RAW message or body]

Hi,

I have been investigating:
https://bugs.openjdk.java.net/browse/JDK-8227366

The problem is the focus event gets fired for all windows when a window is closed, so \
it messes up with "last window" tracking. It also causes unnecessary events.


On com.sun.javafx.tk.quantum.GlassStage:

    void windowsSetEnabled(boolean enabled) {
        // TODO: Need to solve RT-12605:
        // If Window #1 pops up an APPLICATION modal dialog #2 it should block
        // Window #1, but will also block Window #3, #4, etc., unless those
        // windows are descendants of #2.

        // Make a copy of the windows list, since it could change as the result
        // of a child window being closed when the parent is closed.
        for (GlassStage window : windows.toArray(new GlassStage[windows.size()])) {
            if (window != this && windows.contains(window)) {
                window.setPlatformEnabled(enabled);
            }
        }
    }

It loops thru windows and calls setPlatformEnabled.

On com.sun.javafx.tk.quantum.WindowStage:

    protected void setPlatformEnabled(boolean enabled) {
        super.setPlatformEnabled(enabled);
        if (platformWindow != null) {
            platformWindow.setEnabled(enabled);
        }
        if (enabled) {
            // Check if window is really enabled - to handle nested case
            if (platformWindow != null && platformWindow.isEnabled()) {
                requestToFront();
            }
        } else {
            removeActiveWindow(this);
        }
    }

It calls requestToFront();

    // Note: This method is required to workaround a glass issue mentioned in \
RT-12607  protected void requestToFront() {
        if (platformWindow != null) {
            platformWindow.toFront();
            platformWindow.requestFocus();
        }
    }

Which calls requestFocus();

As it's called on each window, it will bring each window to front.

I find this weird.

Any ideas why this is necessary?

        if (enabled) {
            // Check if window is really enabled - to handle nested case
            if (platformWindow != null && platformWindow.isEnabled()) {
                requestToFront();
            }
        } 

Seems wrong to me.


=


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic