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 3521 - SDL_SetWindowFullscreen call on existing window results in error under Wayland backend: That operation is not supported
Summary: SDL_SetWindowFullscreen call on existing window results in error under Waylan...
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Gabriel Jacobo
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-14 20:08 UTC by sebby2k
Modified: 2018-11-07 00:13 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sebby2k 2016-12-14 20:08:19 UTC
= Description

This occurs when trying to reconfigure previously opened window to make it full-screen. Relevant code is listed below.

= Output 

QUAKE ERROR: Couldn't set fullscreen state mode: That operation is not supported

= Environment

Fedora 25 running Gnome Wayland session.

Name        : gnome-shell
Arch        : x86_64
Epoch       : 0
Version     : 3.22.2
Release     : 2.fc25

Name        : SDL2
Arch        : x86_64
Epoch       : 0
Version     : 2.0.5
Release     : 2.fc25

== Code 

draw_context variable contains existing SDL_Window* so first part which creates window is skipped.

if (!draw_context)
{
    flags = SDL_WINDOW_HIDDEN;

    if (vid_borderless.value)
        flags |= SDL_WINDOW_BORDERLESS;
    
    draw_context = SDL_CreateWindow (caption, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, flags);
    if (!draw_context)
        Sys_Error ("Couldn't create window");

    SDL_VERSION(&sys_wm_info.version);
    if(!SDL_GetWindowWMInfo(draw_context,&sys_wm_info))
        Sys_Error ("Couldn't get window wm info");
}

/* Ensure the window is not fullscreen */
if (VID_GetFullscreen ())
{
    if (SDL_SetWindowFullscreen (draw_context, 0) != 0)
        Sys_Error("Couldn't set fullscreen state mode");
}

/* Set window size and display mode */
SDL_SetWindowSize (draw_context, width, height);
SDL_SetWindowPosition (draw_context, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
if (SDL_SetWindowDisplayMode (draw_context, VID_SDL2_GetDisplayMode(width, height, bpp)) != 0)
    Sys_Error ("Couldn't set display mode for fullscreen: %s", SDL_GetError());
SDL_SetWindowBordered (draw_context, vid_borderless.value ? SDL_FALSE : SDL_TRUE);

/* Make window fullscreen if needed, and show the window */
if (fullscreen) {
    if (SDL_SetWindowFullscreen (draw_context, SDL_WINDOW_FULLSCREEN) != 0)
        Sys_Error ("Couldn't set fullscreen state mode: %s", SDL_GetError());
}

SDL_ShowWindow (draw_context);
Comment 1 Sebastian Krzyszkowiak 2018-11-07 00:13:44 UTC
That seems like something already fixed by adding the xdg-shell support.