Re: Wayland Virtual Keyboard

2017-05-17 Thread Silvan Jegen
Hi

On Wed, May 17, 2017 at 9:49 PM, Joshua Watt  wrote:
> I'm working on an embedded device where we are writing our own custom
> Wayland compositor, and we have need of a virtual keyboard (something
> implementing one of the text-input protocols). Does anyone know of
> such a project? My searches turned up maliit
> (https://github.com/maliit), but I was wondering if anyone knew of
> other options we could investigate?

You may already be aware of it but there is a very basic virtual
keyboard already included in the Weston project:

https://cgit.freedesktop.org/wayland/weston/tree/clients/keyboard.c

Maybe this could serve as an example at least.

Other than the maliit project I am not sure there exists one.
SailfishOS seems to be using the maliit project for their
implementation of a virtual keyboard. I am not sure their
implementation is Open Source though.


Cheers,

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


Re: [PATCH libinput] touchpad: fix clickfinger behavior with a thumb being present

2017-05-17 Thread Peter Hutterer
Hi Friedrich,

On Tue, May 16, 2017 at 10:44:22PM +0200, Friedrich Schöller wrote:
> With a thumb on the touchpad, a two-finger click was incorrectly
> treated as a middle-click. This patch takes the thumb into account and
> treats the click as a right-click.

fwiw, this was intentional behaviour, introduced in 316f30d2f28b62 with the
comment:
  It's reasonable to expect a thumb (or the other hand's index finger) to click
  a button while a finger is down for movement. It's less reasonable to expect
  this when two fingers are interacting with the touchpad, or when two fingers
  click the touchpad (even on a large touchpad that's an awkward position).

The problem is that while a index down + thumb is always [1] a one-finger
click, it's not as well defined for two fingers down. But that doesn't
matter, I'm happy to change that behaviour if we can detect the position
correctly. The patch works, but it'll need a change please:
on a touchpad with num_slots 2 the third finger position is based on the
finger position of the first two fingers (see tp_position_fake_touches() or
so).

with the patch applied, *when* the thumb is put down now matters:
if the thumb is the first or second finger, a two-finger + thumb
click is BTN_RIGHT, if the thumb is the third finger, a two-finger + thumb
click is BTN_MIDDLE. That's inconsistent, so we need an extra for num_slots
so this behaviour only gets enabled for devices that can reliably track 3 
fingers.

Thanks

Cheers,
   Peter

[1] fsvo 'always'

> ---
>  src/evdev-mt-touchpad-buttons.c | 44 
> ++---
>  1 file changed, 19 insertions(+), 25 deletions(-)
> 
> diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
> index 895cf0e..ffb6a58 100644
> --- a/src/evdev-mt-touchpad-buttons.c
> +++ b/src/evdev-mt-touchpad-buttons.c
> @@ -981,23 +981,24 @@ out:
>  static uint32_t
>  tp_clickfinger_set_button(struct tp_dispatch *tp)
>  {
> - uint32_t button;
> + bool thumb_detected = false;
>   unsigned int nfingers = tp->nfingers_down;
>   struct tp_touch *t;
>   struct tp_touch *first = NULL,
>   *second = NULL;
>  
> - if (nfingers != 2)
> - goto out;
> + if (nfingers < 2)
> + return BTN_LEFT;
>  
> - /* two fingers down on the touchpad. Check for distance
> -  * between the fingers. */
>   tp_for_each_touch(tp, t) {
>   if (t->state != TOUCH_BEGIN && t->state != TOUCH_UPDATE)
>   continue;
>  
> - if (t->thumb.state == THUMB_STATE_YES)
> + if (t->thumb.state == THUMB_STATE_YES) {
> + thumb_detected = true;
> + nfingers--;
>   continue;
> + }
>  
>   if (!first)
>   first = t;
> @@ -1005,27 +1006,20 @@ tp_clickfinger_set_button(struct tp_dispatch *tp)
>   second = t;
>   }
>  
> - if (!first || !second) {
> - nfingers = 1;
> - goto out;
> - }
> + if (nfingers < 2)
> + return BTN_LEFT;
> + else if (nfingers > 2)
> + return BTN_MIDDLE;
>  
> - if (tp_clickfinger_within_distance(tp, first, second))
> - nfingers = 2;
> + /* Two fingers (not counting thumbs) are on the touchpad. If no
> +  * additional thumb was detected, we check the distance between the
> +  * touches. Some touchpads can not report more than two finger positions
> +  * so we do not check the distance if an additional thumb was detected.
> +  */
> + if (thumb_detected || tp_clickfinger_within_distance(tp, first, second))
> + return BTN_RIGHT;
>   else
> - nfingers = 1;
> -
> -out:
> - switch (nfingers) {
> - case 0:
> - case 1: button = BTN_LEFT; break;
> - case 2: button = BTN_RIGHT; break;
> - default:
> - button = BTN_MIDDLE; break;
> - break;
> - }
> -
> - return button;
> + return BTN_LEFT;
>  }
>  
>  static int
> -- 
> 2.9.4
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput] meson: define the various files litest needs to copy rules/hwdb in place

