Using smooth scrolling over uinput
Peter Hutterer
peter.hutterer at who-t.net
Mon May 6 15:31:19 PDT 2013
On Mon, May 06, 2013 at 12:43:28AM +0200, Raphael Isemann wrote:
> 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.
What's the output from xinput test-xi2 <device>?
Cheers,
Peter
>
> (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
> >
> >
> _______________________________________________
> xorg at lists.x.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: http://lists.x.org/mailman/listinfo/xorg
> Your subscription address: peter.hutterer at who-t.net
More information about the xorg
mailing list