| Summary: | New window and glcontext swap after toggle to fullscreen mode causes input focus loss | ||
|---|---|---|---|
| Product: | SDL | Reporter: | nemo.nixto |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | icculus |
| Version: | 2.0.3 | ||
| Hardware: | x86_64 | ||
| OS: | Windows (All) | ||
| Attachments: | Code. | ||
Yikes, I'm not sure this approach was ever meant to work reliably (fullscreen exclusive window with fullscreen_desktop window built on top of it, the second steals the first's GL context then the first window is destroyed). Is there a real-life scenario where you need this sort of thing? We might have to mark this WONTFIX in any case. That being said, I'm wondering if the problem you're seeing isn't a loss of input focus, but a failure to get a working GL context on the second window, due to some changes we might have made to context handling. Does the SDL_PollEvent() call really never get SDL_KEYDOWN events after you press return, or does it simply never manage to draw anything, so it looks like it never got a key press again? --ryan. Sorry for the delay in response, Holidays 'n all, (Happy New Year btw:) The reason for all of this is to change screen res without having to remake all the textures and display lists (yes, i still use display lists ... i'm old and set in my ways). If there is a preferred method, i'm all ears. The SDL_WINDOW_FULLSCREEN_DESKTOP was actually malfunctioning so i went back to just the SDL_WINDOW_FULLSCREEN. As for the SDL_Pollevent(), it does indeed draw in the actual game it gets input from controllers and if you aren't using a keyboard you don't notice. -andrew (In reply to nemo.nixto from comment #2) > The reason for all of this is to change screen res without having to remake > all the textures and display lists (yes, i still use display lists ... i'm > old and set in my ways). If there is a preferred method, i'm all ears. You can change the screen res in SDL2 without losing your existing window or GL context (this was not true in SDL 1.2). --ryan. (In reply to Ryan C. Gordon from comment #3) > You can change the screen res in SDL2 without losing your existing window or > GL context (this was not true in SDL 1.2). To clarify: SDL_SetWindowDisplayMode() would be an option, or you could toggle to windowed mode with SDL_SetWindowFullscreen(win, 0), change the window size with SDL_SetWindowSize(), and change it back to fullscreen. (or some combination therein.) SDL_WINDOW_FULLSCREEN_DESKTOP mode removes your control over the resolution of the display, but you can still force the resolution with SDL_WINDOW_FULLSCREEN. --ryan. Thank you! You are correct - yahoo! It is a good New Year after all :) A (In reply to nemo.nixto from comment #5) > You are correct - yahoo! It is a good New Year after all :) :) I'm going to mark this as WONTFIX, since it might be something that we do wrong with two fullscreen windows competing, but it's not worth fixing in that case. Enjoy your working single window. :) --ryan. |
Created attachment 2334 [details] Code. I'm working on a windows 10 machine but i've tested on a windows 7 and an 8.1 and they all have the same result. Switching from windowed to fullscreen followed by a new window and glcontext swap used to preserve keyboard input focus in SDL2.dll version 2.0.1. The current version (2.0.3) and 2.0.4 of the dll loses input focus. Additionally, SDL_GetWindowFlags reports that the window does indeed have INPUT_FOCUS, when it clearly doesn't. I tried to force focus using SDL_RaiseWindow, SDL_SetWindowGrab(SDL_TRUE) and eventually using Window's SetFocus() with HWND provided by SDL. No dice. I've attached the code. Color in the window changes on pressing space. Fullscreen toggles when pressing return.