Resize window Issue in Mac and Windows Build after updating 2.4

Hi @slackmoehrle, @huanxinyin I get a new problem regarding resizing windows after updating to 2.4.
In 1.8.2 I made changes in CCGLViewImpl-desktop.cpp file in this function for different size of windows

static void onGLFWWindowSizeFunCallback(GLFWwindow *window, int width, int height)
{
        if (_view){
            cocos2d::Size screenSize = cocos2d::Size::ZERO;
            GLFWmonitor *monitor = glfwGetPrimaryMonitor();
            if (nullptr != monitor) {
                const GLFWvidmode* videoMode = glfwGetVideoMode(monitor);
                screenSize = cocos2d::Size(videoMode->width, videoMode->height);
            }
            int w = screenSize.width/2.036;
            int h = screenSize.height/2.236;           
            if (width <= w || height <=h)
            {
                width = w;
                height = h;            
            }
            else if (width <= (screenSize.width/1.9) || height <= (screenSize.height/2.1)){
                width = screenSize.width/1.92;
                height = screenSize.height/2.105;
            }else if(width >= screenSize.width || height >= screenSize.height){
                width = screenSize.width/1.0052;
                height = screenSize.height/1.103;
            }_view->onGLFWWindowSizeFunCallback(window, width, height);
        }
    }

But in 2.4 CCGLView-desktop.cpp there is this function

void GLView::onGLFWWindowSizeFunCallback(GLFWwindow *window, int width, int height)
{
int targetWidth = width * _scale, targetHeight = height * _scale;
Application::getInstance()->updateViewSize(targetWidth, targetHeight);
EventDispatcher::dispatchResizeEvent(targetWidth, targetHeight);
}

If I give different width and height to this function as I have done in 1.8.2, it is not working. Please provide a proper solution for this issue.

Hi, we wasn’t encountered this before, I’ll do a test.

Changing the window size using version 2.4 is shown as normal. onGLFWWindowSizeFunCallback does not modify the window size, it is just a status listener function, your implementation must be incorrect.

Hi @huanxinyin in 1.8.2 I have resisted the user resizing the window size because our gameplay was not running properly and UI alignment also gets disrupted that’s why I used that code in 1.8.2, the same I want to use in this 2.4, Please give me some proper solution to do the code in 2.4.

Based on your description, we are unable to determine what your problem is. Please show the comparison between the two versions and provide a test project of 2.4.x.

I have restricted the windows resizing thing to the user in v1.8.2 because our gameplay UI gets disordered and some blank space is left on the right side of the window. Actually the user is setting the sizing of windows according to their need so I want to know how can I control the resizing of windows in v2.4 and I just want that the user will do the resizing in only 2 sizes, first one is 1920*1080 and the second one is 1455 * 746, OR JUST WANT TO STOP USER TO RESIZE THE WINDOWS. Please let me know how to do that.

Ok, in 2.4.2 we not provide a function to control window size, if you want, you need resize window when you receive onGLFWWindowSizeFunCallback.try use glfwSetWindowSize to limit.