Re: [AD] various questions about events (4.3) |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2007-05-21, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> On 5/16/07, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> > On 2007-05-07, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> > > If necessary for optimization, I think filtering could be implemented
> > > by simply not generating the event. (If that makes any sense.)
> >
> > Well, that's what the masks do. You apply a mask to an event source and
> > it only generates events which aren't masked. Bitfields make the check
> > cheap, that's all.
> >
> I just meant that the source itself could be notified to not even
> "emit" events if it created enough different types for it to be
> useful. So if some source could potentially produce superfluous
> events, you could tell it to not produce them by some group (custom to
> that source), and then it wouldn't even call
> _al_event_source_emit_event.
>
> But I really don't think that would be very beneficial given the
> probable use of events. The one or two times that it might be useful
> to have source specific filters (masks) wouldn't make up for the
> non-standard API.
>
> On 5/20/07, Robert Jr Ohannessian <rohannessian@xxxxxxxxxx> wrote:
> > I think this is premature optimization. If bitfields must be used, then
> > at least allow for an arbitrary number of bits.
> >
> I suppose you mean reserving a few bits for classes of events. This
> could be useful, but defining them would be a bit arbitrary and
> ambiguous.
We could just use more words for the bitfield instead of just one. We'd
still limited in the number of event types, but the limit should be
large enough for all practical purposes. Or we could record the event
types to filter in a linked list or binary tree instead. Most event
sources won't have any event types to filter anyway.
I can actually only think of one event type I'd like to filter, which is
mouse movement events in a GUI program, and even that is dubious if you
want widgets to highlight when you hover the mouse cursor on top of
them. So we can probably just take the whole thing out.
Peter