SDL2 Window is initialized with a fixed and unchangeable value

446 Views Asked by At

I can't seem to specify the size of my window in SDL2 as no matter what value I pass it as width and height it simply ignores it and uses a size of about 850 x 550 px. For example:

const int SCREEN_WIDTH = 100;
const int SCREEN_HEIGHT = 100;

window = SDL_CreateWindow(WINDOW_TITLE, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);

results on this: window size example

A pastebin to my code if needed

1

There are 1 best solutions below

3
On

You need to tell your window manager i3wm to treat the window as floating. You can either do this with a hotkey (the default is apparently "$mod+Shift+Space"), i3wm configuration, or window manager hints.

You may achieve the latter by passing an extra flag SDL_WINDOW_UTILITY to the SDL_CreateWindow call.