Strange window focus behavior


#1

Hi,

For some reason window focus behaves a bit oddly. Perhaps it’s a SDL on Mac specific issue.

I have two windows. When I switch to another app, and click on one of the windows, always one window (the main window?) pops to the front. This could be the window I clicked on, but often it’s not, and the window I clicked (which was on top of the ‘main’ window) disappears to the background and I have to click it again to give it focus. Do you also see this issue on Windows? Is it something SDL related, or does Nap do something w.r.t. sending windows to the front when the app is foregrounded?


#2

Window handling (focus) is completely handled by SDL. There is nothing in NAP that deals with focus. I have seen strangle SDL2 window issues on mac before, especially with version 2.05 and below.

My fix at the time was to remove the SDL package installed by homebrew, which was picked up instead of the one that ships with nap. On my mac at home I don’t run into any issues when using the multi window demo.

Is there any way you can verify that your NAP app doesn’t run against an older version of SDL?


#3

I put a call to SDL_GetVersion in our app init, and this is what I got,

We compiled against SDL version 2.0.8 ...
But we are linking against SDL version 2.0.8.

Seems ok right? I have SDL installed through homebrew as well, but I think that’s an older version. I faintly remember seeing similar issues with another multi-window SDL app on Mac. I will try to reproduce it when I get back to it. For now, it suffices to know SDL is in charge of raising the window on app focus. Probably just means it’s SDL misbehaving a little.