Re: [AD] event source casts

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2009-08-03, Elias Pschernig <elias.pschernig@xxxxxxxxxx> wrote:
> On Sun, 2009-08-02 at 11:30 +0200, Elias Pschernig wrote:
> > Here's a proposal to fix this bug:
> > https://sourceforge.net/tracker/?func=detail&aid=2329841&group_id=5665&atid=105665
> > 
> > The idea is to add the following functions:
> > 
> > ALLEGRO_EVENT_SOURCE *al_get_stream_event_source(ALLEGRO_STREAM *)
> > 
> > That's the one directly fixing the ugly cast. And further:
> > 
> > ALLEGRO_EVENT_SOURCE *al_get_display_event_source(ALLEGRO_DISPLAY *)
> > ALLEGRO_EVENT_SOURCE *al_get_keyboard_event_source(ALLEGRO_KEYBOARD *)
> > ALLEGRO_EVENT_SOURCE *al_get_mouse_event_source(ALLEGRO_MOUSE *)
> > ALLEGRO_EVENT_SOURCE *al_get_timer_event_source(ALLEGRO_TIMER *)
> > ALLEGRO_EVENT_SOURCE *al_get_joystick_event_source(ALLEGRO_JOYSTICK *)
> > 
> > Which fixes a few more (not quite as ugly) casts. Any thoughts?
> > 
> 
> Ok, committed to SVN as I couldn't see much reason against it - now the
> A5 API is 100% cast-free, and typing (ALLEGRO_EVENT_SOURCE *) is
> actually more work than typing al_get_display_event_source() because of
> the caps lock.
> 
> One thing Chris requested in #allegro is making all those functions
> inline.

Why do they need to be inline?


A couple of comments.

1.  al_register_event_source(queue,
	al_get_keyboard_event_source(al_get_keyboard()));

is a bit silly since al_get_keyboard() has no other use any more.
Same with al_get_mouse().

2.  This change introduces some confusion about the `source' fields in
ALLEGRO_EVENTs.  If I have a display event will the event source field
point to the ALLEGRO_DISPLAY object, or the
al_get_display_event_source(display)?

Peter




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/