[FIXED] Display.Resizable-flag not honored when changing window size by code

Started by Simon Felix, January 30, 2012, 23:35:19

Previous topic - Next topic

Simon Felix

Hi everyone,

it's me. Again. :)

When I create a windowed, resizable Display and later change it's dimensions by calling Display.setDisplayModeAndFullscreen(new DisplayMode(123,456)); the window gets resized but it's no longer resizable. This happens under Windows, LWJGL 2.8.3. I believe changing WindowsDisplay.java this way should do the job:

365	                public void resetDisplayMode() {
366	                try {
367	                        doSetGammaRamp(saved_gamma);
368	                } catch (LWJGLException e) {
369	                        LWJGLUtil.log("Failed to reset gamma ramp: " + e.getMessage());
370	                }
371	                current_gamma = saved_gamma;
372	                if (mode_set) {
373	                        mode_set = false;
374	                        nResetDisplayMode();

   	                        ///////////////////////////////////
   	                        setResizable(this.resizable)
   	                        ///////////////////////////////////
   	                        
375	                }
376	                resetCursorClipping();
377	        }


See http://java-game-lib.svn.sourceforge.net/viewvc/java-game-lib/trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java?revision=3734&view=markup

Cheers,
Simon
Download Cultris II, the fastest Tetris clone from http://gewaltig.net/


Simon Felix

And the award for mostest dumbest person 2012 goes to: ME. And here's a fix that actually works (tested on WinXP/32 and Win7/64) (you can revert r3738):
200	        public void createWindow(DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
201	                close_requested = false;
202	                is_dirty = false;
203	                isMinimized = false;
204	                isFocused = false;
205	                did_maximize = false;
206	                this.parent = parent;
207	                hasParent = parent != null;
208	                long parent_hwnd = parent != null ? getHwnd(parent) : 0;
209	                this.hwnd = nCreateWindow(x, y, mode.getWidth(), mode.getHeight(), Display.isFullscreen() || isUndecorated(), parent != null, parent_hwnd);

   	                ///////////////////////////////////////
   	                //the window is created non-resizable by default. it will be made resizable after showing it, if needed
   	                this.resizable=false;
   	                ///////////////////////////////////////

210	                if (hwnd == 0) {
211	                        throw new LWJGLException("Failed to create window");


Sorry for wasting your time, Matzon.

Cheers,
Simon
Download Cultris II, the fastest Tetris clone from http://gewaltig.net/

Simon Felix

The issue is fixed in the SVN. I think the topic can be moved to the "Resolved Bugs/RFE" forum.
Download Cultris II, the fastest Tetris clone from http://gewaltig.net/