[MPlayer-dev-eng] [PATCH] OSD menu support mouse select.

Ulion ulion2002 at gmail.com
Tue Dec 18 12:01:15 CET 2007


2007/12/18, Reimar Döffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de>:
> Hello,
> On Tue, Dec 18, 2007 at 06:03:00PM +0800, Ulion wrote:
> > +  if (menu_mouse_pos_updated) {
> > +    int bg_x = x < 0 ? (mpi->w-bg_w)/2 : x-mpriv->minb;
> > +    int by = dy;
> > +    mouse_x = menu_mouse_x * w;
> > +    mouse_y = menu_mouse_y * h;
> > +    if (mouse_x >= bg_x && mouse_x < bg_x + bg_w) {
> > +      list_entry_t* e = m;
> > +      for( ; e != NULL && by + vo_font->height < dh ; e = e->next ) {
> > +        if(e->hide) continue;
> > +        if (mouse_y < by+y-mpriv->vspace/2)
> > +          break;
> > +        if (mouse_y < by+y+mpriv->vspace/2+vo_font->height) {
>
> A lot of these calculations are duplicated from the selection_x etc.
> stuff below, can't you move it there or alternatively make a
> get_selection_bounds function or so?
>
> >      if(m == mpriv->current) {
> > +      selection_x = x < 0 ? (mpi->w - bg_w) / 2 : x - mpriv->minb;
>
> Not related to this patch, but this seems a bit weird to me, why
> is the condition x < 0 and not x < mpriv->minb?
> Is selection_x < 0 valid and treated correctly?

Then I will clean that part of code first.

I just tried this patch on ubuntu with vo xv, it works fine, just the
MOUSE_BTN1 seems be the middle button of my mouse, it could be a bug
of xv? or it should be?

-- 
Ulion



More information about the MPlayer-dev-eng mailing list