[MPlayer-dev-eng] [PATCH] Apple Remote support double click

Ulion ulion2002 at gmail.com
Tue Sep 11 03:23:29 CEST 2007


2007/9/10, Diego Biurrun <diego at biurrun.de>:
> On Sat, Aug 25, 2007 at 12:05:26AM +0800, Ulion wrote:
> >
> > Here's a patch to support Apple Remote double click event, judged by a
> > double click max difference time.
> >
> > Original mp_input_ar_read function now become mp_input_ar_read_raw,
> > and add a wrapper function as mp_input_ar_read to judge double click
> > event.
> >
> > Most useful usage come by the double click feature is double click to
> > toggle fullscreen (in default cmd mapping).
> >
> > --- input/ar.c        (revision 24142)
> > +++ input/ar.c        (working copy)
> > @@ -113,7 +115,16 @@
> >
> > +static const float MAX_DCLICK_TIME_INTERVAL=0.33;
>
> 0.33 what?  Also, I faintly remember that we have a doubleclick interval
> time somewhere, see -doubleclick-time.

I known that parameter, it's currently only  for mouse doubleclick
check. For Apple Remote, its buttons has an longer click and response
time (its buttons need more time to release and re-pressed than normal
mouse). Using that parameter for both mouse and remote is not
suitable. If really needed, an -ar-doubleclick-time should be a good
method to keep the click interval configuable, do we need it?

>
> > @@ -334,14 +349,28 @@
> >
> > +    // We has to close and re-open the hid device once to make
> > +    // system not response to the remote input.
>
> We have to close and reopen the hid device once to make the system
> not respond to the remote input.

fixed.

>
> > @@ -383,18 +421,217 @@
> > +
> > +int mp_input_ar_read(int fd)
> > +{
> > +    // Click down record is only for AR_VUP and AR_VDOWN.
> > +    static int first_click_down = 0, second_click_down = 0;
>
> What do you mean by "click down record" and click down?

It means, for these two remote button, they have both pressed event
and released event, other bottons only have released event. 'click
down' means 'pressed'. And the two local static variables are flags
that identify whether at current time we ever got pressed events for
first click or second click. It's for resend all events as same as
there is no doubleclick checking code, that means, if judged it's not
a doubleclick, we try to send out all events we received but not sent
out, specially for these two button's pressed events since our code
can only record one previous click event. for record both a pressed
and released event for the first click, and even the pressed event for
second click, we use these two local static variables.

>
> > +    if (CHECK_DOUBLE_CLICK_EVENT) {
> > +        switch (ret) {
> > +            // These 2 keys have both press and release events.
> > +            // Here we only handle press event, release event keeps going down.
>
> "keeps going down"?

that mean first two cases only handle pressed event for that two
buttons, and released event of that two buttons will be handled
together with other buttons' released event in next 4 cases.

>
> > +                        // Double click timeouted or key changed,
>
> doubleclick, timed out
>
> > +                        // Send the double click event.
>
> doubleclick
>
> > +                // We has click event and no input, check the interval.
>
> "we" always goes with "have", never "has".
>
> Diego

fixed.


-- 
Ulion



More information about the MPlayer-dev-eng mailing list