Re: [PATCH wayland] protocol: add repeat_info event to wl_keyboard

2014-06-02 Thread Pekka Paalanen
On Fri, 30 May 2014 11:32:25 +0200
Jonny Lamb jonny.l...@collabora.co.uk wrote:

 In the process wl_keyboard's version has been incremented. Given
 clients get the wl_keyboard from wl_seat without a version, wl_seat's
 version has also been incremented (wl_seat version 4 implies
 wl_keyboard version 4).
 ---
  protocol/wayland.xml | 17 +++--
  1 file changed, 15 insertions(+), 2 deletions(-)
 
 diff --git a/protocol/wayland.xml b/protocol/wayland.xml
 index 22eb6e7..722cb89 100644
 --- a/protocol/wayland.xml
 +++ b/protocol/wayland.xml
 @@ -1262,7 +1262,7 @@
  /request
 /interface
  
 -  interface name=wl_seat version=3
 +  interface name=wl_seat version=4
  description summary=group of input devices
A seat is a group of keyboards, pointer and touch devices. This
object is published as a global during start up, or when such a
 @@ -1490,7 +1490,7 @@
  
/interface
  
 -  interface name=wl_keyboard version=3
 +  interface name=wl_keyboard version=4
  description summary=keyboard input device
The wl_keyboard interface represents one or more keyboards
associated with a seat.
 @@ -1578,6 +1578,19 @@
  request name=release type=destructor since=3
description summary=release the keyboard object/
  /request
 +
 +!-- Version 4 of additions --
 +
 +event name=repeat_info since=4
 +  description summary=repeat rate and delay
 +Informs the client about the keyboard's repeat rate and delay.
 +  /description
 +
 +  arg name=rate type=int
 +   summary=the rate of repeating keys in characters per second/
 +  arg name=delay type=int
 +   summary=time in milliseconds between keys repeating/
 +/event
/interface
  
interface name=wl_touch version=3

Hi,

this looks good to me, but I'd like to see text about when this event
is sent. I assume it is sent once as soon as a wl_keyboard object has
been created, and this is also required/guaranteed. IOW, if a client
creates a wl_keyboard and then does a roundtrip, it is guaranteed to
have received the event at least once. Right?

Or should sending it be optional? Should we define any defaults in case
no event has been received? I'd assume not.

Can it be sent later, too? (Likely yes.)

Was this ever discussed before this email thread? I'd like to see at
least one more ack (Daniel already ack'd) before I'm comfortable pushing
this to wayland master, as this is part of the core protocol.


Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] input: send wl_keyboard.repeat_info with rate and delay info

2014-06-02 Thread Pekka Paalanen
On Fri, 30 May 2014 11:32:24 +0200
Jonny Lamb jonny.l...@collabora.co.uk wrote:

 The compositor reads the values out from weston.ini, the weston
 compositor passes on the values, the weston-info client prints out the
 values, and the values are respected in toytoolkit.
 ---
  clients/weston-info.c| 106 
 ---
  clients/window.c |  24 +--
  src/compositor-wayland.c |  18 ++--
  src/compositor.c |   5 +++
  src/compositor.h |   3 ++
  src/input.c  |  12 +-
  6 files changed, 154 insertions(+), 14 deletions(-)
 
 diff --git a/clients/weston-info.c b/clients/weston-info.c
 index df869e3..9e2307b 100644
 --- a/clients/weston-info.c
 +++ b/clients/weston-info.c
 @@ -32,6 +32,8 @@
  
  #include ../shared/os-compatibility.h
  
 +#define MIN(x,y) (((x)  (y)) ? (x) : (y))
 +
  typedef void (*print_info_t)(void *info);
  typedef void (*destroy_info_t)(void *info);
  
 @@ -90,6 +92,9 @@ struct seat_info {
  
   uint32_t capabilities;
   char *name;
 +
 + int32_t repeat_rate;
 + int32_t repeat_delay;
  };
  
  struct weston_info {
 @@ -291,22 +296,105 @@ print_seat_info(void *data)
   printf( touch);
  
   printf(\n);
 +
 + if (seat-repeat_rate  0)
 + printf(\tkeyboard repeat rate: %d\n, seat-repeat_rate);
 + if (seat-repeat_delay  0)
 + printf(\tkeyboard repeat delay: %d\n, seat-repeat_delay);
 +}
 +
 +static void
 +keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
 +uint32_t format, int fd, uint32_t size)
 +{
 +}
 +
 +static void
 +keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
 +   uint32_t serial, struct wl_surface *surface,
 +   struct wl_array *keys)
 +{
  }
  
  static void
 +keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
 +   uint32_t serial, struct wl_surface *surface)
 +{
 +}
 +
 +static void
 +keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
 + uint32_t serial, uint32_t time, uint32_t key,
 + uint32_t state)
 +{
 +}
 +
 +static void
 +keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
 +   uint32_t serial, uint32_t mods_depressed,
 +   uint32_t mods_latched, uint32_t mods_locked,
 +   uint32_t group)
 +{
 +}
 +
 +static void
 +keyboard_handle_repeat_info(void *data, struct wl_keyboard *keyboard,
 + int32_t rate, int32_t delay)
 +{
 + struct seat_info *seat = data;
 +
 + seat-repeat_rate = rate;
 + seat-repeat_delay = delay;
 +}
 +
 +static const struct wl_keyboard_listener keyboard_listener = {
 + keyboard_handle_keymap,
 + keyboard_handle_enter,
 + keyboard_handle_leave,
 + keyboard_handle_key,
 + keyboard_handle_modifiers,
 + keyboard_handle_repeat_info,
 +};
 +
 +/* This is a struct so we don't have to add a (circular) pointer in
 + * seat_info to weston_info just so roundtrip_needed can be set to
 + * true. */
 +struct seat_async_data {
 + struct seat_info *seat;
 + struct weston_info *info;
 +};
 +
 +static void
  seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
