Using smooth scrolling over uinput

Raphael Isemann teemperor at gmail.com
Sun May 5 15:43:28 PDT 2013


Hi,
thanks for the information.
I signaled that i have a REL_WHEEL via
-------------------
ioctl(file_descriptor, UI_SET_EVBIT, EV_REL);
ioctl(file_descriptor, UI_SET_RELBIT, REL_WHEEL);
-------------------
and i can send REL_WHEEL events that are interpreted as mouse-wheel-"ticks"
but not as the smooth scrolling input i wanted.
Any error i made?

Some furhter information:
I test via scrolling in a GTK+ 3 application that supports smooth scrolling
via touchpad.

(evdev is version 2.7.0 and HAVE_SMOOTH_SCROLLING is also correctly defined
as 1 in the source of my package).
Relevant part of my source regarding the scrolling:
-------------------
int uinput_gerbil_setup (void) {
    uinput_gerbil_fd = open("/dev/uinput", O_WRONLY);

    if (uinput_gerbil_fd < 0) {
             perror("open(\"/dev/uinput\")");
             return 1;
    }

    /* set input device capabilities */
    ioctl(uinput_gerbil_fd, UI_SET_EVBIT, EV_SYN);
    ioctl(uinput_gerbil_fd, UI_SET_EVBIT, EV_REL);
    ioctl(uinput_gerbil_fd, UI_SET_RELBIT, REL_X);
    ioctl(uinput_gerbil_fd, UI_SET_RELBIT, REL_Y);
    ioctl(uinput_gerbil_fd, UI_SET_RELBIT, REL_WHEEL);
    ioctl(uinput_gerbil_fd, UI_SET_EVBIT, EV_KEY);
    ioctl(uinput_gerbil_fd, UI_SET_KEYBIT, BTN_MOUSE);
    ioctl(uinput_gerbil_fd, UI_SET_KEYBIT, BTN_TOUCH);
    ioctl(uinput_gerbil_fd, UI_SET_KEYBIT, BTN_TOOL_DOUBLETAP);


    struct uinput_user_dev dev = {.name = "Gerbil Mouse"};
    write(uinput_gerbil_fd, &dev, sizeof(dev));

    /* create input device */
    ioctl(uinput_gerbil_fd, UI_DEV_CREATE);

    return 0;
}

void uinput_gerbil_scroll(int val){

    struct input_event ev  = {.type = EV_REL, .code = REL_WHEEL, .value =
val};
    uinput_gerbil_write(ev);
    uinput_gerbil_sync();
}
-------------------



2013/5/5 Peter Hutterer <peter.hutterer at who-t.net>

> On Sun, May 05, 2013 at 02:24:36AM +0200, Raphael Isemann wrote:
> > Hi everybody,
> >
> > i use uinput for sending mouse-input from userland to emulate a mouse.
> Now
> > i want that the REL_WHEEL input is interpreted not as button-presses but
> > rather as a smooth/pixelperfect input.
> >
> > According to that:
> > http://web.archiveorange.com/archive/v/gTLYUgTyEWhFANwI8KGH this is
> > supported in evdev since a while and i only need to mark the axis as
> > scrolling axis ("""Instead, let the
> > driver mark axes as scrolling axes as required.""").
> > But how can i mark the axes? Any hints on useful documentation on that
> > topic or other functions that allow to sent signals that are interpreted
> as
> > smooth scrolling are welcome.
>
> if you have REL_WHEEL on a device, the evdev driver will mark that as a
> scrolling axis automatically. you don't have to do anything there.
>
> Cheers,
>    Peter
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20130506/8edb1d95/attachment.html>


More information about the xorg mailing list