Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should toggle fullscreen instead of changing video mode #221

Open
ersohnstyne opened this issue Jan 11, 2021 · 5 comments
Open

Should toggle fullscreen instead of changing video mode #221

ersohnstyne opened this issue Jan 11, 2021 · 5 comments

Comments

@ersohnstyne
Copy link

BUG: Fullscreen just changed but it recreates Window againon the graphics screen!
TO FIX: Change the window between fullscreen and windowed mode without recreate the window:

// Funcion name:
// int video_action(int tok, int val)

// INCORRECT:
r = video_mode(val, w, h);

// CORRECT:
r = video_fullscreen(val);
@parasti parasti changed the title Fullscreen BUG in graphic options Should toggle fullscreen instead of changing video mode Feb 19, 2021
@parasti
Copy link
Member

parasti commented Feb 19, 2021

"Bug" means "wrong results". This is not a bug. There is no "correct" or "incorrect" here. This is just doing something differently.

Should it be done? Maybe.

@ersohnstyne
Copy link
Author

ersohnstyne commented Feb 20, 2021

FOR THE BEST SOLUTION: Use the toggle fullscreen in the graphic settings without recreating the new window. Go to st_common.c in the function video_action(int tok, int val) and change as follows:

        goto_state_full(&st_null, 0, 0, 1);
        r = video_fullscreen(val);
        if (r)
            goto_state_full(&st_video, 0, 0, 1);
        else
        {
            r = video_fullscreen(val);
            if (r)
                goto_state_full(&st_video, 0, 0, 1);
            else
            {
                // Uncomment, if new config features is implemented
                //config_set_d(CONFIG_GRAPHIC_RESTORE_ID, 0);
                //config_set_d(CONFIG_GRAPHIC_RESTORE_VAL1, val);
            }
        }

@ersohnstyne
Copy link
Author

ersohnstyne commented Feb 20, 2021

Secondly, if you're using Mojang Development and using resizeable window, delete that as follows:

static int video_gui(void)
{
    // ...
    if ((id = gui_vstack(0)))
    {
        // DELETE HERE ON BOTTOM
        char resolution[sizeof("12345678 x 12345678")];
        const char* display;
        int dpy = config_get_d(CONFIG_DISPLAY);

        if (!(display = SDL_GetDisplayName(dpy)))
            display = _("Unknown Display");

        gui_space(id);

        if ((jd = conf_state(id, _("Display"), "Super Longest Name", VIDEO_DISPLAY)))
        {
            gui_set_trunc(jd, TRUNC_TAIL);
            gui_set_label(jd, display);
        }

        sprintf(resolution, "%d x %d",
            video.window_w,
            video.window_h);

        if ((jd = conf_state(id, _("Resolution"), resolution,
            VIDEO_RESOLUTION)))
        {
            /*
             * Because we always use the desktop display mode, disable
             * display mode switching in fullscreen.
             */

            if (config_get_d(CONFIG_FULLSCREEN))
            {
                gui_set_state(jd, GUI_NONE, 0);
                gui_set_color(jd, gui_gry, gui_gry);
            }
        }
        // DELETE HERE ON TOP
    }
}

@parasti
Copy link
Member

parasti commented Feb 20, 2021

What.

@ersohnstyne
Copy link
Author

ersohnstyne commented Feb 20, 2021

Build-in resolutions no longer supported during using resizeable window. The graphics will be toggled to fullscreen and windowed mode in the graphics options without recreate any window. Using Emscripten does not work except pressing F11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants