We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3779 - Enter and leave events when window is minimized
Summary: Enter and leave events when window is minimized
Status: RESOLVED WORKSFORME
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.5
Hardware: x86_64 macOS 10.12
: P2 trivial
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-26 05:10 UTC by Indiana Kernick
Modified: 2017-08-29 15:31 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Indiana Kernick 2017-08-26 05:10:12 UTC
While the window is minimized. The application still receives SDL_WINDOWEVENT_ENTER and SDL_WINDOWEVENT_LEAVE events as if the window was still visible.

Reproducing this bug is easy. Write an SDL app that opens a window and prints out enter and leave events. Run the application, minimize the window and move the mouse in and out of the area where the window was when it was visible. You should see that the application receives enter and leave events while the window is minimized.
Comment 1 Sam Lantinga 2017-08-28 01:48:03 UTC
Are you reproducing this on Mac OS X? I'm trying here, running testsprite2 --info event, and I'm not seeing this behavior.
Comment 2 Indiana Kernick 2017-08-28 07:22:53 UTC
Yes, this behaviour was observed on MacOS 10.12
Comment 3 Sam Lantinga 2017-08-28 16:32:20 UTC
I'm running 10.12.6. Are you seeing the problem with the testsprite2 example?
Comment 4 Indiana Kernick 2017-08-29 03:50:11 UTC
I modified the event loop in testsprite2 to include:

if (event.type == SDL_WINDOWEVENT) {
  if (event.window.event == SDL_WINDOWEVENT_ENTER) {
    printf("Enter\n");
  } else if (event.window.event == SDL_WINDOWEVENT_LEAVE) {
    printf("Leave\n");
  }
}

and I'm still seeing the bug. I also noticed something else. The sprites slow down while the window is being dragged. Interesting.
Comment 5 Sam Lantinga 2017-08-29 05:06:00 UTC
That's weird, I made the same change and I'm totally not seeing this bug.

Are you using the latest SDL snapshot?
http://www.libsdl.org/tmp/SDL-2.0.zip
Comment 6 Indiana Kernick 2017-08-29 06:39:08 UTC
I just downloaded the latest snapshot from the link you provided. SDL-2.0.6-11410 and I'm still seeing the bug. I'm running a slightly older version of MacOS than you are 10.12.1 so could this be a bug with MacOS that was fixed in later versions? This might explain why I'm seeing the bug and you're not. If that is possible then I'll mark this bug as resolved and we can move on.

PS

While I've got an SDL developer with me, I'd like to take this opportunity to ask a question.

Is there a simple way to stop the window from turning black while the window is being resized? This seems to be a common problem but I'm not seeing a solution anywhere. I'm just using the SDL rendering API not (OpenGL).
Comment 7 Sam Lantinga 2017-08-29 15:31:40 UTC
Yeah, I think it's probably been fixed. Feel free to reopen this if you have more information or it's not fixed for you in the future.

I don't know of any way to avoid the black screen. As far as I know the SDL code isn't executing during the resize.