[MPlayer-dev-eng] feature XInput

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Mar 7 23:00:37 CET 2009


On Sat, Mar 07, 2009 at 10:48:56PM +0100, Christoph Fritz wrote:
> @@ -595,6 +648,11 @@
>  static char* js_dev = NULL;
>  static char* ar_dev = NULL;
>  
> +#ifdef CONFIG_XINPUT
> +static char* xinput_name = NULL;
> +static int xinput_minus_sens = NULL;
> +#endif
> +
>  static char* in_file = NULL;
>  static int in_file_fd = -1;
>  
> @@ -610,6 +668,8 @@
>    { "keylist", mp_input_print_key_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL },
>    { "cmdlist", mp_input_print_cmd_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL },
>    { "js-dev", &js_dev, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL },
> +  { "xinput-name", &xinput_name, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL },
> +  { "xinput-minus_sens", &xinput_minus_sens, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL },
>    { "file", &in_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL },
>    { NULL, NULL, 0, 0, 0, 0, NULL}
>  };

That's not going to work. I recommend testing with CONFIG_XINPUT unset.

> +struct xi_context
> +{
> +    Display *dpy;
> +    int db_dial_event_type;
> +    int db_button_press_event_type;
> +    XDevice *db_device;
> +    XEvent event;
> +    XDeviceMotionEvent *M;
> +    XDeviceButtonEvent *B;
> +    int oldAxisValue[XINPUT_COUNT_BTNS];
> +
> +    int count_btns;
> +    int count_axis;
> +    int xinput_minus_sensitivity;
> +};
> +
> +static struct xi_context xic;

These can be merged.

> +    xic.M = (XDeviceMotionEvent *) & xic.event;
> +    xic.B = (XDeviceButtonEvent *) & xic.event;
> +    xic.dpy = XOpenDisplay(NULL);
> +    XDeviceInfoPtr list;

Mixing code and declarations. Read the compiler warnings.
But more importantly:
that might not be the display MPlayer is running on.
Are you really sure this is what you want?
And as a corollary to that: Are you really sure this does not belong in
libvo/x11_common.c?



More information about the MPlayer-dev-eng mailing list