MZ Fullscreen & Resizable BUG

Hello, well i'm not sure if it a bug or it was intended. If resizable is set to false at the package json and i switch to fullscreen during playtest, my game screen bugs. It will be weirdly still in windowed mode without a border and be firmly attached to the left top corner.

At the early 1.0.2 version (NW.js: 0.45.5) i tested that too, where this screen bug don't occur. Maybe someone knows more about that?
@Choraß: this is how NWJS handles non-resizable windows. I don't think it classifies as a bug (?), because the resizable setting is not present in the default manifest (i.e. package.json) or customisable via the editor.

It should be possible to work around via scripting, since there are methods to change whether a window is resizable or not at runtime:
Feel free to edit this into a Suggestion thread (or post a new one) if you think it would be a worthwhile addition to the core scripts. You can find the suggestion template here:
Otherwise you could ask for a plugin to change the full-screen behaviour:
👋
@caethyril
Hello, thanks for your recommendation. Weird that i don't get any notification of your reply.
this is how NWJS handles non-resizable windows. I don't think it classifies as a bug (?),
Well i thought so, because in earlier MZ versions that screen bug don't occur. About the resizable false function is already handle over a plugin, which change it in the package json, also another method was tested to achieve the false resizable function but since the newer versions, the screen bugs if switch to fullscreen.

Unfortunately any coder i asked couldn't help me yet, even i show them in earlier version it works fine. They said it's a rmz core code change which they can't bypass.
@Choraß: try the attached plugin (code in spoiler below). It seems to work for me? I'm using F4 to enter/leave fullscreen, in case that makes a difference.
Spoiler: full plugin code
JavaScript:
/*:
 * @target MZ
 * @plugindesc Make the game window non-resizable except when full screen.
 * @author Caethyril
 * @help Terms of use: free to use and/or modify for any project.
 */

(() => {
'use strict';

    // only for NWJS
    if (!Utils.isNwjs()) return;

    const getWin = function() {
        return nw.Window.get();
    };

    const allowResize = function() {
        getWin()?.setResizable(true);
    };

    const forbidResize = function() {
        getWin()?.setResizable(false);
    };

    const cleanResize = function() {
        const w = getWin();
        if (w) w.setResizable(w.isFullscreen);
    };

    (alias => {
        Graphics.initialize = function() {
            const r = alias.apply(this, arguments);
            const w = getWin();
            w.on('enter-fullscreen', allowResize);
            w.on('resize', cleanResize);
            return r;
        };
    })(Graphics.initialize);

    (alias => {
        Graphics.resize = function() {
            allowResize();
            alias.apply(this, arguments);
        };
    })(Graphics.resize);

})();
(I'll send you a private message in case you don't get a direct notification.)

[Edit: removed enter-fullscreen and restore listeners, because they were redundant and the latter was interfering with the game's real-scale update code after un-minimising. Updated attachment and code spoiler.]

[Edit 2: restored the enter-fullscreen listener because that one's actually necessary since it fires before resize, rather than after. 😔 Updated attachment and code spoiler.]
@caethyril
You are great! It seems to work for me too. Just the maximize button still not be out greyed and at the window border the drag arrows still appear when you move the cursor over it. If it not ask too much already, could you fix that too?
For me, the maximise button automatically gets disabled when the window is not resizable, presumably because maximising the window is a form of resizing:

greyMax.jpg
Did you mean you want it to be enabled? I don't see a way to enable the maximise button but not resizing in general using JavaScript.

I can't find a way to disable the resize cursor via JavaScript, either. You might need some kind of C++ add-on for NWJS to do stuff like that. 😴

Is the main problem solved? If so, I'll lock the thread and move it somewhere more appropriate.

PS: I made a small edit to the plugin I posted earlier.
For me, the maximise button automatically gets disabled when the window is not resizable, presumably because maximising the window is a form of resizing:
Good to know, hm unfortunately on my side it's not.


Did you mean you want it to be enabled? I don't see a way to enable the maximise button but not resizing in general using JavaScript.
No, to disabled it for visual purpose it's not available.

Is the main problem solved? If so, I'll lock the thread and move it somewhere more appropriate.
Yes it is, thank you very much! I had so much trouble about that, you are truly lifesaver. :LZSproud:
Great!

I've moved this thread to JS Plugin Requests. Thank you.

I'll leave the thread open for now in case you (or anyone else) has problems with it~

Edit: I can press the maximize button, but only if I get it before the game loads. If I add "resizable": false to package.json then the maximize button is always disabled for me (it starts not resizable, then the plugin takes over). I'm not sure why you'd see that kind of difference...are you using a Mac, maybe? Or any other plugins?
Edit: I can press the maximize button, but only if I get it before the game loads.
On my side until i try to drag the screen, then the maximize button is disabled (but not greyed out).

I'm not sure why you'd see that kind of difference...are you using a Mac, maybe? Or any other plugins?
Just testing the plugin without another one and on Windows 10.
On my side until i try to drag the screen, then the maximize button is disabled (but not greyed out).

Just testing the plugin without another one and on Windows 10.
That's strange. Typically the appearance should match the internal state, i.e. faded when disabled. 😅

Out of interest, if you open the console (F8 during playtest) and type this:

process.versions.nw
...then press Enter, what version number does it return? RMMZ ships with NW v0.48.4, but if you've updated to a newer version then that might be causing discrepancies.

Perhaps someone else has some ideas/input here...?
Out of interest, if you open the console (F8 during playtest) and type this:

process.versions.nw

...then press Enter, what version number does it return? RMMZ ships with NW v0.48.4, but if you've updated to a newer version then that might be causing discrepancies.
I get: process.versions.nw
"0.48.4"

Edit
Did some research and can say with certainty the bug about if resizable is set on false, the game screen bug on fullscreen. That will be weirdly attached in the left-top corner, without a border and still be in windowed mode.

Appear from NW.js: 0.47.2 / 08-05-2020 build.
snip0.47.2njs.PNG


Incorrect handling of borders when resizable is false #7521

Also a similar screen bug was mentioned in this thread: How to Update NW.js to Dramatically improve Game Performance!

Thanks again @caethyril for your help.

Still think it's a bug in the newer versions but anyway i could solved it by the plugin.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/fullscreen-resizable-bug.144327/