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 2644 - Application needs to handle draw event on OS X
Summary: Application needs to handle draw event on OS X
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.3
Hardware: All Mac OS X (All)
: P2 enhancement
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.4, triage-2.0.4
: 2066 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-07-15 15:42 UTC by David
Modified: 2015-05-26 15:02 UTC (History)
4 users (show)

See Also:


Attachments
Patch to add draw event (2.27 KB, patch)
2014-07-15 15:42 UTC, David
Details | Diff
Updated patch using SDL_WINDOWEVENT_EXPOSED (1.33 KB, patch)
2014-07-16 05:33 UTC, David
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David 2014-07-15 15:42:07 UTC
Created attachment 1757 [details]
Patch to add draw event

On OS X the OS will sometimes send a drawRect: event to the content view so that the window contents are redrawn. It is most noticeable during window resizing or full screen transitions. When the OS sends this event the application has to draw something or else the user will just see a the window background color (which is black for SDL). Under normal circumstances the application will not receive this event except during window operations.

Usually the application will want to render an entire frame or the application should render into an offscreen frame buffer every frame and then blit the frame buffer whenever a draw event occurs.

Attached is a patch that adds a new window event SDL_WINDOWEVENT_DRAW. It is best to handle this event in the event filter because the draw operation has to be synchronized with the OS screen drawing. This patch is not a breaking change because applications that ignore this event is will get the same behavior as before.
Comment 1 Alex Szpakowski 2014-07-15 22:14:42 UTC
The existing SDL_WINDOWEVENT_EXPOSED window event should probably be used, rather than creating a whole new window event..
Comment 2 David 2014-07-16 05:32:24 UTC
After reviewing the code more, I agree with you about using SLD_WINDOWEVENT_EXPOSED. I have attached a new patch using SDL_WINDOWEVENT_EXPOSED.
Comment 3 David 2014-07-16 05:33:27 UTC
Created attachment 1760 [details]
Updated patch using SDL_WINDOWEVENT_EXPOSED
Comment 4 Ryan C. Gordon 2015-02-19 06:32:15 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry
if you got a lot of email from this. This is to help me sort through some bugs
in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4,
though!
Comment 5 Alex Szpakowski 2015-02-23 04:06:58 UTC
Related issue (or a duplicate of?): https://bugzilla.libsdl.org/show_bug.cgi?id=2066
Comment 6 Ryan C. Gordon 2015-02-24 04:41:11 UTC
*** Bug 2066 has been marked as a duplicate of this bug. ***
Comment 7 Ryan C. Gordon 2015-04-07 04:57:53 UTC
(sorry if you get a lot of copies of this email, I'm marking several bugs at once)

Marking bugs for the (mostly) final 2.0.4 TODO list. This means we're hoping to resolve this bug before 2.0.4 ships if possible. In a perfect world, the open bug count with the target-2.0.4 keyword is zero when we ship.

(Note that closing a bug report as WONTFIX, INVALID or WORKSFORME might still happen.)

--ryan.
Comment 8 Ryan C. Gordon 2015-05-26 15:02:46 UTC
This is now fixed in https://hg.libsdl.org/SDL/rev/b381999d8944, thanks!

--ryan.