2017-05-17 Thread Peter Hutterer
This was motivated by the need to run the test runner from any directory, so
we need absolute paths to the files we copy.

Unfortunately, we can't get the absolute path from the object returned by
configure_file() and we can't feed that directly into join_paths() either.
So let' make it at least easier to handle: create a configure_file for all the
files we need (so they all end up in builddir/) and simply hardcode the name
for join_paths. Define the lot in config.h, no need to pass compiler flags
around.

Signed-off-by: Peter Hutterer 
---
 meson.build | 33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/meson.build b/meson.build
index e1ea40cb..1c2ee54a 100644
--- a/meson.build
+++ b/meson.build
@@ -87,8 +87,6 @@ executable('libinput-model-quirks',
   install_dir : udev_dir)
 
 model_quirks = files('udev/90-libinput-model-quirks.hwdb')
-install_data(model_quirks,
-install_dir : udev_hwdb_dir)
 
 parse_hwdb_py = find_program('udev/parse_hwdb.py')
 test('parse-hwdb',
@@ -107,6 +105,11 @@ configure_file(input : 
'udev/90-libinput-model-quirks.rules.in',
   install : true,
   install_dir : udev_rules_dir,
   configuration : udev_rules_config)
+configure_file(input : model_quirks,
+  output : '90-libinput-model-quirks.hwdb',
+  install : true,
+  install_dir : udev_hwdb_dir,
+  configuration : udev_rules_config)
 
 litest_udev_rules_config = configuration_data()
 litest_udev_rules_config.set('UDEV_TEST_PATH', meson.build_root() + '/')
@@ -490,20 +493,24 @@ if get_option('enable-tests')
dep_dl,
dep_lm
]
-   def_quirks_rules_file = 
'-DLIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE="@0@"'.format(litest_model_quirks_file)
-   def_quirks_hwdb_file = 
'-DLIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE="@0@/udev/90-libinput-model-quirks.hwdb"'.format(meson.source_root())
-   def_test_rules_file = 
'-DLIBINPUT_TEST_DEVICE_RULES_FILE="@0@/udev/80-libinput-test-device.rules"'.format(meson.source_root())
-   def_device_groups_file = 
'-DLIBINPUT_DEVICE_GROUPS_RULES_FILE="@0@"'.format(litest_groups_rules_file)
-   defs_litest = [def_quirks_rules_file,
-  def_quirks_hwdb_file,
-  def_test_rules_file,
-  def_device_groups_file]
 
+   configure_file(input : 'udev/80-libinput-test-device.rules',
+  output : '80-libinput-test-device.rules',
+  install : false,
+  configuration : udev_rules_config)
+
+   config_h.set_quoted('LIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE',
+   join_paths(meson.build_root(), 
'90-libinput-model-quirks.rules'))
+   config_h.set_quoted('LIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE',
+   join_paths(meson.build_root(), 
'90-libinput-model-quirks.hwdb'))
+   config_h.set_quoted('LIBINPUT_TEST_DEVICE_RULES_FILE',
+   join_paths(meson.build_root(), 
'80-libinput-test-device.rules'))
+   config_h.set_quoted('LIBINPUT_DEVICE_GROUPS_RULES_FILE',
+   join_paths(meson.build_root(), 
'80-libinput-device-groups.rules'))
lib_litest = static_library('litest',
lib_litest_sources,
include_directories : 
include_directories('src'),
-   dependencies : deps_litest,
-   c_args : defs_litest)
+   dependencies : deps_litest)
dep_litest = declare_dependency(link_with : lib_litest,
dependencies : deps_litest)
 
