[FIXED] 2.8.* ignores Linux AWT window re-positioning

Started by bjorn, October 26, 2011, 09:54:18

Previous topic - Next topic

bjorn

In 2.7.1 it was possible to run lwjgl in an awt parent canvas and being able to move the window around on the screen. In 2.8.0 and trunk the window wont move anymore. Can this be the cause:

http://java-game-lib.svn.sourceforge.net/viewvc/java-game-lib/trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c?r1=3620&r2=3626

kappa

Odd, that really shouldn't happen, you do mean that the AWT Frame window doesn't move anymore when it has a LWJGL Display.setParent() canvas in it?

Btw which Linux distro and window manager (Gnome/KDE/etc) are you running?

Quote from: bjorn on October 26, 2011, 09:54:18
Can this be the cause:

http://java-game-lib.svn.sourceforge.net/viewvc/java-game-lib/trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c?r1=3620&r2=3626
Its possible but unlikely since that is just a hint to the WM on where you'd like the window to be at when its created and not something that should freeze it in place.

Got a small test case that can reproduce the problem? (or if one the test classes included with LWJGL can produce the problem).

bjorn

Sure, here comes a test (Slick2d code more or less):

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class WontMoveTest extends Frame {
    protected Canvas displayParent;

    public WontMoveTest() {
        removeAll();
        setLayout(new BorderLayout());
        setIgnoreRepaint(true);

        displayParent = new Canvas() {
            public final void addNotify() {
                super.addNotify();
                try {
                    startLWJGL();
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        };

        displayParent.setSize(getWidth(), getHeight());
        add(displayParent);
        displayParent.setFocusable(true);
        displayParent.requestFocus();
        displayParent.setIgnoreRepaint(true);
        setSize(800, 600);
        setVisible(true);
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }

    public void startLWJGL() throws Exception {
        new Thread() {
            public void run() {

                try {
                    Display.setParent(displayParent);
                    Display.setInitialBackground(0.5f, 0f, 0f);
                    Display.create();

                    displayParent.requestFocus();
                } catch (LWJGLException e) {
                    throw new RuntimeException(e);
                }
            }
        }.start();
    }
    
    public static void main(String[] args) {
        WontMoveTest test = new WontMoveTest();
    }
}


The window cant be moved. I'm using Ubuntu 11.04 / Gnome 2.32.1.

Hope it doesn't work for you either :)

kappa

Quote from: bjorn on October 26, 2011, 12:59:53
Hope it doesn't work for you either :)
Unfortunately I couldn't reproduce the issue, could be a issue that only appears on gnome but haven't got that installed so only tested on KDE, none the less, I've attempted a fix where window hints are only added to none Display.setParent() windows. Do please test the latest nightly build of LWJGL to confirm whether the issue has been fixed.

Thanks.

bjorn