Center windows after recreateWindow() call

after using the recreateWindow() call in jme1, the window is no longer centered in the monitor.



why not add:



if ( !fs ) {
                int x, y;
                x = ( Toolkit.getDefaultToolkit().getScreenSize().width - width ) >> 1;
                y = ( Toolkit.getDefaultToolkit().getScreenSize().height - height ) >> 1;
                Display.setLocation( x, y );
            }



to the private void reinitDisplay() Method in the class LWJGLDisplaySystem ? That would be the new code:


private void reinitDisplay() {
        // create the Display.
        DisplayMode mode = selectMode();

        try {
            Display.releaseContext();
            Display.setDisplayMode( mode );
            Display.setFullscreen( fs );
            Display.makeCurrent();
            if ( !fs ) {
                int x, y;
                x = ( Toolkit.getDefaultToolkit().getScreenSize().width - width ) >> 1;
                y = ( Toolkit.getDefaultToolkit().getScreenSize().height - height ) >> 1;
                Display.setLocation( x, y );
            }
        } catch ( Exception e ) {
            logger.logp(Level.SEVERE, this.getClass().toString(), "reinitDisplay()", "Cannot recreate window", e);
            throw new Error( "Cannot recreate window: " + e.getMessage() );
        }
    }

no one has to say something? I think this is a very important function

Umm, jME 1.0 is frozen…



Could this be used in jME 2.0?



(also, what implications does this have on AWT and Applet implementations?)

oh finally an answer :smiley:



ah ok if jme1 is frozen i hope this will be implemented in jme2 because now i have to modify this code in every project… i wonder why nobody else has this problems.

hmm, the more and more I look at this, the more it seems that maybe this patch should be put into LWJGL directly…



(The graphics window in questions is actually a native LWJGL window…)



Perhaps if you just used the moveWindowTo(int locX, int locY); method in DisplaySystem after resizing…





Does anyone else have something to add?  (maybe it SHOULD be patched in jME…)





Also, Sebastian23 can you make a quick test showing the problem?  I think ppl would understand and be able to help more if you did…