enum wl_seat_capability caps)
  {
 - struct seat_info *seat = data;
 - seat-capabilities = caps;
 + struct seat_async_data *async_data = data;
 +
 + async_data-seat-capabilities = caps;
 +
 + /* we want listen for repeat_info from wl_keyboard, but only
 +  * do so if the seat info is = 4 and if we actually have a
 +  * keyboard */
 + if (async_data-seat-global.version  4)
 + return;
 +
 + if (caps  WL_SEAT_CAPABILITY_KEYBOARD) {
 + struct wl_keyboard *keyboard;
 +
 + keyboard = wl_seat_get_keyboard(async_data-seat-seat);
 + wl_keyboard_add_listener(keyboard, keyboard_listener,
 +  async_data-seat);
 +
 + async_data-info-roundtrip_needed = true;
 + }
  }
  
  static void
  seat_handle_name(void *data, struct wl_seat *wl_seat,
const char *name)
  {
 - struct seat_info *seat = data;
 - seat-name = xstrdup(name);
 + struct seat_async_data *async_data = data;
 + async_data-seat-name = xstrdup(name);
  }
  
  static const struct wl_seat_listener seat_listener = {
 @@ -329,14 +417,20 @@ static void
  add_seat_info(struct weston_info *info, uint32_t id, uint32_t version)
  {
   struct seat_info *seat = xzalloc(sizeof *seat);
 + struct seat_async_data *async_data = xzalloc(sizeof *async_data);

Where is the free() corresponding to this xzalloc()? If weston-info is
just leaking stuff also before this, then I don't mind. If someone
cares, he can fix it all up in a separate patch.

 +
 + async_data-seat = seat;
 + async_data-info = info;
  
   init_global_info(info, 

Build steps

2014-06-02 Thread Kishore Divvela -ERS, HCL Tech
Hi Daniel,

Can I use the build steps which is available in 
http://wayland.freedesktop.org/building.html.

Regards,
Kishore


::DISCLAIMER::


The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information 
could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in 
transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on 
the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the 
author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written 
consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please 
delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and 
other defects.


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Build steps

2014-06-02 Thread Daniel Stone
On 2 June 2014 08:44, Kishore Divvela -ERS, HCL Tech kishor...@hcl.com
wrote:

Can I use the build steps which is available in
 http://wayland.freedesktop.org/building.html.


Yes.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Weston multitouch support?

2014-06-02 Thread José Expósito
Hi Peter,

I have checked the libinput implementation and, correct me if I'm wrong, I
have seen that 2 fingers click is interpreted as right click, 3 fingers
click is  interpreted as middle click and there are some special rules for
specified trackpads, like corner clicks.

Does that mean that the other MT events are not sent to the clients? Could
it be possible to get the 2 fingers pinch gesture from a QML client for
example?
So mainly my question is: is it possible to port (
https://code.google.com/p/touchegg/) as a wayland compositor, for example
to manage desktop specified gestures, and still use client gestures like
pinch and zoom?

By the way, I compiled Wayland/Weston as specified here:
http://wayland.freedesktop.org/building.html

And QtWayland as specified here:
http://wayland.freedesktop.org/qt5.html

But I don't see any references to the forked libinput library. Does that
mean that I should compile libinput and recompile Wayland/Weston against
this library instead of the system one?

I'm sorry for all the questions, but I didn't find any documentation about
that.


2014-06-02 4:30 GMT+01:00 Peter Hutterer peter.hutte...@who-t.net:

 On Sun, Jun 01, 2014 at 11:38:02PM +0100, José Expósito wrote:
  Hi Daniel,
 
  I'm asking because I'm the author of this tool:
  https://code.google.com/p/touchegg/
 
  That is exactly what you mention but for X11. So I'd like to port it to
  Wayland if it is possible of course.
 
   The intention was to reserve trackpad
   gestures for a gesture interpreter
   which lives in the compositor and is
   properly integrated with, e.g., scrolling
   and tap-to-click.
 
  Does this mean that it is possible to get multi touch gestures in the
  compositor at the moment?
  Will or is it possible to use both approach? I mean, get system gestures
 in
  the compositor and app specified gestures in the clients, like in OS X.

 the input stack in weston atm is that you get touch events from a
 direct-touch MT device raw and unprocessed (save for mapping), but for
 touchpads some input events are interpreted by the stack (libinput or
 evdev-touchpad.c) and then passed on as pointer events, you don't see the
 MT
 bits of those.

 Cheers,
Peter


  Thank you very much!
   El 01/06/2014 23:24, Daniel Stone dan...@fooishbar.org escribió:
 
   Hi,
  
  
   On 1 June 2014 02:03, José Expósito jose.exposit...@gmail.com wrote:
  
   And I say more or less because it is necessary to put 3 fingers on the
   trackpad to start moving the rectangles...
   Anyway, the program is not working on Weston. My question is, is that
   because Weston doesn't implement multitouch support or because Wayland
   doesn't support it at the moment? Could it be possible to implement
   multitouch support in a custom compositor?
  
  
   Wayland doesn't (currently) support touchpad gestures for arbitrary
   clients; trying to do it for X11 uncovered a whole host of really
 subtle
   and annoying issues. The intention was to reserve trackpad gestures
 for a
   gesture interpreter which lives in the compositor and is properly
   integrated with, e.g., scrolling and tap-to-click.
  
   Can I ask if you had a specific usecase in mind?
  
   Cheers,
   Daniel
  

  ___
  wayland-devel mailing list
  wayland-devel@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/wayland-devel


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston client window] Fixed the input region of the popup menu

2014-06-02 Thread Tomek Obrebski
Changed the input region of the menu popup window to exclude the shadow and 
border regions and set to frame's internal region only.

Regards,
blsd

---
 clients/window.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index b82a93e..9a6e8be 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -4615,7 +4615,8 @@ window_show_menu(struct display *display,
 {
struct menu *menu;
struct window *window;
-   int32_t ix, iy;
+struct wl_region *input_region;
+int32_t ix, iy, ih, iw;
 
menu = create_menu(display, input, time, func, entries, count, parent);
 
@@ -4630,7 +4631,11 @@ window_show_menu(struct display *display,
window-x = x;
window-y = y;
 
-   frame_interior(menu-frame, ix, iy, NULL, NULL);
+frame_interior(menu-frame, ix, iy, iw, ih);
+input_region = wl_compositor_create_region(display-compositor);
+wl_region_add(input_region, ix, iy, iw, ih);
+wl_surface_set_input_region(window-main_surface-surface, input_region);
+wl_region_destroy(input_region);
 
window-xdg_popup = xdg_shell_get_xdg_popup(display-xdg_shell,

window-main_surface-surface,
-- 
1.9.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 0/2] RDP Keyboard

2014-06-02 Thread Hardening
Le 26/05/2014 17:22, Hardening a écrit :
 I'm resending this serie of patches that are related to keyboard with the RDP
 compositor. The first one make weston support more RDP keyboard (RDP to Xkb
 convertion). The second make use of buildin FreeRDP functions instead of 
 reinventing
 the wheel.
 
 I didn't had many feedback for these at the last sending, so if nobody's 
 against I 
 will commit them.
 
 Hardening (2):
   Add more keyboards for the RDP compositor
   Use FreeRDP buildin functions to get scancodes
 
  src/compositor-rdp.c | 156 
 +--
  1 file changed, 126 insertions(+), 30 deletions(-)
 

I have commited these two.

Regards.

-- 
David FORT
website: http://www.hardening-consulting.com/

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland] protocol: add repeat_info event to wl_keyboard

2014-06-02 Thread Giulio Camuffo
2014-06-02 9:36 GMT+02:00 Pekka Paalanen ppaala...@gmail.com:
 On Mon, 2 Jun 2014 10:22:40 +0300
 Pekka Paalanen ppaala...@gmail.com wrote:

 On Fri, 30 May 2014 11:32:25 +0200
 Jonny Lamb jonny.l...@collabora.co.uk wrote:

  In the process wl_keyboard's version has been incremented. Given
  clients get the wl_keyboard from wl_seat without a version, wl_seat's
  version has also been incremented (wl_seat version 4 implies
  wl_keyboard version 4).
  ---
   protocol/wayland.xml | 17 +++--
   1 file changed, 15 insertions(+), 2 deletions(-)
 
  diff --git a/protocol/wayland.xml b/protocol/wayland.xml
  index 22eb6e7..722cb89 100644
  --- a/protocol/wayland.xml
  +++ b/protocol/wayland.xml
  @@ -1262,7 +1262,7 @@
   /request
  /interface
 
  -  interface name=wl_seat version=3
  +  interface name=wl_seat version=4
   description summary=group of input devices
 A seat is a group of keyboards, pointer and touch devices. This
 object is published as a global during start up, or when such a
  @@ -1490,7 +1490,7 @@
 
 /interface
 
  -  interface name=wl_keyboard version=3
  +  interface name=wl_keyboard version=4
   description summary=keyboard input device
 The wl_keyboard interface represents one or more keyboards
 associated with a seat.
  @@ -1578,6 +1578,19 @@
   request name=release type=destructor since=3
 description summary=release the keyboard object/
   /request
  +
  +!-- Version 4 of additions --
  +
  +event name=repeat_info since=4
  +  description summary=repeat rate and delay
  +Informs the client about the keyboard's repeat rate and delay.
  +  /description
  +
  +  arg name=rate type=int
  +   summary=the rate of repeating keys in characters per second/
  +  arg name=delay type=int
  +   summary=time in milliseconds between keys repeating/
  +/event
 /interface
 
 interface name=wl_touch version=3

 Hi,

 this looks good to me, but I'd like to see text about when this event
 is sent. I assume it is sent once as soon as a wl_keyboard object has
 been created, and this is also required/guaranteed. IOW, if a client
 creates a wl_keyboard and then does a roundtrip, it is guaranteed to
 have received the event at least once. Right?

 Or should sending it be optional? Should we define any defaults in case
 no event has been received? I'd assume not.

 Can it be sent later, too? (Likely yes.)

 Was this ever discussed before this email thread? I'd like to see at
 least one more ack (Daniel already ack'd) before I'm comfortable pushing
 this to wayland master, as this is part of the core protocol.

 Oh one more thing.

 Would we want to specify no repeat values?

 Also, while it is just an event and error codes would not make sense in
 the protocol, we should probably still mention, that negative values are
 illegal - what to do with zero?

I guess having 0 in the rate field could be used for no repeat,
ignoring the delay one.


 Re-reading it, this seems funnily said:
  +   summary=time in milliseconds between keys repeating/
 I think it wants to say: delay in milliseconds since key-down until
 repeating starts or something. Not between keys since that sounds
 like repeat rate. :-)

Agreed, that is not clearly worded.

Kudos for this Jonny, it was needed. :)



Giulio



 Thanks,
 pq
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH libinput 0/24] Tablet support

2014-06-02 Thread Bill Spitzak

On 06/01/2014 09:18 PM, Peter Hutterer wrote:


libinput doesn't communicate over the wire, li_fixed_t is a leftover from
libinput being part of weston. Switching that to double would indeed make
things a lot easier and decouple libinput from wl-protocol-specific things.

I'd be all up for it, though it'd be a bit of an API change that we'd have
to fix in the callers.


It seems like a design goal of libinput is to avoid having to copy too 
much identical input handling into each wayland compositor, so I feel it 
makes sense for libinput to deliver data that is as close to what the 
wayland compositor will deliver to the clients as possible.


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland-web 0/7] Version 5 of build instructions patch

2014-06-02 Thread Bill Spitzak



On 06/01/2014 12:59 AM, Pekka Paalanen wrote:

On Fri, 30 May 2014 14:12:28 -0700
Bill Spitzak spit...@gmail.com wrote:


This is a duplicate posting but I removed the in-reply-to because
that seems to have hidden it, as there have been no comments.


You can go look at
http://lists.freedesktop.org/archives/wayland-devel/ to see if your
posting got to the list.

Me or anyone else not commenting indicates nothing except I just
ran out of time dealing with this for now. I'll get back
eventually, I think.


Yes it was there, my concern was really that it was listed before 
another version of the patch I posted. I really was worried that the 
first comment I got would be on the wrong version of the patch.

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Getting egl clients to work

2014-06-02 Thread Bill Spitzak
Actually all I am trying to do is get software EGL to work. I did not 
think there was a chance at all that the nVidia drivers could be used. 
But maybe it is a possibility...



Sounds like you are using Mesa (software renderer) on your
system otherwise using Nvidia proprietary stack (right?).


Yes


At some point I thought you wanted to run Weston using Nvidia's
EGL to get hardware acceleration in Weston itself, not Mesa EGL
which on Nvidia proprietary drivers can only ever offer software
rendering.


Actually all I am trying to do is get mesa's software EGL to work, and 
only in the X11 backend. I did not think there was a chance at all that 
the nVidia drivers could be used...


My assumption was that both weston and any clients would load my 
locally-compiled mesa, which would then figure out that only software 
rendering would work, and use that into SHM buffers.


It now looks like weston successfully does this, but clients fail?


You should not install Mesa at all, if you wanted to use Nvidia's
libEGL, or otherwise make sure the correct libs get loaded.

Nvidia's libEGL can in theory work only with the x11-backend of
Weston.


That would be very interesting if it works...


egl_dri2 is a built-in, not a file like egl_gallium.so. A
side-effect of egl_dri2 is that it does not implement the generic
software rendering path on the Wayland platform (i.e. for Wayland
apps).

Again, for Wayland apps to be able to use a software renderer from
Mesa, Mesa has to install egl_gallium.so and the apps need to use
it. When this is done properly, it does not matter to apps what EGL
Weston itself is using.


Okay, this seems to be the problem I am having. For some reason the 
clients fail to use egl_gallium. Is this a bug? Is Mesa compiled 
incorrectly? Should I set an environment variable? This is all a mystery 
to me.

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Getting egl clients to work

2014-06-02 Thread Pekka Paalanen
On Mon, 02 Jun 2014 10:46:29 -0700
Bill Spitzak spit...@gmail.com wrote:

 Actually all I am trying to do is get software EGL to work. I did
 not think there was a chance at all that the nVidia drivers could
 be used. But maybe it is a possibility...
 
  Sounds like you are using Mesa (software renderer) on your
  system otherwise using Nvidia proprietary stack (right?).
 
 Yes
 
  At some point I thought you wanted to run Weston using Nvidia's
  EGL to get hardware acceleration in Weston itself, not Mesa EGL
  which on Nvidia proprietary drivers can only ever offer software
  rendering.
 
 Actually all I am trying to do is get mesa's software EGL to
 work, and only in the X11 backend. I did not think there was a
 chance at all that the nVidia drivers could be used...
 
 My assumption was that both weston and any clients would load my 
 locally-compiled mesa, which would then figure out that only
 software rendering would work, and use that into SHM buffers.
 
 It now looks like weston successfully does this, but clients fail?

Indeed yes. You can confirm it by looking at Weston's log (stderr),
where it reports the GL version string etc.

  You should not install Mesa at all, if you wanted to use
  Nvidia's libEGL, or otherwise make sure the correct libs get
  loaded.
 
  Nvidia's libEGL can in theory work only with the x11-backend of
  Weston.
 
 That would be very interesting if it works...
 
  egl_dri2 is a built-in, not a file like egl_gallium.so. A
  side-effect of egl_dri2 is that it does not implement the
  generic software rendering path on the Wayland platform (i.e.
  for Wayland apps).
 
  Again, for Wayland apps to be able to use a software renderer
  from Mesa, Mesa has to install egl_gallium.so and the apps need
  to use it. When this is done properly, it does not matter to
  apps what EGL Weston itself is using.
 
 Okay, this seems to be the problem I am having. For some reason
 the clients fail to use egl_gallium. Is this a bug? Is Mesa
 compiled incorrectly? Should I set an environment variable? This
 is all a mystery to me.

It is again the --enable-gallium-egl option to Mesa's configure,
that lets it build egl_gallium.so.


Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH libinput 0/24] Tablet support

2014-06-02 Thread Jonas Ådahl
On Mon, Jun 02, 2014 at 10:25:02AM -0700, Bill Spitzak wrote:
 On 06/01/2014 09:18 PM, Peter Hutterer wrote:
 
 libinput doesn't communicate over the wire, li_fixed_t is a leftover from
 libinput being part of weston. Switching that to double would indeed make
 things a lot easier and decouple libinput from wl-protocol-specific things.
 
 I'd be all up for it, though it'd be a bit of an API change that we'd have
 to fix in the callers.

Yea, I've been considering this change as well for a while, and can
come up with patches for libinput and the users I'm aware of (weston,
clutter and xf86-input-libinput).

 
 It seems like a design goal of libinput is to avoid having to copy
 too much identical input handling into each wayland compositor, so I
 feel it makes sense for libinput to deliver data that is as close to
 what the wayland compositor will deliver to the clients as possible.

