We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5400 - No SDL_WINDOWEVENT_RESIZED event after after leaving fullscreen on Windows
Summary: No SDL_WINDOWEVENT_RESIZED event after after leaving fullscreen on Windows
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: don't know
Hardware: x86_64 Windows (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-16 18:42 UTC by Roman Shuvalov
Modified: 2020-12-16 21:31 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Shuvalov 2020-12-16 18:42:42 UTC
After leaving fullscreen (SDL_SetWindowFullscreen(window, 0)), SDL_WINDOWEVENT_RESIZED event appears on Linux version but doesn't appear on Windows.

Minimal program to reproduce error:

// ------

#include <SDL2/SDL.h>

SDL_Window* window;
int fs = 0;

void toggle_fs() {
    fs ^= 1;
    printf("Setting fullscreen to %d\n", fs);
    SDL_SetWindowFullscreen( window, fs ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
};

int main (int argc, char ** args) {

    if( SDL_Init( SDL_INIT_EVERYTHING ) != 0 ) {
        return 1;
    };
    window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 400, 300, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE );
    if ( window == NULL ) {
        return 1;
    };
    int quit = 0;
    SDL_Event e;
    while ( !quit ) {
        while( SDL_PollEvent( &e ) != 0 ) {
            if ( e.type == SDL_KEYDOWN ) {
                toggle_fs();
            }
            else if (e.type == SDL_WINDOWEVENT) {
                if (e.window.event == SDL_WINDOWEVENT_RESIZED) {
                    printf("Got SDL_WINDOWEVENT_RESIZED event\n");
                };
            }
            else if( e.type == SDL_QUIT ) {
                quit = 1;
            };
        };
        SDL_Delay(100);
    };
    SDL_DestroyWindow(window);
    SDL_Quit();
    return 0;
};

// ------

Results on Linux:

Setting fullscreen to 1
Got SDL_WINDOWEVENT_RESIZED event
Setting fullscreen to 0
Got SDL_WINDOWEVENT_RESIZED event
Setting fullscreen to 1
Got SDL_WINDOWEVENT_RESIZED event
Setting fullscreen to 0
Got SDL_WINDOWEVENT_RESIZED event

Results on Windows:

Setting fullscreen to 1
Got SDL_WINDOWEVENT_RESIZED event
Setting fullscreen to 0
Setting fullscreen to 1
Got SDL_WINDOWEVENT_RESIZED event
Setting fullscreen to 0
Comment 1 Roman Shuvalov 2020-12-16 19:53:02 UTC
Also, SDL_GetWindowSize() after SDL_SetWindowFullscreen() on Windows returns new size, but on Linux it returns previous size which is not actual.