@@ -512,7 +519,7 @@ if get_option('enable-tests')
defs_litest_selftest = [
def_no_main,
def_disable_backtrace
-   ] + defs_litest
+   ]
test_litest_selftest_sources = [
'test/litest-selftest.c',
'test/litest.c',
-- 
2.13.0

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


Re: [PATCH libinput 4/4] tools: hook libinput-debug-events into the libinput tool

2017-05-17 Thread Peter Hutterer
On Wed, May 17, 2017 at 04:35:29PM +0100, Eric Engestrom wrote:
> On Wednesday, 2017-05-17 09:02:32 +1000, Peter Hutterer wrote:
> > Signed-off-by: Peter Hutterer 
> > ---
> >  meson.build   |  7 +++--
> >  tools/Makefile.am |  8 --
> >  tools/libinput-debug-events.c | 15 +--
> >  tools/libinput-tool.c |  8 ++
> >  tools/libinput-tool.h |  1 +
> >  tools/libinput.1  | 60 
> > ++-
> >  tools/shared.c| 36 ++
> >  tools/shared.h|  5 ++--
> >  8 files changed, 121 insertions(+), 19 deletions(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 090536b5..1606401c 100644
> > --- a/meson.build
> > +++ b/meson.build
> [snip]
> > @@ -360,11 +362,12 @@ executable('libinput-list-devices',
> >libinput_list_devices_sources,
> >dependencies : [ dep_libinput ],
> >include_directories : include_directories('src'),
> > -  c_args : [ '-DTOOLS_BUILD_STANDALONE=1' ]
> > +  c_args : [ '-DTOOLS_BUILD_STANDALONE=1' ],
> >install : true,
> >)
> 
> This hunk is a fix for a bug introduced in patch #3; squash?

ah, well spotted. squashed locally, thanks.

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


Re: libinput: Thumb detection based on ABS_MT_WIDTH

2017-05-17 Thread Peter Hutterer
On Wed, May 17, 2017 at 11:22:51PM +0200, Friedrich Schöller wrote:
> Dear all, dear Peter,
> 
> As you know, bcm5974 touchpads do not report ABS_MT_PRESSURE, but
> ABS_MT_WIDTH instead. Since libinput does not currently use ABS_MT_WIDTH,
> thumb detection is inaccurate on those devices. When I switched from Mac OS
> to Linux, I stopped using the Magic Trackpad solely for that reason. Now I
> decided it would be time to get my favorite pointing device back. To do
> this, I would like to implement thumb detection based on ABS_MT_WIDTH. Using
> these values has the additional benefit of making thumb detection
> significantly more reliable, since the eccentricity of a thumb can be
> deduced, which is typically much larger than that of a finger.
> 
> Now I am wondering if this would be a welcome addition to libinput. When
> looking through the mailing list I found the patch "touchpad: add touch-size
> based touch handling". This would probably be a good basis to build on. Are
> you still considering committing the patch to git?

tbh, I think ABS_MT_WIDTH is the wrong approach here, at least for the bcms.
I think if you start from that patch series that adds major/minor handling
and get it to work properly, that's the way to go. It'll be apple-only for a
while, so far everything else I've seen so far on these axes is inconsistent
but at least for the bcm5974 it should work - especially given that the
kernel axis was added for those devices..

but yeah, if you want to finish this patchset and get it to work properly,
I'll merge it. I've rebased it to master so it compiles but I haven't tested
it. Available from here, do with it what you think is appropriate :)

https://github.com/whot/libinput/tree/wip/touchpad-apple-touch-major

if you find you cant fix it with major/minor alone and need width as extra
bit of information, that's fine too of course.

Cheers,
   Peter

> 
> Thanks for all your great work.
> 
> Best,
> 
> Friedrich
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


libinput: Thumb detection based on ABS_MT_WIDTH

2017-05-17 Thread Friedrich Schöller

Dear all, dear Peter,

As you know, bcm5974 touchpads do not report ABS_MT_PRESSURE, but ABS_MT_WIDTH 
instead. Since libinput does not currently use ABS_MT_WIDTH, thumb detection is 
inaccurate on those devices. When I switched from Mac OS to Linux, I stopped 
using the Magic Trackpad solely for that reason. Now I decided it would be time 
to get my favorite pointing device back. To do this, I would like to implement 
thumb detection based on ABS_MT_WIDTH. Using these values has the additional 
benefit of making thumb detection significantly more reliable, since the 
eccentricity of a thumb can be deduced, which is typically much larger than that 
of a finger.


Now I am wondering if this would be a welcome addition to libinput. When looking 
through the mailing list I found the patch "touchpad: add touch-size based touch 
handling". This would probably be a good basis to build on. Are you still 
considering committing the patch to git?


Thanks for all your great work.

Best,

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


Re: Wayland Virtual Keyboard

2017-05-17 Thread Joshua Watt
> I'm working on an embedded device where we are writing our own custom
> Wayland compositor, and we have need of a virtual keyboard (something
> implementing one of the text-input protocols). Does anyone know of
> such a project? My searches turned up maliit
> (https://github.com/maliit), but I was wondering if anyone knew of
> other options we could investigate?

Ping?
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH libinput 4/4] tools: hook libinput-debug-events into the libinput tool

2017-05-17 Thread Eric Engestrom
On Wednesday, 2017-05-17 09:02:32 +1000, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer 
> ---
>  meson.build   |  7 +++--
>  tools/Makefile.am |  8 --
>  tools/libinput-debug-events.c | 15 +--
>  tools/libinput-tool.c |  8 ++
>  tools/libinput-tool.h |  1 +
>  tools/libinput.1  | 60 
> ++-
>  tools/shared.c| 36 ++
>  tools/shared.h|  5 ++--
>  8 files changed, 121 insertions(+), 19 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 090536b5..1606401c 100644
> --- a/meson.build
> +++ b/meson.build
[snip]
> @@ -360,11 +362,12 @@ executable('libinput-list-devices',
>  libinput_list_devices_sources,
>  dependencies : [ dep_libinput ],
>  include_directories : include_directories('src'),
> -c_args : [ '-DTOOLS_BUILD_STANDALONE=1' ]
> +c_args : [ '-DTOOLS_BUILD_STANDALONE=1' ],
>  install : true,
>  )

This hunk is a fix for a bug introduced in patch #3; squash?
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel