Peeping events from a new thread

Michael Menegakis wrote:> On Wed, Jan 19, 2011 at 11:49 PM, Nathaniel J Fries <@Nathaniel_J_Fries> wrote:

SDL_PollEvents does; and is what you should be using

The idea is to use PeepEvents in a dedicated events thread and a
PumpEvents in the video thread. Otherwise, if that’s buggy, the same
behavior could I guess achieved with a PollEvents in the video thread
and a user defined copying.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Pumping in the UI thread and peeking in a separate thread should work fine. So what’s the problem?


EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/

Michael Menegakis wrote:

Quote:

SDL_PollEvents does; and is what you should be using

The idea is to use PeepEvents in a dedicated events thread and a
PumpEvents in the video thread. Otherwise, if that’s buggy, the same
behavior could I guess achieved with a PollEvents in the video thread
and a user defined copying.


SDL mailing list

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

Pumping in the UI thread and peeking in a separate thread should work fine.
So what’s the problem?

The key events are fine but it doesn’t give mouse wheel events and app quit
events (e.g. explicitly closing the window in windows). (other mouse keys
are fine)On Thu, Jan 20, 2011 at 1:20 PM, Nathaniel J Fries wrote:

On Wed, Jan 19, 2011 at 11:49 PM, Nathaniel J Fries <> wrote:

Michael Menegakis wrote:> On Thu, Jan 20, 2011 at 1:20 PM, Nathaniel J Fries <@Nathaniel_J_Fries (@Nathaniel_J_Fries)> wrote:

Michael Menegakis wrote:


On Wed, Jan 19, 2011 at 11:49 PM, Nathaniel J Fries <> wrote:


Quote:


SDL_PollEvents does; and is what you should be using

The idea is to use PeepEvents in a dedicated events thread and a
PumpEvents in the video thread. Otherwise, if that’s buggy, the same
behavior could I guess achieved with a PollEvents in the video thread
and a user defined copying.


SDL mailing list

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

Pumping in the UI thread and peeking in a separate thread should work fine. So what’s the problem?

The key events are fine but it doesn’t give mouse wheel events and app quit events (e.g. explicitly closing the window in windows). (other mouse keys are fine)

Mouse wheel events is a known bug. I believe Sam said he fixed this in the most recent snapshot; so try updating.
Quit events aren’t sent when you close the window anymore. Read the documentation on events and you will realize what you need to do. Or heck; just find other messages from me; I already explained this to someone else the other day.


EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/

Michael Menegakis wrote:

Quote:

Michael Menegakis wrote:

Quote:

SDL_PollEvents does; and is what you should be using

The idea is to use PeepEvents in a dedicated events thread and a
PumpEvents in the video thread. Otherwise, if that’s buggy, the same
behavior could I guess achieved with a PollEvents in the video thread
and a user defined copying.


SDL mailing list

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

Pumping in the UI thread and peeking in a separate thread should work fine.
So what’s the problem?

The key events are fine but it doesn’t give mouse wheel events and app quit
events (e.g. explicitly closing the window in windows). (other mouse keys
are fine)

Mouse wheel events is a known bug. I believe Sam said he fixed this in the
most recent snapshot; so try updating.
Quit events aren’t sent when you close the window anymore. Read the
documentation on events and you will realize what you need to do. Or heck;
just find other messages from me; I already explained this to someone else
the other day.

Yeah that was me I guess in this thread :slight_smile: I just thought I was answering
to someone else like you just did he he.

OK, let’s see if it’s fixed.On Thu, Jan 20, 2011 at 11:25 PM, Nathaniel J Fries wrote:

On Thu, Jan 20, 2011 at 1:20 PM, Nathaniel J Fries <> wrote:
On Wed, Jan 19, 2011 at 11:49 PM, Nathaniel J Fries <> wrote:

OK, let’s see if it’s fixed.

Hrm. Still no mouse wheel events. I have to stress out I was seeing wheel
and all other events with PollEvents but not with PeepEvents. With
PeepEvents I see all other mouse buttons normally.On Fri, Jan 21, 2011 at 7:21 AM, Michael Menegakis <@Michael_Menegakis> wrote:

This should not be possible. Are you saying that with a particular
build of SDL 1.3 (revision number?) that you can poll wheel events but
you cannot peep them?

The bug about wheel events aside, you should be either getting them
with both functions or not getting them. You should not be getting
different results each way.

In the current revision
(http://hg.libsdl.org/SDL/file/eae20af0b983/src/events/SDL_events.c),
as mentioned by Nathaniel and myself, SDL_PollEvent() calls
SDL_WaitEventTimeout()
(http://hg.libsdl.org/SDL/file/eae20af0b983/src/events/SDL_events.c#l448).
SDL_WaitEventTimeout is a thin wrapper around SDL_PeepEvents()
(http://hg.libsdl.org/SDL/file/eae20af0b983/src/events/SDL_events.c#l460)

Can you reproduce this behaviour on the current SDL 1.3 build, and if
so can you show the code that demonstrates it?On 21 January 2011 05:27, Michael Menegakis wrote:

Hrm. Still no mouse wheel events. I have to stress out I was seeing wheel
and all other events with PollEvents but not with PeepEvents. With
PeepEvents I see all other mouse buttons normally.