Indeed. While for motion vectors there is less risk for overflow errors
as they usually don't get close to LI_FIXED_MAX, but while other type of
data might be less problematic using floating point number type (such as
normalized data), its more consistent to use either only floating point
or fixed point and floating point is more flexible. Internally, even for
motion vectors, more or less all non-integer numbers will at one time
have been converted to floating point number before converting to fixed
point, so right now the fact that we use fixed numbers for these data
means we loose precision.

Converting to wl_fixed_t is pretty trivial, so that won't really
complicate things much for current libinput using Wayland compositors.
Its not decided how normalized data will be represented in a Wayland
tablet protocol, but if that convertion to some fixed type is non-trivial,
libinput could probably help with that if needed, as it helps with
screen output dimension based scaling.


Jonas

 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Getting egl clients to work

2014-06-02 Thread Bill Spitzak
I recompiled mesa with --enable-gallium-egl (is there a reason this is 
disabled in the build instructions?). This certainly had some effect but 
the egl test program still fails:


$ weston/weston-simple-egl
...
libEGL debug: Native platform type: wayland (autodetected)
libEGL debug: EGL search path is /home/wspitzak/install/lib/egl
libEGL debug: added /home/wspitzak/install/lib/egl/egl_gallium.so to 
module array

libEGL debug: added egl_dri2 to module array
libEGL debug: dlopen(/home/wspitzak/install/lib/egl/egl_gallium.so)
libEGL info: use wayland for display 0xa0c010
...
libEGL debug: EGL user error 0x3001 (EGL_NOT_INITIALIZED) in 
eglInitialize(failed to initialize screen)

