Help with initializations.

Peter Hutterer peter.hutterer at who-t.net
Mon May 9 05:38:10 UTC 2016


On Sat, May 07, 2016 at 11:35:53AM -0400, Jeff Zhao wrote:
> Hi, my name is Jeff.
> I am not sure if I am suppose to post here, but the main page said
> discussions can be posted here.
> I am currently 17 and am working on a little project. My program would like
> to interact with libinput and configure device options.

I don't know what the final purpose is but a warning: the libinput context
you will create from the file descriptor is different to the one that is
created by the compositor/X server. So while you can configurations related
to your context you cannot access the context in the compositor. IOW, you
cannot have an external program changing options for other processes.
just in case that's what you're aiming for...

> However, my programming skills are still very basic and I found the
> documentation for libinput very hard to find a starting point.
> I would make a struct libinput and would not know how to initialize it. The
> same applied to libinput_device, libinput_context and libinput_interface;
> libinput_interface only says
> "libinput does not open file descriptors to devices directly, instead
> open_restricted()
> <https://wayland.freedesktop.org/libinput/doc/latest/structlibinput__interface.html#ae445aaa330e4eb7df6650fbc6428022a>
>  and close_restricted()
> <https://wayland.freedesktop.org/libinput/doc/latest/structlibinput__interface.html#af78e15d6a06bc928d8679b587bb4e8fa>are
> called for each path that must be opened."

did you look at the tools/event-debug.c? that's the event debugger program
(which can also change configuration options) and should serve as a good
template for what you want to do.

> void *user_data also seemed very vague.

it's a random data pointer that you can provide and you get back in a couple
of callbacks or other functions. if you don't know what to set there, you
can leave it at NULL

hth

Cheers,
   Peter

> 
> I was wondering if anyone can point me in the general direction that can
> get me started.
> 
> Thank you.


More information about the wayland-devel mailing list