(SDL2 Linux)Creating Fullscreen Window Broken

Hi there!

So I have my own Vulkan application where this is a problem, but this also happens with Yamagi Quake 2 which uses SDL2 & OpenGL.

I’ve built SDL2 2.0.9, and I’ve tried 2.0.8, and I’m running on Pop!_OS 19.04.

For one, calling SDL_CreateWindow() with both SDL_WINDOW_FULLSCREEN and SDL_WINDOW_RESIZABLE flags just doesn’t work, it crashes.

But even if you omit SDL_WINDOW_RESIZABLE, the fullscreen app does not gain focus properly.

I have to Super+Tab (maybe Alt+Tab would work too) a couple times before it gains focus, and a lot of the time it will just give me a blank screen, sometimes it will magically work and render properly.

Windowed mode works totally fine as far as I can tell.

I do have a two monitor setup, but I tried disabling one of my displays. Other than that, the only “special” thing about them is they’re both high refresh rate 144Hz monitors, and everything works fine under Windows 10.

Any idea what’s going on here?

Yamagi Quake II doesn’t use SDL_WINDOW_RESIZABLE (not even in windowed mode).

Focus issues are likely to be window manager bugs - and TBH if fullscreen was generally broken on Linux in both SDL 2.0.8 and 2.0.9, people would have complained before, but I can’t remember any such report in this forum or the YQ2 or dhewm3 bugtrackers.

Fullscreen and resizable together doesn’t really make sense - shouldn’t crash though. I just added this flag to the window flags in YQ2 just for testing, and it didn’t crash or have focus issues - not in windowed mode, not in “keep resolution fullscreen” (SDL_WINDOW_FULLSCREEN_DESKTOP) and neither in “switch resolution fullscreen” (SDL_WINDOW_FULLSCREEN) - using the SDL2 2.0.8 that comes with my XUbuntu 18.04.
I’m using two 1920x1200@60hz displays and XFCE.
Maybe this is a bug in your window manager or GPU driver or something?

1 Like

I know Yamagi Quake II doesn’t, I just have my own application where I was simply appending the SDL_WINDOW_FULLSCREEN flag if configured to be fullscreen.

I’ve solved most of it. I came across this: http://anki3d.org/solving-the-linux-multi-monitor-problem-with-sdl-2-0/

I installed libxinerama-dev as SDL wasn’t picking up on my multiple displays, rebuilt SDL2, and that fixed some things.

The focus problem is actually related to the way my monitors are positioned.

You’ll see my Primary Display is my “Microstep” monitor. My “Microstep” monitor is considered Display 2. If I position my “Microstep” monitor to the left, like in this screenshot:

SDL2 breaks and has weird focusing issues where I have to Alt+Tab to make it sometimes work.

Lastly, Dash to Dock was actually causing a window resize event in my own application because I had auto-hide off, and that was causing issues as well.

SO, the one thing I need is to be able to setup my monitor positions how I want them.

Oh yeah, if SDL2 is missing dependencies during build that can cause issues.
Apart from libxinerama you should also make sure you have libxrandr-dev installed for proper multi-monitor support; at the end of SDLs ./configure you should check what’s enabled and disabled and if anything is disabled that sounds like it might be useful, make sure to install the development package for it.
(shortcut: you should be able to install the dev packages used to build the official sdl2 package of your distro with sudo apt build-dep libsdl2-2.0-0 on debian-derived distros like *Ubuntu or Pop OS which AFAIK is based on Ubuntu)

1 Like

Thanks! That was it. I’ve gotten into the habit of building it from source because I know the SDL2 version in the Ubuntu repos a while back didn’t come pre-built with Vulkan support. That may have changed

But yes, installing both libxrandr-dev and libxinerama-dev, rebuilding SDL2, and rebuilding the apps has fixed everything.

Thank you so much for your help!

1 Like

Great, glad it works now! :slight_smile: