| Summary: | Multiple monitors on Linux: Fullscreen minimizes on focus switch to different monitor | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Gerry JJ <trick> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | amaranth72, Espionage724, gabomdq, john, k0009000 |
| Version: | HG 2.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
|
Description
Gerry JJ
2013-07-04 00:50:25 UTC
It does the same thing in OS X when you switch focus from a fullscreen-desktop window, it's pretty annoying. To work around the issue you can disable all minimization on focus loss with: SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); Also related to unwanted minimization: http://bugzilla.libsdl.org/show_bug.cgi?id=1840 How about a patch that adds a new hint to SDL2.1 that limits SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS to only triggering if the active window is on the current screen, something like SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS_CURRENT_SCREEN_ONLY (damn, this _needs_ a shorter name)? Need input on that, because it'll be my first SDL patch and I want to get it right the first time. Also, can anyone test what other platforms affected? Also, I assume hints can be limited to some platforms, because MINIMIZE_ON_FOCUS_LOSS doesn't make much sense on mobile either. > SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS to only triggering if the active
> window is on the current screen, something like
*new active window
So I tried detecting which screen the window belongs to, and it seems to be very possible with some xcb magic. Python source: http://paste2.org/OkZO0Bg5 (that uses parts of libqtile for readability/writeability/etc, but in the end it's pure xcb). On Windows, it seems to be possible with GetForegroundWindow ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms633505%28v=vs.85%29.aspx ) and MonitorFromWindow ( http://msdn.microsoft.com/en-us/library/dd145064%28v=vs.85%29.aspx ), but that will need more testing because I don't have Windows on this machine. I can't say anything about OS X because I'm too poor to buy a Mac, so any help on the Mac parts is very much welcome. Another idea: how about checking if the focused window overlaps the game window by >= some pixels? That's probably easier than doing screen detection, because there's less math involved and it might be more portable, too. This was fixed recently. |