Skip to content

Can't immediately set window position after setting it to borderless #5274

@autoit4you

Description

@autoit4you

Hello,

while working on a project of mine I noticed I could not set the window position after setting it to be borderless because it crashes with the following error in the console:

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  40 (X_TranslateCoords)
  Resource id in failed request:  0x2802c77
  Serial number of failed request:  254
  Current serial number in output stream:  254

I'm using ArchLinux with:
Kernel: 5.16.3
Xorg: 21.1.3
SDL: 2.0.20

I found that with the following C-code I could reproduce it every single time I tried executing it:

#include "SDL.h"

int main(int argc, char** argv)
{
    SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
    SDL_Window* sdl_window = SDL_CreateWindow("test", 0, 0, 800, 600, SDL_WINDOW_OPENGL);

    SDL_Delay(1000);
    SDL_SetWindowBordered(sdl_window, SDL_FALSE);
    //SDL_Delay(1000); //nolonger crashes if you uncomment this
    SDL_SetWindowPosition(sdl_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
    SDL_Delay(1000);

    SDL_DestroyWindow(sdl_window);
    SDL_Quit();
    return 0;
}

I could not find any existing discussion about this error, if there is/was please direct me there :)

Kind regards
Jonathan

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions