The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Event issues on Mac
dandago


Joined: 30 Aug 2013
Posts: 34
I wrote several basic SDL2 tutorials a couple of years ago. I've had several people claim that the code didn't work on a Mac. This one for example:
http://programmersranch.blogspot.com.mt/2014/02/sdl2-pixel-drawing.html

You can see from the comments at the bottom what the issues reported are. Someone also suggests changing the way events are being processed.

I don't have a Mac and haven't been able to investigate these issues. Does anyone have any insight into why these problems occur and how to solve them?
Event issues on Mac
Jonny D


Joined: 12 Sep 2009
Posts: 932
Yeah, the suggestion is to use while(SDL_PollEvent(&event)) instead of SDL_WaitEvent.  Have you tried that?

Jonny D


On Sunday, November 8, 2015, dandago wrote:
Quote:
I wrote several basic SDL2 tutorials a couple of years ago. I've had several people claim that the code didn't work on a Mac. This one for example:
http://programmersranch.blogspot.com.mt/2014/02/sdl2-pixel-drawing.html

You can see from the comments at the bottom what the issues reported are. Someone also suggests changing the way events are being processed.

I don't have a Mac and haven't been able to investigate these issues. Does anyone have any insight into why these problems occur and how to solve them?



Daniel D'Agostino
http://www.programmersranch.com/

Re: Event issues on Mac
dandago


Joined: 30 Aug 2013
Posts: 34
No, because the particular use case is input-driven and SDL_WaitEvent() makes perfect sense.

Does this mean SDL_WaitEvent() doesn't work on Mac, and I always need to use SDL_PollEvent()?
brada


Joined: 16 Aug 2012
Posts: 38
that comment is from 2014, are you sure this is still an issue? In the past I too have had the problem with SDL not dispatching the SDL_QUIT event on Mac OS X; I had to work around it in my application code by implementing applicationShouldTerminate in my app delegate and manually creating the SDL_QUIT event and queuing it with SDL_PushEvent.

No idea about the other issue with nothing being drawn. I do know that mac trackpads send a mix of touch events and mouse events. If the commenters notion of "clicking" is just taping the trackpad then its not going to hit the mouse down. the mousemotion events could not be being sent because it is instead sending touch events too.
dandago


Joined: 30 Aug 2013
Posts: 34
I don't know; as I said I don't have a Mac. I was hoping someone could shed some light on whether this is a bug in SDL2 or I'm doing something wrong. It may well be a bug that's been fixed, but I can't check it myself.
Event issues on Mac
eric.w


Joined: 12 Feb 2014
Posts: 38
I just tested that tutorial ( http://programmersranch.blogspot.com.mt/2014/02/sdl2-pixel-drawing.html ) with SDL2 hg, on OSX 10.11.1, and it works fine for me. I can paint by clicking the laptop's trackpad. (The only things I changed were the new/delete to malloc/free because I was running it inside the SDLTest.xcodeproj, and didn't want to bother configuring it for c++.)
The process also exits when I close the window, as expected.


Cheers,
Eric

On Tue, Nov 10, 2015 at 10:58 AM, dandago wrote:
Quote:
I don't know; as I said I don't have a Mac. I was hoping someone could shed some light on whether this is a bug in SDL2 or I'm doing something wrong. It may well be a bug that's been fixed, but I can't check it myself.



Daniel D'Agostino
http://gigi.nullneuron.net/gigilabs/


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

dandago


Joined: 30 Aug 2013
Posts: 34
Great, thanks for checking.