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

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Dec 18 11:18:26 CET 2007


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?

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list