empirephoenix / JME3-JFX

JFX Gui bridge for JME with usefull utilities for common usecases
29 stars 33 forks source link

Popups not being snapped correctly whilst fullscreen #32

Open hatstand0 opened 9 years ago

hatstand0 commented 9 years ago

Running this code:

import com.jme3.app.SimpleApplication;
import com.jme3.math.ColorRGBA;
import com.jme3x.jfx.AbstractHud;
import com.jme3x.jfx.GuiManager;
import com.jme3x.jfx.cursor.proton.ProtonCursorProvider;

import javafx.collections.FXCollections;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Region;

public class Test extends SimpleApplication {
    public static void main(String[] args) {
        new Test().start();
    }

    @Override
    public void simpleInitApp() {
        setPauseOnLostFocus(false);
        flyCam.setDragToRotate(true);
        viewPort.setBackgroundColor(ColorRGBA.Black);

        GuiManager manager = new GuiManager(this.guiNode, this.assetManager, this, true, new ProtonCursorProvider(this, this.assetManager, this.inputManager));
        inputManager.addRawInputListener(manager.getInputRedirector());

        manager.attachHudAsync(new AbstractHud() {
            @Override
            protected Region innerInit() throws Exception {
                BorderPane pane = new BorderPane();

                pane.setCenter(new ComboBox<String>(FXCollections.observableArrayList("Foo", "Bar", "Baz")));

                return pane;
            }
        });
    }
}

Using Java 8u45, JME 3.0.10 and JME3-JFX 1.158.2015-05-08_141516-3ff16e5, in fullscreen mode on Windows 8.1, nets you a centered ComboBox, that you can open, but not interact with. In windowed mode, everything works perfectly.

After poking around with a debugger, the snappers are there, and active, but don't seem to be capturing input for the popup, you just click through it.

mthomason12 commented 9 years ago

Possibly related to this - popups opened in windowed mode (Windows 8.1) do not follow the window when moved. Example: Add a menubutton to a windowed application, open the menu, then drag the window around. Ideally, these should follow the application window around, rather than remain floating on the desktop.

The root cause appears to be that they're being left as popups, rather than rendered within the JME window along with the rest of the UI (hence the issues with fullscreen above - the popup is actually generated as a seperate window and then input gets lost to the fullscreen app) - while this is the correct behavior for a standard JavaFX application, if used as a JME GUI I would expect popups to be rendered within the JME window itself. I'm unsure how difficult/impossible a task this will be to change, however.