| Summary: | Bug on SDL events... | ||
|---|---|---|---|
| Product: | SDL | Reporter: | pouer <yoann.lecuyer> |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | bombasticbryan, spartanj |
| Version: | 1.2.13 | Keywords: | target-1.2.14 |
| Hardware: | x86 | ||
| OS: | Windows (XP) | ||
| Attachments: | Test case for the window resize event | ||
You don't get a video resize event when you iconify the window. You get an app active event instead. Go ahead and reopen this bug if you're talking about maximizing and restoring instead. Nevermind, it appears you're talking about restoring after maximizing. I'll look into this. Tagging this bug with "target-1.2.14" so we can try to resolve it for SDL 1.2.14. Please note that we may choose to resolve it as WONTFIX. This tag is largely so we have a comprehensive wishlist of bugs to examine for 1.2.14 (and so we can close bugs that we'll never fix, rather than have them live forever in Bugzilla). --ryan. Are you still getting this issue with the latest SDL snapshot? http://www.libsdl.org/tmp/SDL-1.2.zip I just tried the included testwm test and got the following (expected) output by minimizing, restoring, maximizing, restoring: Title was set to: Testing 1.. 2.. 3... Running in windowed mode App gained mouse focus App lost mouse focus App lost active input focus App has been iconified App gained active input focus App has been restored App gained mouse focus App lost mouse focus App gained mouse focus Got a resize event: 1920x1138 App lost mouse focus Running in windowed mode App gained mouse focus App lost mouse focus Got a resize event: 640x480 Running in windowed mode App gained mouse focus Key pressed: 27-escape modifiers: (none) Posting internal quit request Handling internal quit request Bye bye.. App lost input focus Key released: 27-escape modifiers: (none) I'm having a problem restoring the previously maximized window and i think it's related with this bug report. To avoid the lost of opengl context (in win32) i resize the window calling SetWindowPos (instead of calling SDL_SetVideoMode), thanks to the fix of this bug: http://bugzilla.libsdl.org/show_bug.cgi?id=713 now i can do this, but still have one problem. That's what happen to me: First create the window, then click on the maximize button, i receive the SDL_VIDEORESIZE event, so i resize the window and keep the context (no problem here), but, if i click on the maximize button again to restore the window, the SDL_VIDEORESIZE never happen. But... if before maximizing the window i resize the window calling SetWindowPos, and THEN click on the maximize button, and restore it, the SDL_VIDEORESIZE works perfectly well... So for the moment i made a hack to avoid this problem, i create the window with an extra pixel, and then resize the window calling SetWindowPos without that extra pixel, and it works fine, but it's not an elegant solution. Hope someone understand my poor explanation. Thanks in advice, and sorry for my bad English. PD: You can look my ugly solution at this diff file http://code.google.com/p/eepp/source/diff?spec=svn85&r=85&format=side&path=/trunk/cengine.cpp Can you try with the latest snapshot and removing your hack? I modified testgl.c to be resizable and it worked with no problems here. Hi Sam! I tried removing my patch and re-compiling the with latest version, but i'm still getting the same problem. Tell me if you need an example version to replicate the problem and i'll do it. Thanks for you help! Yes, a test case would be great. Thanks! Created attachment 425 [details]
Test case for the window resize event
Perfect! To test what i'm talking about just maximize the window and then restore it (unmaximize), the unmaximize event is not handled. Thanks! Oh yeah, you're not allowed to manipulate the window yourself like you're doing. You should be calling SDL_SetVideoMode() in response to the resize message. This updates SDL's internal data structures and prevents it from generating or hiding messages during the resize. Try replacing AdjustWindowRect() and SetWindowPos() with SDL_SetVideoMode() and you should be fine. :) Actually, I'm waiting to hear back before closing this bug. I tested this with a modified version of testgl.c which calls SDL_SetVideoMode() in response to SDL_VIDEORESIZE and resets the viewport, and everything worked fine. Can you try this in your application and see if it works for you? Hi Sam, Yes, i tried using SDL_SetVideoMode, and it works as you expect. I'm not calling SDL_SetVideoMode because i can't lose the OpenGL context, i'm using this code for an image viewer and the window is resized constantly, so i tried this method and it worked well until i saw this little problem, so i'll keep my little hack that works fine for me. I just thought that this could be fixed internally on SDL. So, close this bug. Thanks for you help Sam! :) With the latest version of SDL (1.2.14) you no longer lose your context when you resize the window, so you should be good once that's released today. FYI, you can try out the pre-release here: http://www.libsdl.org/tmp/release/ Great! I didn't know that it was fixed! :) I tested and it's working perfectly. Thanks for the link! You're welcome! |
SDL don't send SDL_VIDEORESIZE event when we minimize the window. An exemple : //main.cpp //init int size = 0; while (1) { SDL_PollEvent(&event); switch(event.type) { case SDL_QUIT: exit(0); break; case SDL_VIDEORESIZE: size ^= 1; if (size) SDL_WM_SetCaption("Big...", NULL); else SDL_WM_SetCaption("Litle", NULL); break; } } You can show that the window's title change only when we maximize the window.