...
libEGL info: use wayland for display 0xa0c010
libEGL info: use software fallback
...
libEGL debug: the best driver is Gallium
libEGL debug: the value (0x0) of attribute 0x3040 did not meet the 
criteria (0x4)
libEGL debug: the value (0x0) of attribute 0x3040 did not meet the 
criteria (0x4)
libEGL debug: the value (0x0) of attribute 0x3040 did not meet the 
criteria (0x4)
libEGL debug: the value (0x0) of attribute 0x3040 did not meet the 
criteria (0x4)
libEGL debug: the value (0x0) of attribute 0x3040 did not meet the 
criteria (0x4)
libEGL debug: the value (0x0) of attribute 0x3040 did not meet the 
criteria (0x4)
libEGL debug: the value (0x0) of attribute 0x3040 did not meet the 
criteria (0x4)
libEGL debug: the value (0x0) of attribute 0x3040 did not meet the 
criteria (0x4)
libEGL debug: the value (0x0) of attribute 0x3040 did not meet the 
criteria (0x4)
libEGL debug: the value (0x0) of attribute 0x3040 did not meet the 
criteria (0x4)
weston-simple-egl: clients/simple-egl.c:163: init_egl: Assertion `ret  
n = 1' failed.

Aborted (core dumped)
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 1/2] libinput: evdev.c: use correct fallback value for KEY_LIGHTS_TOGGLE

2014-06-02 Thread Peter Korsgaard
The kernel defines KEY_LIGHTS_TOGGLE as 0x21e, not 0x160 (which is KEY_OK).

Signed-off-by: Peter Korsgaard pe...@korsgaard.com
---
 src/evdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/evdev.c b/src/evdev.c
index ed5749e..3053764 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -42,7 +42,7 @@
 #define DEFAULT_AXIS_STEP_DISTANCE li_fixed_from_int(10)
 
 #ifndef KEY_LIGHTS_TOGGLE
-#define KEY_LIGHTS_TOGGLE 0x160
+#define KEY_LIGHTS_TOGGLE 0x21e
 #endif
 
 void
-- 
2.0.0.rc2

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 2/2] libinput: evdev.c: provide fallback definition for KEY_MICMUTE

2014-06-02 Thread Peter Korsgaard
KEY_MICMUTE was added relatively recently (3.1 with 33009557bd: Add
KEY_MICMUTE and enable it on Lenovo X220), so provide a fallback definition
similar to how we do it for KEY_LIGHTS_TOGGLE to fix compilation with older
toolchains.

Signed-off-by: Peter Korsgaard pe...@korsgaard.com
---
 src/evdev.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/evdev.c b/src/evdev.c
index 3053764..d32ece3 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -41,6 +41,10 @@
 
 #define DEFAULT_AXIS_STEP_DISTANCE li_fixed_from_int(10)
 
+#ifndef KEY_MICMUTE
+#define KEY_MICMUTE 0xf8
+#endif
+
 #ifndef KEY_LIGHTS_TOGGLE
 #define KEY_LIGHTS_TOGGLE 0x21e
 #endif
-- 
2.0.0.rc2

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 2/2] libinput: evdev.c: provide fallback definition for KEY_MICMUTE

2014-06-02 Thread Jonas Ådahl
On Mon, Jun 02, 2014 at 11:11:31PM +0200, Peter Korsgaard wrote:
 KEY_MICMUTE was added relatively recently (3.1 with 33009557bd: Add
 KEY_MICMUTE and enable it on Lenovo X220), so provide a fallback definition
 similar to how we do it for KEY_LIGHTS_TOGGLE to fix compilation with older
 toolchains.

Thanks, pushed. However, it would probably be better to just include a
whole copy of a recent input.h from linux and use that when building
instead of (potentially mistakingly, obviously) the one installed on the
system.

Jonas

 
 Signed-off-by: Peter Korsgaard pe...@korsgaard.com
 ---
  src/evdev.c | 4 
  1 file changed, 4 insertions(+)
 
 diff --git a/src/evdev.c b/src/evdev.c
 index 3053764..d32ece3 100644
 --- a/src/evdev.c
 +++ b/src/evdev.c
 @@ -41,6 +41,10 @@
  
  #define DEFAULT_AXIS_STEP_DISTANCE li_fixed_from_int(10)
  
 +#ifndef KEY_MICMUTE
 +#define KEY_MICMUTE 0xf8
 +#endif
 +
  #ifndef KEY_LIGHTS_TOGGLE
  #define KEY_LIGHTS_TOGGLE 0x21e
  #endif
 -- 
 2.0.0.rc2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[RFC libinput] Use floating point numbers instead of fixed point numbers

2014-06-02 Thread Jonas Ådahl
Fixed point numbers can easily overflow, and double to fixed point
conversion is lossy. Use floating point (double) where fixed point
numbers where previously used and remove the li_fixed_t type.

Signed-off-by: Jonas Ådahl jad...@gmail.com
---

It has been brought up a couple of times that it might not be the best
idea to use fixed point numbers in the libinput API due to various
reasons. This patch changes the API to always use double where it fixed
point were previously used.

Will reply to this E-mail with patches to weston, clutter and
xf86-input-libinput for consideration.

Jonas

 src/evdev-mt-touchpad.c | 12 +++--
 src/evdev.c | 51 +
 src/evdev.h | 10 
 src/libinput-private.h  | 18 ++---
 src/libinput-util.h | 23 -
 src/libinput.c  | 50 ++--
 src/libinput.h  | 68 -
 test/pointer.c  |  7 +++--
 test/touch.c|  6 ++---
 tools/event-debug.c | 28 
 10 files changed, 94 insertions(+), 179 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 26d5f7d..4973a5f 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -488,7 +488,7 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t 
time)
pointer_notify_axis(tp-device-base,
time,
LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL,
-   li_fixed_from_double(dy));
+   dy);
}
 
if (dx != 0.0 
@@ -496,7 +496,7 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t 
time)
pointer_notify_axis(tp-device-base,
time,
LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL,
-   li_fixed_from_double(dx));
+   dx);
}
 }
 
@@ -576,12 +576,8 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time)
tp_get_delta(t, dx, dy);
tp_filter_motion(tp, dx, dy, time);
 
-   if (dx != 0 || dy != 0)
-   pointer_notify_motion(
-   tp-device-base,
-   time,
-   li_fixed_from_double(dx),
-   li_fixed_from_double(dy));
+   if (dx != 0.0 || dy != 0.0)
+   pointer_notify_motion(tp-device-base, time, dx, dy);
}
 }
 
diff --git a/src/evdev.c b/src/evdev.c
index d32ece3..d23c09f 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -39,7 +39,7 @@
 #include filter.h
 #include libinput-private.h
 
-#define DEFAULT_AXIS_STEP_DISTANCE li_fixed_from_int(10)
+#define DEFAULT_AXIS_STEP_DISTANCE 10
 
 #ifndef KEY_MICMUTE
 #define KEY_MICMUTE 0xf8
@@ -97,22 +97,22 @@ transform_absolute(struct evdev_device *device, int32_t *x, 
int32_t *y)
}
 }
 
-li_fixed_t
+double
 evdev_device_transform_x(struct evdev_device *device,
-li_fixed_t x,
+double x,
 uint32_t width)
 {
-   return ((uint64_t)x - li_fixed_from_int(device-abs.min_x)) * width /
-   (device-abs.max_x - device-abs.min_x + 1);
+   return (x - (double) device-abs.min_x) * (double) width /
+   (double) (device-abs.max_x - device-abs.min_x + 1);
 }
 
-li_fixed_t
+double
 evdev_device_transform_y(struct evdev_device *device,
-li_fixed_t y,
+double y,
 uint32_t height)
 {
-   return ((uint64_t)y - li_fixed_from_int(device-abs.min_y)) * height /
-   (device-abs.max_y - device-abs.min_y + 1);
+   return (y - (double) device-abs.min_y) * (double) height /
+   (double) (device-abs.max_y - device-abs.min_y + 1);
 }
 
 static void
@@ -120,8 +120,7 @@ evdev_flush_pending_event(struct evdev_device *device, 
uint64_t time)
 {
struct motion_params motion;
int32_t cx, cy;
-   li_fixed_t x, y;
-   li_fixed_t dx, dy;
+   double x, y;
int slot;
int seat_slot;
struct libinput_device *base = device-base;
@@ -133,20 +132,18 @@ evdev_flush_pending_event(struct evdev_device *device, 
uint64_t time)
case EVDEV_NONE:
return;
case EVDEV_RELATIVE_MOTION:
-   motion.dx = li_fixed_to_double(device-rel.dx);
-   motion.dy = li_fixed_to_double(device-rel.dy);
+   motion.dx = (double) device-rel.dx;
+   motion.dy = (double) device-rel.dy;
device-rel.dx = 0;
device-rel.dy = 0;
 
/* Apply pointer acceleration. */
filter_dispatch(device-pointer.filter, motion, device, time);
 
- 

[PATCH weston] libinput: Use floating point instead of fixed point numbers

2014-06-02 Thread Jonas Ådahl
Signed-off-by: Jonas Ådahl jad...@gmail.com
---
 src/libinput-device.c | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/src/libinput-device.c b/src/libinput-device.c
index 4605a76..2ba4ec3 100644
--- a/src/libinput-device.c
+++ b/src/libinput-device.c
@@ -73,11 +73,14 @@ handle_pointer_motion(struct libinput_device 
*libinput_device,
 {
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
+   wl_fixed_t dx, dy;
 
+   dx = wl_fixed_from_double(libinput_event_pointer_get_dx(pointer_event));
+   dy = wl_fixed_from_double(libinput_event_pointer_get_dy(pointer_event));
notify_motion(device-seat,
  libinput_event_pointer_get_time(pointer_event),
- libinput_event_pointer_get_dx(pointer_event),
- libinput_event_pointer_get_dy(pointer_event));
+ dx,
+ dy);
 }
 
 static void
@@ -99,10 +102,12 @@ handle_pointer_motion_absolute(
width = device-output-current_mode-width;
height = device-output-current_mode-height;
 
-   x = libinput_event_pointer_get_absolute_x_transformed(pointer_event,
- width);
-   y = libinput_event_pointer_get_absolute_y_transformed(pointer_event,
- height);
+   x = wl_fixed_from_double(
+   libinput_event_pointer_get_absolute_x_transformed(pointer_event,
+ width));
+   y = wl_fixed_from_double(
+   libinput_event_pointer_get_absolute_y_transformed(pointer_event,
+ height));
 
weston_output_transform_coordinate(device-output, x, y, x, y);
notify_motion_absolute(device-seat, time, x, y);
@@ -127,11 +132,13 @@ handle_pointer_axis(struct libinput_device 
*libinput_device,
 {
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
+   double value;
 
+   value = libinput_event_pointer_get_axis_value(pointer_event);
notify_axis(device-seat,
libinput_event_pointer_get_time(pointer_event),
libinput_event_pointer_get_axis(pointer_event),
-   libinput_event_pointer_get_axis_value(pointer_event));
+   wl_fixed_from_double(value));
 }
 
 static void
@@ -155,8 +162,10 @@ handle_touch_with_coords(struct libinput_device 
*libinput_device,
 
width = device-output-current_mode-width;
height = device-output-current_mode-height;
-   x = libinput_event_touch_get_x_transformed(touch_event, width);
-   y = libinput_event_touch_get_y_transformed(touch_event, height);
+   x = wl_fixed_from_double(
+   libinput_event_touch_get_x_transformed(touch_event, width));
+   y = wl_fixed_from_double(
+   libinput_event_touch_get_y_transformed(touch_event, height));
 
weston_output_transform_coordinate(device-output,
   x, y, x, y);
-- 
1.9.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH xf86-input-libinput] Use floating point instead of fixed point numbers

2014-06-02 Thread Jonas Ådahl
Signed-off-by: Jonas Ådahl jad...@gmail.com
---
 src/libinput.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/libinput.c b/src/libinput.c
index 9221ec7..1851157 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -347,14 +347,14 @@ xf86libinput_handle_motion(InputInfoPtr pInfo, struct 
libinput_event_pointer *ev
DeviceIntPtr dev = pInfo-dev;
struct xf86libinput *driver_data = pInfo-private;
ValuatorMask *mask = driver_data-valuators;
-   li_fixed_t fx, fy;
+   double x, y;
 
-   fx = libinput_event_pointer_get_dx(event);
-   fy = libinput_event_pointer_get_dy(event);
+   x = libinput_event_pointer_get_dx(event);
+   y = libinput_event_pointer_get_dy(event);
 
valuator_mask_zero(mask);
-   valuator_mask_set_double(mask, 0, li_fixed_to_double(fx));
-   valuator_mask_set_double(mask, 1, li_fixed_to_double(fy));
+   valuator_mask_set_double(mask, 0, x);
+   valuator_mask_set_double(mask, 1, y);
 
xf86PostMotionEventM(dev, Relative, mask);
 }
@@ -397,7 +397,7 @@ xf86libinput_handle_axis(InputInfoPtr pInfo, struct 
libinput_event_pointer *even
struct xf86libinput *driver_data = pInfo-private;
ValuatorMask *mask = driver_data-valuators;
int axis;
-   li_fixed_t value;
+   double value;
 
if (libinput_event_pointer_get_axis(event) ==
LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL)
@@ -408,7 +408,7 @@ xf86libinput_handle_axis(InputInfoPtr pInfo, struct 
libinput_event_pointer *even
value = libinput_event_pointer_get_axis_value(event) / 
DEFAULT_LIBINPUT_AXIS_STEP_DISTANCE;
 
valuator_mask_zero(mask);
-   valuator_mask_set_double(mask, axis, li_fixed_to_double(value));
+   valuator_mask_set_double(mask, axis, value);
 
xf86PostMotionEventM(dev, Relative, mask);
 }
@@ -423,7 +423,7 @@ xf86libinput_handle_touch(InputInfoPtr pInfo,
int type;
int slot;
ValuatorMask *m = driver_data-valuators;
-   li_fixed_t val;
+   double val;
 
/* libinput doesn't give us hw touch ids which X expects, so
   emulate them here */
@@ -451,10 +451,10 @@ xf86libinput_handle_touch(InputInfoPtr pInfo,
 
if (event_type != LIBINPUT_EVENT_TOUCH_UP) {
val = libinput_event_touch_get_x_transformed(event, 
TOUCH_AXIS_MAX);
-   valuator_mask_set_double(m, 0, li_fixed_to_double(val));
+   valuator_mask_set_double(m, 0, val);
 
val = libinput_event_touch_get_y_transformed(event, 
TOUCH_AXIS_MAX);
-   valuator_mask_set_double(m, 1, li_fixed_to_double(val));
+   valuator_mask_set_double(m, 1, val);
}
 
xf86PostTouchEvent(dev, touchids[slot], type, 0, m);
-- 
1.9.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH clutter] evdev: Used floating point instead of fixed point numbers

2014-06-02 Thread Jonas Ådahl
---
 clutter/evdev/clutter-device-manager-evdev.c | 40 ++--
 clutter/evdev/clutter-input-device-evdev.h   |  2 --
 2 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/clutter/evdev/clutter-device-manager-evdev.c 
b/clutter/evdev/clutter-device-manager-evdev.c
index 9065fdc..3834042 100644
--- a/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/evdev/clutter-device-manager-evdev.c
@@ -400,8 +400,8 @@ notify_absolute_motion (ClutterInputDevice *input_device,
 static void
 notify_relative_motion (ClutterInputDevice *input_device,
 guint32 time_,
-li_fixed_t  dx,
-li_fixed_t  dy)
+double  dx,
+double  dy)
 {
   gfloat new_x, new_y;
   ClutterInputDeviceEvdev *device_evdev;
@@ -416,17 +416,9 @@ notify_relative_motion (ClutterInputDevice *input_device,
   device_evdev = CLUTTER_INPUT_DEVICE_EVDEV (input_device);
   seat = _clutter_input_device_evdev_get_seat (device_evdev);
 
-  /* Append previously discarded fraction. */
-  dx += device_evdev-dx_frac;
-  dy += device_evdev-dy_frac;
-
   clutter_input_device_get_coords (seat-core_pointer, NULL, point);
-  new_x = point.x + li_fixed_to_int (dx);
-  new_y = point.y + li_fixed_to_int (dy);
-
-  /* Save the discarded fraction part for next motion event. */
-  device_evdev-dx_frac = (dx  0 ? -1 : 1) * (0xff  dx);
-  device_evdev-dy_frac = (dy  0 ? -1 : 1) * (0xff  dy);
+  new_x = point.x + dx;
+  new_y = point.y + dy;
 
   notify_absolute_motion (input_device, time_, new_x, new_y);
 }
@@ -1122,7 +1114,7 @@ process_device_event (ClutterDeviceManagerEvdev 
*manager_evdev,
 case LIBINPUT_EVENT_POINTER_MOTION:
   {
 guint32 time;
-li_fixed_t dx, dy;
+double dx, dy;
 struct libinput_event_pointer *motion_event =
   libinput_event_get_pointer_event (event);
 device = libinput_device_get_user_data (libinput_device);
@@ -1138,7 +1130,7 @@ process_device_event (ClutterDeviceManagerEvdev 
*manager_evdev,
 case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
   {
 guint32 time;
-li_fixed_t x, y;
+double x, y;
 gfloat stage_width, stage_height;
 ClutterStage *stage;
 struct libinput_event_pointer *motion_event =
@@ -1157,10 +1149,7 @@ process_device_event (ClutterDeviceManagerEvdev 
*manager_evdev,
stage_width);
 y = libinput_event_pointer_get_absolute_y_transformed (motion_event,
stage_height);
-notify_absolute_motion (device,
-time,
-li_fixed_to_double(x),
-li_fixed_to_double(y));
+notify_absolute_motion (device, time, x, y);
 
 break;
   }
@@ -1191,8 +1180,7 @@ process_device_event (ClutterDeviceManagerEvdev 
*manager_evdev,
 device = libinput_device_get_user_data (libinput_device);
 
 time = libinput_event_pointer_get_time (axis_event);
-value = li_fixed_to_double (
-  libinput_event_pointer_get_axis_value (axis_event));
+value = libinput_event_pointer_get_axis_value (axis_event);
 axis = libinput_event_pointer_get_axis (axis_event);
 
 switch (axis)
@@ -1218,7 +1206,7 @@ process_device_event (ClutterDeviceManagerEvdev 
*manager_evdev,
   {
 gint32 slot;
 guint32 time;
-li_fixed_t x, y;
+double x, y;
 gfloat stage_width, stage_height;
 ClutterStage *stage;
 ClutterTouchState *touch_state;
@@ -1241,8 +1229,8 @@ process_device_event (ClutterDeviceManagerEvdev 
*manager_evdev,
 stage_height);
 
 touch_state = _device_seat_add_touch (device, slot);
-touch_state-coords.x = li_fixed_to_double (x);
-touch_state-coords.y = li_fixed_to_double (y);
+touch_state-coords.x = x;
+touch_state-coords.y = y;
 
 notify_touch_event (device, CLUTTER_TOUCH_BEGIN, time, slot,
  touch_state-coords.x, touch_state-coords.y);
@@ -1273,7 +1261,7 @@ process_device_event (ClutterDeviceManagerEvdev 
*manager_evdev,
   {
 gint32 slot;
 guint32 time;
-li_fixed_t x, y;
+double x, y;
 gfloat stage_width, stage_height;
 ClutterStage *stage;
 ClutterTouchState *touch_state;
@@ -1296,8 +1284,8 @@ process_device_event (ClutterDeviceManagerEvdev 
*manager_evdev,
 stage_height);
 
 touch_state = _device_seat_get_touch (device, slot);
-touch_state-coords.x = li_fixed_to_double (x);
-touch_state-coords.y = li_fixed_to_double (y);
+touch_state-coords.x = x;
+   

[PATCH libinput] Add our own version of linux/input.h

2014-06-02 Thread Peter Hutterer
Avoids having to #define any values we're trying to use.

Header file is from Linux 3.15-rc8.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 include/linux/input.h   | 1174 +++
 src/Makefile.am |6 +-
 src/evdev-mt-touchpad-buttons.c |4 -
 src/evdev.c |8 -
 test/Makefile.am|5 +-
 tools/Makefile.am   |3 +-
 6 files changed, 1184 insertions(+), 16 deletions(-)
 create mode 100644 include/linux/input.h

diff --git a/include/linux/input.h b/include/linux/input.h
new file mode 100644
index 000..aa98ce7
--- /dev/null
+++ b/include/linux/input.h
@@ -0,0 +1,1174 @@
+/*
+ * Copyright (c) 1999-2002 Vojtech Pavlik
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+#ifndef _INPUT_H
+#define _INPUT_H
+
+
+#include sys/time.h
+#include sys/ioctl.h
+#include sys/types.h
+#include linux/types.h
+
+
+/*
+ * The event structure itself
+ */
+
+struct input_event {
+   struct timeval time;
+   __u16 type;
+   __u16 code;
+   __s32 value;
+};
+
+/*
+ * Protocol version.
+ */
+
+#define EV_VERSION 0x010001
+
+/*
+ * IOCTLs (0x00 - 0x7f)
+ */
+
+struct input_id {
+   __u16 bustype;
+   __u16 vendor;
+   __u16 product;
+   __u16 version;
+};
+
+/**
+ * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
+ * @value: latest reported value for the axis.
+ * @minimum: specifies minimum value for the axis.
+ * @maximum: specifies maximum value for the axis.
+ * @fuzz: specifies fuzz value that is used to filter noise from
+ * the event stream.
+ * @flat: values that are within this value will be discarded by
+ * joydev interface and reported as 0 instead.
+ * @resolution: specifies resolution for the values reported for
+ * the axis.
+ *
+ * Note that input core does not clamp reported values to the
+ * [minimum, maximum] limits, such task is left to userspace.
+ *
+ * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in
+ * units per millimeter (units/mm), resolution for rotational axes
+ * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
+ */
+struct input_absinfo {
+   __s32 value;
+   __s32 minimum;
+   __s32 maximum;
+   __s32 fuzz;
+   __s32 flat;
+   __s32 resolution;
+};
+
+/**
+ * struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls
+ * @scancode: scancode represented in machine-endian form.
+ * @len: length of the scancode that resides in @scancode buffer.
+ * @index: index in the keymap, may be used instead of scancode
+ * @flags: allows to specify how kernel should handle the request. For
+ * example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel
+ * should perform lookup in keymap by @index instead of @scancode
+ * @keycode: key code assigned to this scancode
+ *
+ * The structure is used to retrieve and modify keymap data. Users have
+ * option of performing lookup either by @scancode itself or by @index
+ * in keymap entry. EVIOCGKEYCODE will also return scancode or index
+ * (depending on which element was used to perform lookup).
+ */
+struct input_keymap_entry {
+#define INPUT_KEYMAP_BY_INDEX  (1  0)
+   __u8  flags;
+   __u8  len;
+   __u16 index;
+   __u32 keycode;
+   __u8  scancode[32];
+};
+
+#define EVIOCGVERSION  _IOR('E', 0x01, int)/* get 
driver version */
+#define EVIOCGID   _IOR('E', 0x02, struct input_id)/* get 
device ID */
+#define EVIOCGREP  _IOR('E', 0x03, unsigned int[2])/* get 
repeat settings */
+#define EVIOCSREP  _IOW('E', 0x03, unsigned int[2])/* set 
repeat settings */
+
+#define EVIOCGKEYCODE  _IOR('E', 0x04, unsigned int[2])/* get 
keycode */
+#define EVIOCGKEYCODE_V2   _IOR('E', 0x04, struct input_keymap_entry)
+#define EVIOCSKEYCODE  _IOW('E', 0x04, unsigned int[2])/* set 
keycode */
+#define EVIOCSKEYCODE_V2   _IOW('E', 0x04, struct input_keymap_entry)
+
+#define EVIOCGNAME(len)_IOC(_IOC_READ, 'E', 0x06, len) 
/* get device name */
+#define EVIOCGPHYS(len)_IOC(_IOC_READ, 'E', 0x07, len) 
/* get physical location */
+#define EVIOCGUNIQ(len)_IOC(_IOC_READ, 'E', 0x08, len) 
/* get unique identifier */
+#define EVIOCGPROP(len)_IOC(_IOC_READ, 'E', 0x09, len) 
/* get device properties */
+
+/**
+ * EVIOCGMTSLOTS(len) - get MT slot values
+ * @len: size of the data buffer in bytes
+ *
+ * The ioctl buffer argument should be binary equivalent to
+ *
+ * struct input_mt_request_layout {
+ * __u32 code;
+ * __s32 values[num_slots];
+ * };
+ *
+ * where num_slots is the (arbitrary) number of MT slots to extract.
+ *
+ * The 

Re: Weston multitouch support?

2014-06-02 Thread Peter Hutterer
On Mon, Jun 02, 2014 at 12:45:51PM +0100, José Expósito wrote:
 Hi Peter,
 
 I have checked the libinput implementation and, correct me if I'm wrong, I
 have seen that 2 fingers click is interpreted as right click, 3 fingers
 click is  interpreted as middle click and there are some special rules for
 specified trackpads, like corner clicks.

there are some special rules for clickpads, specifically a click with a
finger resting on one of the software-button areas will produce a right
or middle click.

 Does that mean that the other MT events are not sent to the clients? Could
 it be possible to get the 2 fingers pinch gesture from a QML client for
 example?

not from a touchpad, not at this point. There are some rough plans but we've
pretty much deferred them until we had the basics sorted with libinput.

 So mainly my question is: is it possible to port (
 https://code.google.com/p/touchegg/) as a wayland compositor, for example
 to manage desktop specified gestures, and still use client gestures like
 pinch and zoom?

eventually yes, but not at this point. as I said in the previous email you
just won't have access to the data. I think a sensible solution here is to
have libinput send semantic events like pinch, rotate, etc. and then
have the compositor hook into those. the actual compositor part would be
quite small and have no actual gesture recognition, that would be done
inside libinput. but we're just not there yet.

 By the way, I compiled Wayland/Weston as specified here:
 http://wayland.freedesktop.org/building.html
 
 And QtWayland as specified here:
 http://wayland.freedesktop.org/qt5.html
 
 But I don't see any references to the forked libinput library. Does that
 mean that I should compile libinput and recompile Wayland/Weston against
 this library instead of the system one?
 
 I'm sorry for all the questions, but I didn't find any documentation about
 that.

it's fairly new and the documentation hasn't been updated yet. configure
weston with --enable-libinput-backend and that should get you started.

Cheers,
   Peter

 2014-06-02 4:30 GMT+01:00 Peter Hutterer peter.hutte...@who-t.net:
 
  On Sun, Jun 01, 2014 at 11:38:02PM +0100, José Expósito wrote:
   Hi Daniel,
  
   I'm asking because I'm the author of this tool:
   https://code.google.com/p/touchegg/
  
   That is exactly what you mention but for X11. So I'd like to port it to
   Wayland if it is possible of course.
  
The intention was to reserve trackpad
gestures for a gesture interpreter
which lives in the compositor and is
properly integrated with, e.g., scrolling
and tap-to-click.
  
   Does this mean that it is possible to get multi touch gestures in the
   compositor at the moment?
   Will or is it possible to use both approach? I mean, get system gestures
  in
   the compositor and app specified gestures in the clients, like in OS X.
 
  the input stack in weston atm is that you get touch events from a
  direct-touch MT device raw and unprocessed (save for mapping), but for
  touchpads some input events are interpreted by the stack (libinput or
  evdev-touchpad.c) and then passed on as pointer events, you don't see the
  MT
  bits of those.
 
  Cheers,
 Peter
 
 
   Thank you very much!
El 01/06/2014 23:24, Daniel Stone dan...@fooishbar.org escribió:
  
Hi,
   
   
On 1 June 2014 02:03, José Expósito jose.exposit...@gmail.com wrote:
   
And I say more or less because it is necessary to put 3 fingers on the
trackpad to start moving the rectangles...
Anyway, the program is not working on Weston. My question is, is that
because Weston doesn't implement multitouch support or because Wayland
doesn't support it at the moment? Could it be possible to implement
multitouch support in a custom compositor?
   
   
Wayland doesn't (currently) support touchpad gestures for arbitrary
clients; trying to do it for X11 uncovered a whole host of really
  subtle
and annoying issues. The intention was to reserve trackpad gestures
  for a
gesture interpreter which lives in the compositor and is properly
integrated with, e.g., scrolling and tap-to-click.
   
Can I ask if you had a specific usecase in mind?
   
Cheers,
Daniel
   
 
   ___
   wayland-devel mailing list
   wayland-devel@lists.freedesktop.org
   http://lists.freedesktop.org/mailman/listinfo/wayland-devel
 
 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [RFC libinput] Use floating point numbers instead of fixed point numbers

2014-06-02 Thread Peter Hutterer
On Mon, Jun 02, 2014 at 11:42:10PM +0200, Jonas Ådahl wrote:
 Fixed point numbers can easily overflow, and double to fixed point
 conversion is lossy. Use floating point (double) where fixed point
 numbers where previously used and remove the li_fixed_t type.
 
 Signed-off-by: Jonas Ådahl jad...@gmail.com
 ---
 
 It has been brought up a couple of times that it might not be the best
 idea to use fixed point numbers in the libinput API due to various
 reasons. This patch changes the API to always use double where it fixed
 point were previously used.
 
 Will reply to this E-mail with patches to weston, clutter and
 xf86-input-libinput for consideration.
 
 Jonas
 
  src/evdev-mt-touchpad.c | 12 +++--
  src/evdev.c | 51 +
  src/evdev.h | 10 
  src/libinput-private.h  | 18 ++---
  src/libinput-util.h | 23 -
  src/libinput.c  | 50 ++--
  src/libinput.h  | 68 
 -
  test/pointer.c  |  7 +++--
  test/touch.c|  6 ++---
  tools/event-debug.c | 28 
  10 files changed, 94 insertions(+), 179 deletions(-)
 
 diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
 index 26d5f7d..4973a5f 100644
 --- a/src/evdev-mt-touchpad.c
 +++ b/src/evdev-mt-touchpad.c
 @@ -488,7 +488,7 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t 
 time)
   pointer_notify_axis(tp-device-base,
   time,
   LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL,
 - li_fixed_from_double(dy));
 + dy);
   }
  
   if (dx != 0.0 
 @@ -496,7 +496,7 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t 
 time)
   pointer_notify_axis(tp-device-base,
   time,
   LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL,
 - li_fixed_from_double(dx));
 + dx);
   }
  }
  
 @@ -576,12 +576,8 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time)
   tp_get_delta(t, dx, dy);
   tp_filter_motion(tp, dx, dy, time);
  
 - if (dx != 0 || dy != 0)
 - pointer_notify_motion(
 - tp-device-base,
 - time,
 - li_fixed_from_double(dx),
 - li_fixed_from_double(dy));
 + if (dx != 0.0 || dy != 0.0)
 + pointer_notify_motion(tp-device-base, time, dx, dy);
   }
  }
  
 diff --git a/src/evdev.c b/src/evdev.c
 index d32ece3..d23c09f 100644
 --- a/src/evdev.c
 +++ b/src/evdev.c
 @@ -39,7 +39,7 @@
  #include filter.h
  #include libinput-private.h
  
 -#define DEFAULT_AXIS_STEP_DISTANCE li_fixed_from_int(10)
 +#define DEFAULT_AXIS_STEP_DISTANCE 10
  
  #ifndef KEY_MICMUTE
  #define KEY_MICMUTE 0xf8
 @@ -97,22 +97,22 @@ transform_absolute(struct evdev_device *device, int32_t 
 *x, int32_t *y)
   }
  }
  
 -li_fixed_t
 +double
  evdev_device_transform_x(struct evdev_device *device,
 -  li_fixed_t x,
 +  double x,
uint32_t width)
  {
 - return ((uint64_t)x - li_fixed_from_int(device-abs.min_x)) * width /
 - (device-abs.max_x - device-abs.min_x + 1);
 + return (x - (double) device-abs.min_x) * (double) width /
 + (double) (device-abs.max_x - device-abs.min_x + 1);

one cast to double is enough, you don't need to cast all of them. In this
case, because x is already double we shouldn't need any cast.

  }
  
 -li_fixed_t
 +double
  evdev_device_transform_y(struct evdev_device *device,
 -  li_fixed_t y,
 +  double y,
uint32_t height)
  {
 - return ((uint64_t)y - li_fixed_from_int(device-abs.min_y)) * height /
 - (device-abs.max_y - device-abs.min_y + 1);
 + return (y - (double) device-abs.min_y) * (double) height /
 + (double) (device-abs.max_y - device-abs.min_y + 1);
  }

same here

  static void
 @@ -120,8 +120,7 @@ evdev_flush_pending_event(struct evdev_device *device, 
 uint64_t time)
  {
   struct motion_params motion;
   int32_t cx, cy;
 - li_fixed_t x, y;
 - li_fixed_t dx, dy;
 + double x, y;
   int slot;
   int seat_slot;
   struct libinput_device *base = device-base;
 @@ -133,20 +132,18 @@ evdev_flush_pending_event(struct evdev_device *device, 
 uint64_t time)
   case EVDEV_NONE:
   return;
   case EVDEV_RELATIVE_MOTION:
 - motion.dx = li_fixed_to_double(device-rel.dx);
 - motion.dy = li_fixed_to_double(device-rel.dy);
 + motion.dx = (double) device-rel.dx;
 + motion.dy = 

Re: [PATCH libinput] Add our own version of linux/input.h

2014-06-02 Thread Thiago Macieira
Em ter 03 jun 2014, às 08:08:15, Peter Hutterer escreveu:
 Avoids having to #define any values we're trying to use.
 
 Header file is from Linux 3.15-rc8.
 
 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net

Wouldn't this be time as well to start using a different include than 
linux/input.h?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
  PGP/GPG: 0x6EF45358; fingerprint:
  E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 03/10] touchpad: hook up to the tapping configuration

2014-06-02 Thread Peter Hutterer
Now that we have run-time changes of the tap.enabled state move the check
to the IDLE state only. Otherwise the tap machine may hang if tapping is
disabled while a gesture is in progress.

Two basic tests are added to check for the tap default setting - which is now
tap disabled by default, because a bike shed's correct color is green.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/evdev-mt-touchpad-tap.c | 56 +++--
 src/evdev-mt-touchpad.h |  1 +
 test/touchpad.c | 32 ++
 3 files changed, 82 insertions(+), 7 deletions(-)

diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
index eee334f..24ea8c3 100644
--- a/src/evdev-mt-touchpad-tap.c
+++ b/src/evdev-mt-touchpad-tap.c
@@ -438,13 +438,13 @@ static void
 tp_tap_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t 
time)
 {
enum tp_tap_state current;
-   if (!tp-tap.enabled)
-   return;
 
current = tp-tap.state;
 
switch(tp-tap.state) {
case TAP_STATE_IDLE:
+   if (!tp-tap.enabled)
+   break;
tp_tap_idle_handle_event(tp, event, time);
break;
case TAP_STATE_TOUCH:
@@ -572,9 +572,6 @@ tp_tap_timeout_handler(void *data)
 unsigned int
 tp_tap_handle_timeout(struct tp_dispatch *tp, uint64_t time)
 {
-   if (!tp-tap.enabled)
-   return 0;
-
if (tp-tap.timeout  tp-tap.timeout = time) {
tp_tap_clear_timer(tp);
tp_tap_handle_event(tp, TAP_EVENT_TIMEOUT, time);
@@ -583,9 +580,56 @@ tp_tap_handle_timeout(struct tp_dispatch *tp, uint64_t 
time)
return tp-tap.timeout;
 }
 
+static int
+tp_tap_config_count(struct libinput_device *device)
+{
+   struct evdev_dispatch *dispatch = ((struct evdev_device 
*)device)-dispatch;
+   struct tp_dispatch *tp = container_of(dispatch, tp, base);
+
+   return min(tp-ntouches, 3); /* we only do up to 3 finger tap */
+}
+
+static enum libinput_config_status
+tp_tap_config_enable(struct libinput_device *device, int enabled)
+{
+   struct evdev_dispatch *dispatch = ((struct evdev_device 
*)device)-dispatch;
+   struct tp_dispatch *tp = container_of(dispatch, tp, base);
+
+   if (tp_tap_config_count(device) == 0)
+   return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
+
+   tp-tap.enabled = enabled;
+
+   return LIBINPUT_CONFIG_STATUS_SUCCESS;
+}
+
+static int
+tp_tap_config_is_enabled(struct libinput_device *device)
+{
+   struct evdev_dispatch *dispatch = ((struct evdev_device 
*)device)-dispatch;
+   struct tp_dispatch *tp = container_of(dispatch, tp, base);
+
+   return tp-tap.enabled;
+}
+
+static void
+tp_tap_config_reset(struct libinput_device *device)
+{
+   struct evdev_dispatch *dispatch = ((struct evdev_device 
*)device)-dispatch;
+   struct tp_dispatch *tp = container_of(dispatch, tp, base);
+
+   tp-tap.enabled = false;
+}
+
 int
 tp_init_tap(struct tp_dispatch *tp)
 {
+   tp-tap.config.count = tp_tap_config_count;
+   tp-tap.config.enable = tp_tap_config_enable;
+   tp-tap.config.is_enabled = tp_tap_config_is_enabled;
+   tp-tap.config.reset = tp_tap_config_reset;
+   tp-device-base.config.tap = tp-tap.config;
+
tp-tap.state = TAP_STATE_IDLE;
tp-tap.timer_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
 
@@ -603,8 +647,6 @@ tp_init_tap(struct tp_dispatch *tp)
return -1;
}
 
-   tp-tap.enabled = 1; /* FIXME */
-
return 0;
 }
 
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index d514ed6..0b31e9a 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -203,6 +203,7 @@ struct tp_dispatch {
 
struct {
bool enabled;
+   struct libinput_device_config_tap config;
int timer_fd;
struct libinput_source *source;
unsigned int timeout;
diff --git a/test/touchpad.c b/test/touchpad.c
index 35781c3..060b529 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -116,6 +116,8 @@ START_TEST(touchpad_1fg_tap)
struct libinput *li = dev-libinput;
struct libinput_event *event;
 
+   libinput_device_config_tap_enable(dev-libinput_device, 1);
+
litest_drain_events(li);
 
litest_touch_down(dev, 0, 50, 50);
@@ -141,6 +143,8 @@ START_TEST(touchpad_1fg_tap_n_drag)
struct libinput *li = dev-libinput;
struct libinput_event *event;
 
+   libinput_device_config_tap_enable(dev-libinput_device, 1);
+
litest_drain_events(li);
 
litest_touch_down(dev, 0, 50, 50);
@@ -194,6 +198,8 @@ START_TEST(touchpad_2fg_tap)
struct libinput *li = dev-libinput;
struct libinput_event *event;
 
+   libinput_device_config_tap_enable(dev-libinput_device, 1);
+
litest_drain_events(dev-libinput);
 
litest_touch_down(dev, 0, 

[PATCH libinput 02/10] Add an interface to enable/disable tapping

2014-06-02 Thread Peter Hutterer
Provide an interface to enable/disable tapping, with a default mapping of
1/2/3 fingers mapping to L/R/M button events, respectively.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/libinput-private.h | 13 +
 src/libinput.c | 33 +++
 src/libinput.h | 73 +-
 3 files changed, 118 insertions(+), 1 deletion(-)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index 61cdc79..020167e 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -69,12 +69,25 @@ struct libinput_seat {
uint32_t button_count[KEY_CNT];
 };
 
+struct libinput_device_config_tap {
+   int (*count)(struct libinput_device *device);
+   enum libinput_config_status (*enable)(struct libinput_device *device,
+ int enable);
+   int (*is_enabled)(struct libinput_device *device);
+   void (*reset)(struct libinput_device *device);
+};
+
+struct libinput_device_config {
+   struct libinput_device_config_tap *tap;
+};
+
 struct libinput_device {
struct libinput_seat *seat;
struct list link;
void *user_data;
int terminated;
int refcount;
+   struct libinput_device_config config;
 };
 
 typedef void (*libinput_source_dispatch_t)(void *data);
diff --git a/src/libinput.c b/src/libinput.c
index 6b7e8b8..6a713bb 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1182,3 +1182,36 @@ libinput_event_touch_get_base_event(struct 
libinput_event_touch *event)
 {
return event-base;
 }
+
+LIBINPUT_EXPORT int
+libinput_device_config_tap_get_finger_count(struct libinput_device *device)
+{
+   return device-config.tap ? device-config.tap-count(device) : 0;
+}
+
+LIBINPUT_EXPORT enum libinput_config_status
+libinput_device_config_tap_enable(struct libinput_device *device,
+ int enable)
+{
+   if (enable 
+   libinput_device_config_tap_get_finger_count(device) == 0)
+   return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
+
+   return device-config.tap-enable(device, enable);
+}
+
+LIBINPUT_EXPORT int
+libinput_device_config_tap_is_enabled(struct libinput_device *device)
+{
+   if (libinput_device_config_tap_get_finger_count(device) == 0)
+   return 0;
+
+   return device-config.tap-is_enabled(device);
+}
+
+LIBINPUT_EXPORT void
+libinput_device_config_tap_reset(struct libinput_device *device)
+{
+   if (device-config.tap)
+   device-config.tap-reset(device);
+}
diff --git a/src/libinput.h b/src/libinput.h
index c9ec71a..0c84547 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -1362,8 +1362,79 @@ enum libinput_config_status {
 const char *
 libinput_config_status_to_str(enum libinput_config_status status);
 
+/**
+ * @ingroup config
+ *
+ * Check if the device supports tap-to-click. See
+ * libinput_device_config_tap_set() for more information.
+ *
+ * @param device The device to configure
+ * @return The number of fingers that can generate a tap event, or 0 if the
+ * device does not support tapping.
+ *
+ * @see libinput_device_config_tap_enable
+ * @see libinput_device_config_tap_is_enabled
+ * @see libinput_device_config_tap_reset
+ */
+int
+libinput_device_config_tap_get_finger_count(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Enable tap-to-click on this device, with a default mapping of 1, 2, 3
+ * finger tap mapping to left, right, middle click, respectively.
+ * Tapping is limited by the number of simultaneous touches
+ * supported by the device, see
+ * libinput_device_config_tap_get_finger_count().
+ *
+ * @param device The device to configure
+ * @param enable Non-zero to enable, zero to disable
+ *
+ * @return A config status code. Disabling tapping on a device that does not
+ * support tapping always succeeds.
+ *
+ * @see libinput_device_config_tap_get_finger_count
+ * @see libinput_device_config_tap_is_enabled
+ * @see libinput_device_config_tap_reset
+ */
+enum libinput_config_status
+libinput_device_config_tap_enable(struct libinput_device *device,
+ int enable);
+
+/**
+ * @ingroup config
+ *
+ * Check if tap-to-click is enabled on this device. If the device does not
+ * support tapping, this function always returns 0.
+ *
+ * @param device The device to configure
+ *
+ * @return 1 if enabled, 0 otherwise.
+ *
+ * @see libinput_device_config_tap_get_finger_count
+ * @see libinput_device_config_tap_enable
+ * @see libinput_device_config_tap_reset
+ */
+int
+libinput_device_config_tap_is_enabled(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Reset tapping to the default configuration for this device. If the device
+ * does not support tapping, this function does nothing.
+ *
+ * @param device The device to configure
+ *
+ * @see libinput_device_config_tap_get_finger_count
+ * @see libinput_device_config_tap_enable
+ * @see 

[PATCH libinput 04/10] Add a config interface for scroll methods

2014-06-02 Thread Peter Hutterer
---
 src/libinput-private.h |  9 ++
 src/libinput.c | 35 
 src/libinput.h | 74 ++
 3 files changed, 118 insertions(+)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index 020167e..d3570a4 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -77,8 +77,17 @@ struct libinput_device_config_tap {
void (*reset)(struct libinput_device *device);
 };
 
+struct libinput_device_config_scroll {
+   int (*methods)(struct libinput_device *device);
+   enum libinput_config_status (*set)(struct libinput_device *device,
+  enum libinput_scroll_method method);
+   enum libinput_scroll_method (*get)(struct libinput_device *device);
+   void (*reset)(struct libinput_device *device);
+};
+
 struct libinput_device_config {
struct libinput_device_config_tap *tap;
+   struct libinput_device_config_scroll *scroll;
 };
 
 struct libinput_device {
diff --git a/src/libinput.c b/src/libinput.c
index 6a713bb..b2388e6 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1215,3 +1215,38 @@ libinput_device_config_tap_reset(struct libinput_device 
*device)
if (device-config.tap)
device-config.tap-reset(device);
 }
+
+LIBINPUT_EXPORT unsigned int
+libinput_device_config_scroll_get_methods(struct libinput_device *device)
+{
+   return device-config.scroll ?
+   device-config.scroll-methods(device) :
+   LIBINPUT_SCROLL_METHOD_NONE;
+}
+
+LIBINPUT_EXPORT enum libinput_config_status
+libinput_device_config_scroll_set_method(struct libinput_device *device,
+enum libinput_scroll_method method)
+{
+   if ((method  libinput_device_config_scroll_get_methods(device)) == 0)
+   return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
+
+   return device-config.scroll-set(device, method);
+}
+
+LIBINPUT_EXPORT enum libinput_scroll_method
+libinput_device_config_scroll_get_method(struct libinput_device *device)
+{
+   if (libinput_device_config_scroll_get_methods(device) ==
+   LIBINPUT_SCROLL_METHOD_NONE)
+   return LIBINPUT_SCROLL_METHOD_NONE;
+
+   return device-config.scroll-get(device);
+}
+
+LIBINPUT_EXPORT void
+libinput_device_config_scroll_reset(struct libinput_device *device)
+{
+   if (device-config.scroll)
+   device-config.scroll-reset(device);
+}
diff --git a/src/libinput.h b/src/libinput.h
index 0c84547..571f7ba 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -1434,6 +1434,80 @@ libinput_device_config_tap_is_enabled(struct 
libinput_device *device);
 void
 libinput_device_config_tap_reset(struct libinput_device *device);
 
+/**
+ * @ingroup config
+ *
+ * Devices without a physical scroll wheel (such as touchpads) may emulate
+ * scroll events in software through one or more methods.
+ */
+enum libinput_scroll_method {
+   /**
+* No scroll method available or selected.
+*/
+   LIBINPUT_SCROLL_METHOD_NONE = 0,
+   /**
+* Scrolling is triggered by moving a finger at the edge of the
+* touchpad.
+*/
+   LIBINPUT_SCROLL_METHOD_EDGE = (1  0),
+   /**
+* Scrolling is triggered by moving two fingers simultaneously.
+*/
+   LIBINPUT_SCROLL_METHOD_TWOFINGER = (1  1),
+};
+
+/**
+ * @ingroup config
+ *
+ * Check the available scroll methods on this device.
+ *
+ * @param device The device to configure
+ *
+ * @return A bitmask of the available scroll methods
+ */
+unsigned int
+libinput_device_config_scroll_get_methods(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Set the scroll method on this device. Only one method at a time may be
+ * chosen for each device.
+ *
+ * @param device The device to configure
+ * @param method The scroll method to chose
+ *
+ * @return A config status code
+ */
+enum libinput_config_status
+libinput_device_config_scroll_set_method(struct libinput_device *device,
+enum libinput_scroll_method method);
+
+/**
+ * @ingroup config
+ *
+ * Get the currently selected scroll method on this device. If a device does
+ * not support configurable scroll methods, the return value is always
+ * LIBINPUT_SCROLL_METHOD_NONE.
+ *
+ * @param device The device to configure
+ *
+ * @return The currently selected scroll method
+ */
+enum libinput_scroll_method
+libinput_device_config_scroll_get_method(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Reset to the default scroll method for this device, if any. If the device
+ * does not support configurable scroll methods this function does nothing.
+ *
+ * @param device The device to configure
+ */
+void
+libinput_device_config_scroll_reset(struct libinput_device *device);
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.9.0

___
wayland-devel 

[PATCH libinput 01/10] Add an enum for configuration return codes

2014-06-02 Thread Peter Hutterer
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/libinput.h | 32 
 1 file changed, 32 insertions(+)

diff --git a/src/libinput.h b/src/libinput.h
index d771e21..c9ec71a 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -1330,6 +1330,38 @@ int
 libinput_device_has_capability(struct libinput_device *device,
   enum libinput_device_capability capability);
 
+/**
+ * @defgroup config Device configuration
+ *
+ * Enable, disable and check for device-specific features. For all features,
+ * libinput assigns a default based on the hardware configuration. This
+ * default can be restored with the matching reset function call.
+ *
+ * Some configuration option may be dependent on or mutually exclusive with
+ * with other options. The behavior in those cases is
+ * implementation-defined, the caller must ensure that the options are set
+ * in the right order.
+ */
+
+enum libinput_config_status {
+   LIBINPUT_CONFIG_STATUS_SUCCESS = 0, /** Config applied 
successfully */
+   LIBINPUT_CONFIG_STATUS_UNSUPPORTED, /** Configuration not 
available on
+this device */
+   LIBINPUT_CONFIG_STATUS_INVALID, /** Invalid parameter range */
+};
+
+/**
+ * @ingroup config Device configuration
+ *
+ * Return a string describing the error.
+ *
+ * @param status The status to translate to a string
+ * @return A human-readable string representing the error or NULL for an
+ * invalid status.
+ */
+const char *
+libinput_config_status_to_str(enum libinput_config_status status);
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.9.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[RFC libinput 00/10] Add a configuration interface

2014-06-02 Thread Peter Hutterer

This is not finished just yet, but I figured I might as well send what I
have locally for some early feedback. The tapping and scrolling is already
hooked into the touchpad code (even though scrolling is hardcoded), the rest
is pretty much just there to show how the config interface would look like.

I'd be happy enough merging the tapping and scrolling bit, the rest not
until we have the hooks to actually make use of it. Right now I'm mostly
looking for comments. There are some rough bits in the code still too.

Hans suggested some extra interface to get a easy-to-print list of the
current settings, I don't have a good solution for that yet.

Cheers,
  Peter
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 05/10] touchpad: hook up scroll config

2014-06-02 Thread Peter Hutterer
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/evdev-mt-touchpad.c | 43 +++
 src/evdev-mt-touchpad.h |  1 +
 2 files changed, 44 insertions(+)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 26d5f7d..c1c994a 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -737,8 +737,51 @@ tp_init_accel(struct tp_dispatch *touchpad, double 
diagonal)
 }
 
 static int
+tp_config_scroll_methods(struct libinput_device *device)
+{
+   struct evdev_dispatch *dispatch = ((struct evdev_device 
*)device)-dispatch;
+   struct tp_dispatch *tp = container_of(dispatch, tp, base);
+
+   return LIBINPUT_SCROLL_METHOD_TWOFINGER;
+}
+
+static enum libinput_config_status
+tp_config_scroll_set(struct libinput_device *device,
+enum libinput_scroll_method method)
+{
+   struct evdev_dispatch *dispatch = ((struct evdev_device 
*)device)-dispatch;
+   struct tp_dispatch *tp = container_of(dispatch, tp, base);
+
+   if (method != LIBINPUT_SCROLL_METHOD_TWOFINGER)
+   return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
+
+   return LIBINPUT_CONFIG_STATUS_SUCCESS;
+}
+
+static enum libinput_scroll_method
+tp_config_scroll_get(struct libinput_device *device)
+{
+   struct evdev_dispatch *dispatch = ((struct evdev_device 
*)device)-dispatch;
+   struct tp_dispatch *tp = container_of(dispatch, tp, base);
+
+   return LIBINPUT_SCROLL_METHOD_TWOFINGER;
+}
+
+static void
+tp_config_scroll_reset(struct libinput_device *device)
+{
+   /* two-finger scrolling is hardcoded, nothing to do */
+}
+
+static int
 tp_init_scroll(struct tp_dispatch *tp)
 {
+   tp-scroll.config.methods = tp_config_scroll_methods;
+   tp-scroll.config.set = tp_config_scroll_set;
+   tp-scroll.config.get = tp_config_scroll_get;
+   tp-scroll.config.reset = tp_config_scroll_reset;
+   tp-device-base.config.scroll = tp-scroll.config;
+
tp-scroll.direction = 0;
tp-scroll.state = SCROLL_STATE_NONE;
 
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 0b31e9a..d89d74c 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -195,6 +195,7 @@ struct tp_dispatch {
} buttons;  /* physical buttons */
 
struct {
+   struct libinput_device_config_scroll config;
enum scroll_state state;
enum libinput_pointer_axis direction;
} scroll;
-- 
1.9.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 06/10] Add a config interface to change device rotation

2014-06-02 Thread Peter Hutterer
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/libinput-private.h |  9 +++
 src/libinput.c | 33 
 src/libinput.h | 69 ++
 3 files changed, 111 insertions(+)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index d3570a4..0d2a1b1 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -85,9 +85,18 @@ struct libinput_device_config_scroll {
void (*reset)(struct libinput_device *device);
 };
 
+struct libinput_device_config_rotation {
+   int (*increment)(struct libinput_device *device);
+   enum libinput_config_status (*set)(struct libinput_device *device,
+  int degrees_cw);
+   int (*get)(struct libinput_device *device);
+   void (*reset)(struct libinput_device *device);
+};
+
 struct libinput_device_config {
struct libinput_device_config_tap *tap;
struct libinput_device_config_scroll *scroll;
+   struct libinput_device_config_rotation *rotation;
 };
 
 struct libinput_device {
diff --git a/src/libinput.c b/src/libinput.c
index b2388e6..2572f5b 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1250,3 +1250,36 @@ libinput_device_config_scroll_reset(struct 
libinput_device *device)
if (device-config.scroll)
device-config.scroll-reset(device);
 }
+
+LIBINPUT_EXPORT int
+libinput_device_config_rotation_get_increment(struct libinput_device *device)
+{
+   return device-config.rotation ?
+   device-config.rotation-increment(device) : 0;
+}
+
+LIBINPUT_EXPORT enum libinput_config_status
+libinput_device_config_rotation_set(struct libinput_device *device,
+   int degrees_cw)
+{
+   if (libinput_device_config_rotation_get_increment(device) == 0)
+   return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
+
+   return device-config.rotation-set(device, degrees_cw);
+}
+
+LIBINPUT_EXPORT int
+libinput_device_config_rotation_get(struct libinput_device *device)
+{
+   if (libinput_device_config_rotation_get_increment(device) == 0)
+   return 0;
+
+   return device-config.rotation-get(device);
+}
+
+LIBINPUT_EXPORT void
+libinput_device_config_rotation_reset(struct libinput_device *device)
+{
+   if (libinput_device_config_rotation_get_increment(device) != 0)
+   device-config.rotation-reset(device);
+}
diff --git a/src/libinput.h b/src/libinput.h
index 571f7ba..328d050 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -1508,6 +1508,75 @@ libinput_device_config_scroll_get_method(struct 
libinput_device *device);
 void
 libinput_device_config_scroll_reset(struct libinput_device *device);
 
+
+/**
+ * @ingroup config
+ *
+ * Query the rotation increment for this device, if any. The return value is
+ * the increment in degrees. For example, a device that returns 90 may only
+ * be rotated in 90-degree increments.
+ *
+ * @param device The device to configure
+ *
+ * @return The rotation increment in degrees, or 0 if the device cannot be
+ * rotated
+ */
+int
+libinput_device_config_rotation_get_increment(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Set the rotation for this device, in degrees clockwise. This rotation
+ * applies to the physical orientation of the device, i.e. if a tablet is
+ * moved from landscape to portrait format, clockwise, this represents a
+ * 90-degree rotation. In the diagram below, if a is the device origin 0/0,
+ * after the rotation the coordinate b sends 0/0 coordinates and a sends
+ * xmax/0.
+ *
+ * @code
+ *   +-++-+
+ *   |a||b   a|
+ *   | | - | |
+ *   |b|| |
+ *   +-+| |
+ *  | |
+ *  +-+
+ * @endcode
+ *
+ * @param device The device to configure
+ * @param degrees_cw The number of degrees to rotate clockwise
+ *
+ * @return A config status code
+ */
+enum libinput_config_status
+libinput_device_config_rotation_set(struct libinput_device *device,
+   int degrees_cw);
+
+/**
+ * @ingroup config
+ *
+ * Get the current rotation for this device, in degrees clockwise. If the
+ * device does not support rotation, this function always returns 0.
+ *
+ * @param device The device to configure
+ *
+ * @return The rotation in degrees clockwise
+ */
+int
+libinput_device_config_rotation_get(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Reset the rotation to the device's default setting. If thd evice does not
+ * support rotation, this function does nothing.
+ *
+ * @param device The device to configure
+ */
+void
+libinput_device_config_rotation_reset(struct libinput_device *device);
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.9.0

___
wayland-devel mailing list

[PATCH libinput 07/10] Add a basic pointer acceleration API

2014-06-02 Thread Peter Hutterer
Only exposes two knobs - speed and precision which have historically been the
only two knobs exposed anyway on most UIs. We could go for something fancier
but really, I think this will be enough.

The only open question is whether speed will be enough for high-dpi devices.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/libinput-private.h | 12 
 src/libinput.c | 53 +
 src/libinput.h | 80 ++
 3 files changed, 145 insertions(+)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index 0d2a1b1..85113bd 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -93,10 +93,22 @@ struct libinput_device_config_rotation {
void (*reset)(struct libinput_device *device);
 };
 
+struct libinput_device_config_accel {
+   int (*available)(struct libinput_device *device);
+   enum libinput_config_status (*set_speed)(struct libinput_device *device,
+unsigned int speed);
+   enum libinput_config_status (*set_precision)(struct libinput_device 
*device,
+unsigned int precision);
+   int (*get_speed)(struct libinput_device *device);
+   int (*get_precision)(struct libinput_device *device);
+   void (*reset)(struct libinput_device *device);
+};
+
 struct libinput_device_config {
struct libinput_device_config_tap *tap;
struct libinput_device_config_scroll *scroll;
struct libinput_device_config_rotation *rotation;
+   struct libinput_device_config_accel *accel;
 };
 
 struct libinput_device {
diff --git a/src/libinput.c b/src/libinput.c
index 2572f5b..5a068f1 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1283,3 +1283,56 @@ libinput_device_config_rotation_reset(struct 
libinput_device *device)
if (libinput_device_config_rotation_get_increment(device) != 0)
device-config.rotation-reset(device);
 }
+
+
+LIBINPUT_EXPORT int
+libinput_device_config_accel_is_available(struct libinput_device *device)
+{
+   return device-config.accel ?
+   device-config.accel-available(device) : 0;
+}
+
+LIBINPUT_EXPORT enum libinput_config_status
+libinput_device_config_accel_set_speed(struct libinput_device *device,
+  unsigned int speed)
+{
+   if (!libinput_device_config_accel_is_available(device))
+   return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
+
+   return device-config.accel-set_speed(device, speed);
+}
+
+LIBINPUT_EXPORT enum libinput_config_status
+libinput_device_config_accel_set_precision(struct libinput_device *device,
+  unsigned int precision)
+{
+   if (!libinput_device_config_accel_is_available(device))
+   return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
+
+   return device-config.accel-set_precision(device, precision);
+}
+
+LIBINPUT_EXPORT unsigned int
+libinput_device_config_accel_get_speed(struct libinput_device *device)
+{
+   if (!libinput_device_config_accel_is_available(device))
+   return 0;
+
+   return device-config.accel-get_speed(device);
+}
+
+LIBINPUT_EXPORT unsigned int
+libinput_device_config_accel_get_precision(struct libinput_device *device)
+{
+   if (!libinput_device_config_accel_is_available(device))
+   return 0;
+
+   return device-config.accel-get_precision(device);
+}
+
+LIBINPUT_EXPORT void
+libinput_device_config_accel_reset(struct libinput_device *device)
+{
+   if (device-config.accel)
+   device-config.accel-reset(device);
+}
diff --git a/src/libinput.h b/src/libinput.h
index 328d050..1b6207c 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -1577,6 +1577,86 @@ libinput_device_config_rotation_get(struct 
libinput_device *device);
 void
 libinput_device_config_rotation_reset(struct libinput_device *device);
 
+/**
+ * @ingroup config
+ *
+ * Check if a device uses libinput-internal pointer-acceleration.
+ *
+ * @param device The device to configure
+ *
+ * @return 0 if the device is not accelerated, nonzero if it is accelerated
+ */
+int
+libinput_device_config_accel_is_available(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Set the speed of this pointer device, where 0% is the minimum pointer
+ * acceleration to be applied (none or slowed down, depending on the device)
+ * and 100% is the maximum amount of acceleration to be applied.
+ *
+ * @param device The device to configure
+ * @param speed The abstract speed identifier, ranged 0% to 100%.
+ *
+ * @return A config status code
+ */
+enum libinput_config_status
+libinput_device_config_accel_set_speed(struct libinput_device *device,
+  unsigned int speed);
+
+/**
+ * @ingroup config
+ *
+ * Set the precision or sensibility of this pointer device. This affects the
+ * movement of the pointer 

[PATCH libinput 08/10] Add a config API for disable-while-typing

2014-06-02 Thread Peter Hutterer
---
 src/libinput-private.h |  9 
 src/libinput.c | 33 +
 src/libinput.h | 56 ++
 3 files changed, 98 insertions(+)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index 85113bd..9a3e629 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -104,11 +104,20 @@ struct libinput_device_config_accel {
void (*reset)(struct libinput_device *device);
 };
 
+struct libinput_device_config_disable_while_typing {
+   int (*available)(struct libinput_device *device);
+   enum libinput_config_status (*enable)(struct libinput_device *device,
+ int enable);
+   int (*is_enabled)(struct libinput_device *device);
+   void (*reset)(struct libinput_device *device);
+};
+
 struct libinput_device_config {
struct libinput_device_config_tap *tap;
struct libinput_device_config_scroll *scroll;
struct libinput_device_config_rotation *rotation;
struct libinput_device_config_accel *accel;
+   struct libinput_device_config_disable_while_typing *dwt;
 };
 
 struct libinput_device {
diff --git a/src/libinput.c b/src/libinput.c
index 5a068f1..33a8e90 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1336,3 +1336,36 @@ libinput_device_config_accel_reset(struct 
libinput_device *device)
if (device-config.accel)
device-config.accel-reset(device);
 }
+
+LIBINPUT_EXPORT int
+libinput_device_config_disable_while_typing_is_available(struct 
libinput_device *device)
+{
+   return device-config.dwt ?
+   device-config.dwt-available(device) : 0;
+}
+
+LIBINPUT_EXPORT enum libinput_config_status
+libinput_device_config_disable_while_typing_enable(struct libinput_device 
*device,
+  int enable)
+{
+   if (!libinput_device_config_disable_while_typing_is_available(device))
+   return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
+
+   return device-config.dwt-enable(device, enable);
+}
+
+LIBINPUT_EXPORT int
+libinput_device_config_disable_while_typing_is_enabled(struct libinput_device 
*device)
+{
+   if (!libinput_device_config_disable_while_typing_is_available(device))
+   return 0;
+
+   return device-config.dwt-is_enabled(device);
+}
+
+LIBINPUT_EXPORT void
+libinput_device_config_disable_while_typing_reset(struct libinput_device 
*device)
+{
+   if (device-config.dwt)
+   device-config.dwt-reset(device);
+}
diff --git a/src/libinput.h b/src/libinput.h
index 1b6207c..62d0c0f 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -1657,6 +1657,62 @@ libinput_device_config_accel_get_precision(struct 
libinput_device *device);
 void
 libinput_device_config_accel_reset(struct libinput_device *device);
 
+/**
+ * @ingroup config
+ *
+ * Check if this device supports a disable-while-typing feature. This
+ * feature is usually available on built-in touchpads where hand placement
+ * may cause erroneous events on the touchpad while typing.
+ *
+ * This feature is available on the device that is being disabled (i.e. the
+ * touchpad), not on the device causing the device to be disabled. Which
+ * devices trigger this feature is implementation-dependent.
+ *
+ * @param device The device to configure
+ * @return non-zero if disable while typing is available for this device
+ */
+int
+libinput_device_config_disable_while_typing_is_available(struct 
libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Enable or disable the disable-while-typing feature. When enabled, the
+ * device will not send events while and shortly after another device
+ * generates events.
+ *
+ * @param device The device to configure
+ * @param enable 0 to disable, 1 to enable
+ *
+ * @return 0 on success or a negative errno on failure
+ * @retval A config status code
+ */
+enum libinput_config_status
+libinput_device_config_disable_while_typing_enable(struct libinput_device 
*device,
+  int enable);
+
+/**
+ * @ingroup config
+ *
+ * Check if the feature is currently enabled.
+ *
+ * @param device The device to configure
+ *
+ * @return 0 if the feature is disabled, non-zero if the feature is enabled
+ */
+int
+libinput_device_config_disable_while_typing_is_enabled(struct libinput_device 
*device);
+
+/**
+ * @ingroup config
+ *
+ * Reset to the default settings.
+ *
+ * @param device The device to configure
+ */
+void
+libinput_device_config_disable_while_typing_reset(struct libinput_device 
*device);
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.9.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel