+
+static int OSDMenuCallback( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data )
+{
+ VLC_UNUSED(p_this); VLC_UNUSED(oldval);
+ filter_sys_t *p_sys = (filter_sys_t *) p_data;
+
+ if( !p_sys )
+ return VLC_SUCCESS;
+
+ if( !strncmp( psz_var, OSD_CFG"position", 16) )
+ {
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+ unsigned int i;
+ for( i=0; i < ARRAY_SIZE(pi_pos_values); i++ )
+ {
+ if( newval.i_int == pi_pos_values[i] )
+ {
+ p_sys->i_position = newval.i_int % 11;
+ break;
+ }
+ }
+#undef ARRAY_SIZE
+ }
+ else if( !strncmp( psz_var, OSD_CFG"x", 9) ||
+ !strncmp( psz_var, OSD_CFG"y", 9))
+ {
+ p_sys->b_absolute = true;
+ if( (p_sys->i_x < 0) || (p_sys->i_y < 0) )
+ {
+ p_sys->b_absolute = false;
+ p_sys->p_menu->i_x = 0;
+ p_sys->p_menu->i_y = 0;
+ }
+ else if( (p_sys->i_x >= 0) || (p_sys->i_y >= 0) )
+ {
+ p_sys->p_menu->i_x = p_sys->i_x;
+ p_sys->p_menu->i_y = p_sys->i_y;
+ }
+ }
+ else if( !strncmp( psz_var, OSD_CFG"update", 14) )
+ p_sys->i_update = newval.i_int * INT64_C(1000);
+ else if( !strncmp( psz_var, OSD_CFG"timeout", 15) )
+ p_sys->i_update = newval.i_int % 1000;
+ else if( !strncmp( psz_var, OSD_CFG"alpha", 13) )
+ p_sys->i_alpha = newval.i_int % 256;
+
+ p_sys->b_update = p_sys->b_visible ? true : false;
+ return VLC_SUCCESS;
+}
+
+static int MouseEvent( filter_t *p_filter,
+ const vlc_mouse_t *p_old,
+ const vlc_mouse_t *p_new,
+ const video_format_t *p_fmt )
+{
+ filter_sys_t *p_sys = p_filter->p_sys;
+
+ if( !vlc_mouse_HasPressed( p_old, p_new, MOUSE_BUTTON_LEFT ) )
+ return VLC_SUCCESS;
+
+ osd_button_t *p_button = osd_ButtonFind( VLC_OBJECT(p_filter),
+ p_new->i_x,
+ p_new->i_y,
+ p_fmt->i_width,
+ p_fmt->i_height,
+ 1000, 1000 );
+ if( !p_button )
+ return VLC_SUCCESS;
+
+ osd_ButtonSelect( VLC_OBJECT(p_filter), p_button );
+ p_sys->b_update = p_sys->b_visible ? true : false;
+ p_sys->b_clicked = true;
+ msg_Dbg( p_filter, "mouse clicked %s (%d,%d)", p_button->psz_name, p_new->i_x, p_new->i_y );
+ return VLC_SUCCESS;
+}