Hello Guest

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

  • 4 Replies
  • 4504 Views
[FIXED] 2.8.* ignores Linux AWT window re-positioning
« on: October 26, 2011, 09:54:18 »
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
« Last Edit: October 30, 2011, 14:46:25 by kappa »

*

Offline kappa

  • *****
  • 1314
Re: [BUG] 2.8.* ignores Linux AWT window re-positioning
« Reply #1 on: October 26, 2011, 10:41:52 »
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?

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).

Re: [BUG] 2.8.* ignores Linux AWT window re-positioning
« Reply #2 on: October 26, 2011, 12:59:53 »
Sure, here comes a test (Slick2d code more or less):

Code: [Select]
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 :)

*

Offline kappa

  • *****
  • 1314
Re: [BUG] 2.8.* ignores Linux AWT window re-positioning
« Reply #3 on: October 26, 2011, 21:30:59 »
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.

Re: [FIXED] 2.8.* ignores Linux AWT window re-positioning
« Reply #4 on: October 31, 2011, 14:16:53 »
Hello, yes it has been fixed. Thanks!