Re: [PATCH wayland-protocols] Add action binder protocol

2018-04-08 Thread Peter Hutterer
Hey, look, almost year later and I found this email. In my defence, I was on
an airplane at the time, hence I missed this :)

This came up in #wayland where pekka linked to it, so I figured I might as
well look through it.

On Wed, Aug 16, 2017 at 09:19:06PM +0200, Quentin Glidic wrote:
> From: Quentin Glidic 
> 
> Signed-off-by: Quentin Glidic 
> ---
> 
> As for one-off vs. sustained actions, alternative wording was suggested:
> - one-shot vs. sustained
> - instantaneous vs. sustained
> - immediate vs. driven
> - triggered vs. initiated
> 
>  unstable/action-binder/README  |   4 +
>  .../action-binder/action-binder-unstable-v1.xml| 121 
> +
>  2 files changed, 125 insertions(+)
>  create mode 100644 unstable/action-binder/README
>  create mode 100644 unstable/action-binder/action-binder-unstable-v1.xml
> 
> diff --git a/unstable/action-binder/README b/unstable/action-binder/README
> new file mode 100644
> index 000..07fe7d4
> --- /dev/null
> +++ b/unstable/action-binder/README
> @@ -0,0 +1,4 @@
> +action binder protocol
> +
> +Maintainers:
> +Quentin Glidic 
> diff --git a/unstable/action-binder/action-binder-unstable-v1.xml 
> b/unstable/action-binder/action-binder-unstable-v1.xml
> new file mode 100644
> index 000..a0e086b
> --- /dev/null
> +++ b/unstable/action-binder/action-binder-unstable-v1.xml
> @@ -0,0 +1,121 @@
> +
> +
> +
> +  
> +Copyright © 2015-2017 Quentin “Sardem FF7” Glidic
> +
> +Permission to use, copy, modify, distribute, and sell this
> +software and its documentation for any purpose is hereby granted
> +without fee, provided that the above copyright notice appear in
> +all copies and that both that copyright notice and this permission
> +notice appear in supporting documentation, and that the name of
> +the copyright holders not be used in advertising or publicity
> +pertaining to distribution of the software without specific,
> +written prior permission. The copyright holders make no
> +representations about the suitability of this software for any
> +purpose. It is provided "as is" without express or implied
> +warranty.
> +
> +THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
> +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
> +FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
> +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
> +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
> +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
> +THIS SOFTWARE.
> +  
> +
> +  
> +
> +  This interface is designed to allow any application to bind
> +  an action.
> +
> +  An action is an arbitrary couple of a namespace and a name describing 
> the
> +  wanted behaviour. These two strings are not meant to be user-visible.
> +  Some namespaces are well-known and shared by applications while each
> +  application can have its own namespaces for internal actions.
> +  It is possible to have the same action in several namespaces, e.g. to
> +  allow application-specific bindings in addition to global actions.

I may have missed some conversation there but without examples it's a bit
hard to understand  how the namespace and name separation is supposed to
work. Something like "generic" and "copy" maybe? Or "gimp", "tool:eraser"?
Can you expand on that?

> +
> +  It is left to the compositor to determine which client will get events.
> +  The choice can be based on policy, heuristic, user configuration, or 
> any
> +  other mechanism that may be relevant.
> +  Here are some examples of dispatching choice: all applications, last
> +  focused, user-defined preference order, latest fullscreened 
> application.
> +
> +  This object is a singleton global.
> +
> +
> +
> +  
> + Informs the server that the client will not be using this protocol
> + object anymore. You must destroy any wp_action_binding created from the
> + wp_action_binder before.
> +  
> +
> +
> +
> +  
> + Creates a binding object. It will be used by the application to bind
> + one or more actions and get the corresponding events.
> +  
> +
> +   +   summary="the new binding interface id" />
> +
> +  
> +
> +  
> +
> +  This interface represents a binding to a set of actions.
> +
> +  Depending on the user configuration, an action can be either one-off or
> +  sustained. The client must handle all the three events and either make
> +  sense of them or ignore them properly.
> +
> +
> +
> +   + summary="the action is reserved by the compositor" />
> +
> +
> +
> +  
> + The client no longer wants to receive events for these actions.
> +  
> +
> +
> +
> +  
> + 

[ANNOUNCE] libinput 1.10.4

2018-04-08 Thread Peter Hutterer
libinput 1.10.4 is now available. Biggest user-noticeable change is that the
hysteresis threshold is significantly reduced to 0.25 of a mm now or to the
kernel fuzz value where present. This should make touchpads a bit more
snappy.

Two fixes for touchpad touch handling, one affecting semi-mt devices with
hovering capability and one affecting the Apple touchpads where a touch can
get erroneously detected as as exceeding the speed thesholds.

The rest - documentation and tool fixes. Nandor's fix fixes a race condition
in the test suite, given my delight of having it reliably pass now
every time I couldn't not take it into the 1.10.4 release.

As usual, the git shortlog is below.

Nandor Han (1):
  udev: validate input devices during cold-plug

Peter Hutterer (8):
  touchpad: only keep low-pressure fingers alive for 2+-slot touchpads
  tools: fix man page for debug-events
  touchpad: don't enable top palm detection on touchpads <= 55mm high
  tools: touchpad-pressure: init the lo/hi values correctly
  touchpad: use the fuzz value (if any) for the hysteresis margin
  Fix a doxygen link for the get_default_matrix call
  touchpad: don't process state for a touch in TOUCH_NONE
  libinput 1.10.4

git tag: 1.10.4

https://www.freedesktop.org/software/libinput/libinput-1.10.4.tar.xz
MD5:  4f48ea484b3b4a099894d49e59ba8ce7  libinput-1.10.4.tar.xz
SHA1: 7decdbad48796ca9c786eaa610b0c1c48671e623  libinput-1.10.4.tar.xz
SHA256: 2330a82f3e4b617a4f9ff0f2bf9cc217b3c4e69d767e61ca59ca07add61f68ac  
libinput-1.10.4.tar.xz
SHA512: 
b6f24f135e2396d53c0576a3b3887cd3736f2209fc448c6419cd1f1d7ee6aedff8e067f4b780f50ada5a4418d5bc47a4010cb328f366ee7fd1a2dba1ffc96c38
  libinput-1.10.4.tar.xz
PGP:  https://www.freedesktop.org/software/libinput/libinput-1.10.4.tar.xz.sig



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


Re: [PATCH weston 20/25] input: introduce touch event mode for calibrator

2018-04-08 Thread Peter Hutterer
On Fri, Mar 23, 2018 at 02:01:00PM +0200, Pekka Paalanen wrote:
> From: Louis-Francis Ratté-Boulianne 
> 
> In addition to the normal touch event processing mode, introduce a new
> mode for calibrating a touchscreen input device.
> 
> In the calibration mode, normal touch event processing is skipped, and
> the raw events are forwarded to the calibrator instead. The calibrator
> is not yet implemented, so the calls will be added in a following patch.
> 
> To switch between modes, two functions are added, one for entering each
> mode. The mode switch happens only when no touches are down on any touch
> device, to avoid confusing touch grabs and clients. To realise this, the
> state machine has four states: prepare and actual state for both normal
> and calibrator modes.
> 
> At this point nothing will attempt to change the touch event mode.
> 
> The new calibrator mode is necessary, because when calibrating a
> touchscreen, the touch events must be routed to the calibration client
> directly. The touch coordinates are expected to be wrong, so they cannot
> go through the normal focus surface picking. The calibrator code also
> cannot use the normal touch grab interface, because it needs to be able
> to distinguish between different physical touch input devices, even if
> they are part of the same weston_seat. This requirement makes
> calibration special enough to warrant the new mode, a sort of "super
> grab".
> 
> Co-developed by Louis-Francis and Pekka.
> 
> Signed-off-by: Louis-Francis Ratté-Boulianne 
> Signed-off-by: Pekka Paalanen 

series 13-20 Reviewed-by: Peter Hutterer , pls see
my comments in the emails though.

Cheers,
   Peter

> ---
>  libweston/compositor.c |   2 +
>  libweston/compositor.h |  39 +
>  libweston/input.c  | 146 
> +++--
>  3 files changed, 182 insertions(+), 5 deletions(-)
> 
> diff --git a/libweston/compositor.c b/libweston/compositor.c
> index 8452c5d2..d7922799 100644
> --- a/libweston/compositor.c
> +++ b/libweston/compositor.c
> @@ -6289,6 +6289,8 @@ weston_compositor_create(struct wl_display *display, 
> void *user_data)
>  
>   ec->activate_serial = 1;
>  
> + ec->touch_mode = WESTON_TOUCH_MODE_NORMAL;
> +
>   if (!wl_global_create(ec->wl_display, &wl_compositor_interface, 4,
> ec, compositor_bind))
>   goto fail;
> diff --git a/libweston/compositor.h b/libweston/compositor.h
> index 129e15b8..48a9af55 100644
> --- a/libweston/compositor.h
> +++ b/libweston/compositor.h
> @@ -482,6 +482,34 @@ struct weston_touch_device_ops {
>   const struct weston_touch_device_matrix 
> *matrix);
>  };
>  
> +enum weston_touch_mode {
> + /** Normal touch event handling */
> + WESTON_TOUCH_MODE_NORMAL,
> +
> + /** Prepare moving to WESTON_TOUCH_MODE_CALIB.
> +  *
> +  * Move to WESTON_TOUCH_MODE_CALIB as soon as no touches are down on
> +  * any seat. Until then, all touch events are routed normally.
> +  */
> + WESTON_TOUCH_MODE_PREP_CALIB,
> +
> + /** Calibration mode
> +  *
> +  * Only a single weston_touch_device forwards events to the calibrator
> +  * all other touch device cause a calibrator "wrong device" event to
> +  * be sent.
> +  */
> + WESTON_TOUCH_MODE_CALIB,
> +
> + /** Prepare moving to WESTON_TOUCH_MODE_NORMAL.
> +  *
> +  * Move to WESTON_TOUCH_MODE_NORMAL as soon as no touches are down on
> +  * any seat. Until then, touch events are routed as in
> +  * WESTON_TOUCH_MODE_CALIB except "wrong device" events are not sent.
> +  */
> + WESTON_TOUCH_MODE_PREP_NORMAL
> +};
> +
>  /** Represents a physical touchscreen input device */
>  struct weston_touch_device {
>   char *devpath;  /**< unique name */
> @@ -1080,6 +1108,8 @@ struct weston_compositor {
>  
>   weston_heads_changed_func_t heads_changed;
>   struct wl_event_source *heads_changed_source;
> +
> + enum weston_touch_mode touch_mode;
>  };
>  
>  struct weston_buffer {
> @@ -1560,6 +1590,15 @@ notify_touch_frame(struct weston_touch_device *device);
>  void
>  notify_touch_cancel(struct weston_touch_device *device);
>  
> +void
> +weston_compositor_set_touch_mode_normal(struct weston_compositor 
> *compositor);
> +
> +void
> +weston_compositor_set_touch_mode_calib(struct weston_compositor *compositor);
> +
> +static inline void
> +touch_calibrator_mode_changed(struct weston_compositor *compositor) { /* 
> stub */ }
> +
>  void
>  weston_layer_entry_insert(struct weston_layer_entry *list,
> struct weston_layer_entry *entry);
> diff --git a/libweston/input.c b/libweston/input.c
> index 7e4677e6..4a82203c 100644
> --- a/libweston/input.c
> +++ b/libweston/input.c
> @@ -185,6 +185,12 @@ weston_touch_device_can_calibrate(struct 
> weston_touch_device *device)
>   return !!device->ops;
>  }
>  
> +static enum weston_touch_mode
> +weston_to

Re: [PATCH weston 21/25] protocol: add weston_touch_calibration

2018-04-08 Thread Peter Hutterer
On Fri, Mar 23, 2018 at 02:01:01PM +0200, Pekka Paalanen wrote:
> From: Pekka Paalanen 
> 
> This is a Wayland protocol extension to allow the calibration of
> touchscreens in Weston.
> 
> See: https://phabricator.freedesktop.org/T7868
> 
> Signed-off-by: Pekka Paalanen 
> ---
>  Makefile.am   |   5 +-
>  protocol/weston-touch-calibration.xml | 320 
> ++
>  2 files changed, 324 insertions(+), 1 deletion(-)
>  create mode 100644 protocol/weston-touch-calibration.xml
> 
> diff --git a/Makefile.am b/Makefile.am
> index e028a2a1..5e830777 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -168,7 +168,9 @@ nodist_libweston_@LIBWESTON_MAJOR@_la_SOURCES =   
> \
>   protocol/pointer-constraints-unstable-v1-protocol.c \
>   protocol/pointer-constraints-unstable-v1-server-protocol.h  \
>   protocol/input-timestamps-unstable-v1-protocol.c\
> - protocol/input-timestamps-unstable-v1-server-protocol.h
> + protocol/input-timestamps-unstable-v1-server-protocol.h \
> + protocol/weston-touch-calibration-protocol.c\
> + protocol/weston-touch-calibration-server-protocol.h
>  
>  BUILT_SOURCES += $(nodist_libweston_@LIBWESTON_MAJOR@_la_SOURCES)
>  
> @@ -1534,6 +1536,7 @@ EXTRA_DIST +=   \
>   protocol/weston-screenshooter.xml   \
>   protocol/text-cursor-position.xml   \
>   protocol/weston-test.xml\
> + protocol/weston-touch-calibration.xml   \
>   protocol/ivi-application.xml\
>   protocol/ivi-hmi-controller.xml
>  
> diff --git a/protocol/weston-touch-calibration.xml 
> b/protocol/weston-touch-calibration.xml
> new file mode 100644
> index ..b1e19f9b
> --- /dev/null
> +++ b/protocol/weston-touch-calibration.xml
> @@ -0,0 +1,320 @@
> +
> +
> +
> +  
> +Copyright © 2017 Collabora, Ltd.
> +Copyright © 2017 General Electric Company
> +
> +Permission is hereby granted, free of charge, to any person obtaining a
> +copy of this software and associated documentation files (the 
> "Software"),
> +to deal in the Software without restriction, including without limitation
> +the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +and/or sell copies of the Software, and to permit persons to whom the
> +Software is furnished to do so, subject to the following conditions:
> +
> +The above copyright notice and this permission notice (including the next
> +paragraph) shall be included in all copies or substantial portions of the
> +Software.
> +
> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
> OR
> +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 
> OTHER
> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> +DEALINGS IN THE SOFTWARE.
> +  
> +
> +  
> +
> +  This is the global interface for calibrating a touchscreen input
> +  coordinate transformation. It is recommended to make this interface
> +  privileged.
> +
> +  This interface can be used by a client to show a calibration pattern 
> and
> +  receive uncalibrated touch coordinates, facilitating the computation of
> +  a calibration transformation that will align actual touch positions
> +  on screen with their expected coordinates.
> +
> +  Immediately after being bound by a client, the server sends the
> +  touch_device events.

s/server/compositor/, in a few more places

> +
> +  The client chooses a touch device from the touch_device events,
> +  creates a wl_surface and then a weston_touch_calibrator for the
> +  wl_surface and the chosen touch device. The client waits for the server
> +  to send a configure event before it starts drawing the first 
> calibration
> +  pattern. After receiving the configure event, the client will iterate
> +  drawing a pattern, getting touch input via weston_touch_calibrator,
> +  and converting pixel coordinates to expected touch coordinates with
> +  weston_touch_calibrator.convert until it has enough correspondences to
> +  compute the calibration transformation or the server cancels the
> +  calibration.
> +
> +  Once the client has successfully computed a new calibration, it can use
> +  weston_touch_calibration.save request to load the new calibration into
> +  the server. The server may take this new calibration into use and may
> +  write it into persistent storage.
> +
> +
> +
> +  
> +   + summary="the given wl_surface already has a role"/>
> +   + summa

Re: [PATCH weston 16/25] libweston: introduce notify_touch_cal() and doc

2018-04-08 Thread Peter Hutterer
On Fri, Mar 23, 2018 at 02:00:56PM +0200, Pekka Paalanen wrote:
> From: Pekka Paalanen 
> 
> notify_touch_cal() is an extended form of notify_touch(), adding
> normalized touch coordinates which are necessary for calibrating a
> touchscreen.
> 
> It would be possible to invert the transformation and convert from
> global coordinates to normalized device coordinates in input.c without
> adding this API, but this way it is more robust against code changes.
> 
> Recovering normalized device coordinates is necessary because libinput
> calibration matrix must be given in normalized units, and it would be
> difficult to compute otherwise. Libinput API does not offer normalized
> coordinates directly either, but those can be fetched by pretending the
> output resolution is 1x1.
> 
> Anticipating touch calibration mode, the old notify_touch() is renamed
> into a private process_touch_normal(), and the new notify_touch_cal()
> delegates to it.
> 
> Co-developed by Louis-Francis and Pekka.
> 
> Cc: Louis-Francis Ratté-Boulianne 
> Signed-off-by: Pekka Paalanen 
> ---
>  libweston/compositor.h  | 21 +++-
>  libweston/input.c   | 60 
> -
>  libweston/libinput-device.c | 11 -
>  3 files changed, 79 insertions(+), 13 deletions(-)
> 
> diff --git a/libweston/compositor.h b/libweston/compositor.h
> index b992b7eb..a1264e5a 100644
> --- a/libweston/compositor.h
> +++ b/libweston/compositor.h
> @@ -1532,9 +1532,28 @@ notify_keyboard_focus_in(struct weston_seat *seat, 
> struct wl_array *keys,
>  void
>  notify_keyboard_focus_out(struct weston_seat *seat);
>  
> +/* an arbitrary unlikely value */
> +#define WESTON_INVALID_TOUCH_COORDINATE ((double)777e+7)
> +
>  void
> +notify_touch_cal(struct weston_touch_device *device,
> +  const struct timespec *time, int touch_id,
> +  double x, double y,
> +  double norm_x, double norm_y, int touch_type);
> +
> +/** Feed in touch down, motion, and up events, non-calibratable device.
> + *
> + * @sa notify_touch_cal
> + */
> +static inline void
>  notify_touch(struct weston_touch_device *device, const struct timespec *time,
> -  int touch_id, double x, double y, int touch_type);
> +  int touch_id, double x, double y, int touch_type)
> +{
> + notify_touch_cal(device, time, touch_id, x, y,
> +  WESTON_INVALID_TOUCH_COORDINATE,
> +  WESTON_INVALID_TOUCH_COORDINATE, touch_type);
> +}
> +
>  void
>  notify_touch_frame(struct weston_touch_device *device);
>  
> diff --git a/libweston/input.c b/libweston/input.c
> index bd7a9167..1658422c 100644
> --- a/libweston/input.c
> +++ b/libweston/input.c
> @@ -2336,17 +2336,10 @@ weston_touch_set_focus(struct weston_touch *touch, 
> struct weston_view *view)
>   touch->focus = view;
>  }
>  
> -/**
> - * notify_touch - emulates button touches and notifies surfaces accordingly.
> - *
> - * It assumes always the correct cycle sequence until it gets here: 
> touch_down
> - * → touch_update → ... → touch_update → touch_end. The driver is responsible
> - * for sending along such order.
> - *
> - */
> -WL_EXPORT void
> -notify_touch(struct weston_touch_device *device, const struct timespec *time,
> -  int touch_id, double double_x, double double_y, int touch_type)
> +static void
> +process_touch_normal(struct weston_touch_device *device,
> +  const struct timespec *time, int touch_id,
> +  double double_x, double double_y, int touch_type)

IMO just process_touch() is better, otherwise it's more confusing ("wait?
why is this normal? and what's not normal? or is this an abbreviation of
normalized?")

>  {
>   struct weston_touch *touch = device->aggregate;
>   struct weston_touch_grab *grab = device->aggregate->grab;
> @@ -2423,6 +2416,51 @@ notify_touch(struct weston_touch_device *device, const 
> struct timespec *time,
>   }
>  }
>  
> +/** Feed in touch down, motion, and up events, calibratable device.
> + *
> + * It assumes always the correct cycle sequence until it gets here: 
> touch_down
> + * → touch_update → ... → touch_update → touch_end. The driver is responsible
> + * for sending along such order.
> + *
> + * \param device The physical device that generated the event.
> + * \param time The event timestamp.
> + * \param touch_id ID for the touch point of this event (multi-touch).
> + * \param double_x X coordinate in compositor global space.
> + * \param double_y Y coordinate in compositor global space.
> + * \param norm_x Normalized device X coordinate in calibration space.
> + * \param norm_y Normalized device Y coordinate in calibration space.
> + * \param touch_type Either WL_TOUCH_DOWN, WL_TOUCH_UP, or WL_TOUCH_MOTION.
> + *
> + * Coordinates double_x and double_y are used for normal operation.
> + *
> + * Coordinates norm_x and norm_y are only used for touch device calibration.
> + * If and only if the weston_touch_dev

Re: [PATCH weston 12/25] input: introduce weston_touch_device

2018-04-08 Thread Peter Hutterer
On Fri, Mar 23, 2018 at 02:00:52PM +0200, Pekka Paalanen wrote:
> From: Louis-Francis Ratté-Boulianne 
> 
> Introduce weston_touch_device for libweston core to track individual
> touchscreen input devices. A weston_seat/weston_touch may be an
> aggregation of several physical touchscreen input devices. Separating
> the physical devices will be required for implementing touchscreen
> calibration. One can only calibrate one device at a time, and we want to
> make sure to handle the right one.
> 
> Both backends that support touch devices are updated to create
> weston_touch_devices. Wayland-backend provides touch devices that cannot
> be calibrated, because we have no access to raw touch coordinates from
> the device - calibration is the responsibility of the parent display
> server. Libinput backend provides touch devices that can be calibrated,
> hence implementing the set and get calibration hooks.
> 
> Backends need to maintain an output pointer in any case, so we have a
> get_output() hook instead of having to maintain an identical field in
> weston_touch_device. The same justification applies to
> get_calibration_head_name.
> 
> Also update the test plugin to manage weston_touch_device objects.
> 
> Co-developed by Louis-Francis and Pekka.

just a little nit: you're going to make the world an every so slightly
angrier place by choosing "calb" instead of "calib" or "cal" as shortcut for
"calibration" :)

I predict that almost everyone working on that code will mistype that the
first few times around.

Cheers,
   Peter

> 
> Signed-off-by: Louis-Francis Ratté-Boulianne 
> Signed-off-by: Pekka Paalanen 
> ---
>  libweston/compositor-wayland.c |  21 
>  libweston/compositor.h |  56 
>  libweston/input.c  |  65 +++
>  libweston/libinput-device.c| 116 
> -
>  libweston/libinput-device.h|   3 ++
>  tests/weston-test.c|  38 ++
>  6 files changed, 298 insertions(+), 1 deletion(-)
> 
> diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
> index f186681c..9d5b3551 100644
> --- a/libweston/compositor-wayland.c
> +++ b/libweston/compositor-wayland.c
> @@ -198,6 +198,8 @@ struct wayland_input {
>   } cursor;
>   } parent;
>  
> + struct weston_touch_device *touch_device;
> +
>   enum weston_key_state_update keyboard_state_update;
>   uint32_t key_serial;
>   uint32_t enter_serial;
> @@ -2246,6 +2248,22 @@ static const struct wl_touch_listener touch_listener = 
> {
>  };
>  
>  
> +static struct weston_touch_device *
> +create_touch_device(struct wayland_input *input)
> +{
> + struct weston_touch_device *touch_device;
> + char str[128];
> +
> + /* manufacture a unique'ish name */
> + snprintf(str, sizeof str, "wayland-touch[%u]",
> +  wl_proxy_get_id((struct wl_proxy *)input->parent.seat));
> +
> + touch_device = weston_touch_create_touch_device(input->base.touch_state,
> + str, NULL, NULL);
> +
> + return touch_device;
> +}
> +
>  static void
>  input_handle_capabilities(void *data, struct wl_seat *seat,
> enum wl_seat_capability caps)
> @@ -2287,7 +2305,10 @@ input_handle_capabilities(void *data, struct wl_seat 
> *seat,
>   wl_touch_add_listener(input->parent.touch,
> &touch_listener, input);
>   weston_seat_init_touch(&input->base);
> + input->touch_device = create_touch_device(input);
>   } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->parent.touch) {
> + weston_touch_device_destroy(input->touch_device);
> + input->touch_device = NULL;
>   if (input->seat_version >= WL_TOUCH_RELEASE_SINCE_VERSION)
>   wl_touch_release(input->parent.touch);
>   else
> diff --git a/libweston/compositor.h b/libweston/compositor.h
> index 675ee68f..b08031ac 100644
> --- a/libweston/compositor.h
> +++ b/libweston/compositor.h
> @@ -453,10 +453,54 @@ struct weston_pointer {
>   struct wl_list timestamps_list;
>  };
>  
> +/** libinput style calibration matrix
> + *
> + * See https://wayland.freedesktop.org/libinput/doc/latest/absolute_axes.html
> + * and libinput_device_config_calibration_set_matrix().
> + */
> +struct weston_touch_device_matrix {
> + float m[6];
> +};
> +
> +struct weston_touch_device;
> +
> +/** Operations for a calibratable touchscreen */
> +struct weston_touch_device_ops {
> + /** Get the associated output if existing. */
> + struct weston_output *(*get_output)(struct weston_touch_device *device);
> +
> + /** Get the name of the associated head if existing. */
> + const char *
> + (*get_calibration_head_name)(struct weston_touch_device *device);
> +
> + /** Retrieve the current calibration matrix. */
> + void (*get_calibration

[PATCHv2] Add name event to xdg-output

2018-04-08 Thread Drew DeVault
Signed-off-by: Drew DeVault 
Reviewed-by: Simon Ser 
---
Thanks Daniel for pointing out my silly mistakes

 unstable/xdg-output/xdg-output-unstable-v1.xml | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/unstable/xdg-output/xdg-output-unstable-v1.xml 
b/unstable/xdg-output/xdg-output-unstable-v1.xml
index 0c0c481..e6ad6fe 100644
--- a/unstable/xdg-output/xdg-output-unstable-v1.xml
+++ b/unstable/xdg-output/xdg-output-unstable-v1.xml
@@ -77,7 +77,7 @@
 
   
 
-  
+  
 
   An xdg_output describes part of the compositor geometry.
 
@@ -157,5 +157,17 @@
   
 
 
+
+  
+Many compositors will assign names to their outputs, show them to the user,
+allow them to be configured by name, etc. The client may wish to know this
+name as well to offer the user similar behaviors.
+
+The name event is sent after creating an xdg_output (see
+xdg_output_manager.get_xdg_output).
+  
+  
+
+
   
 
-- 
2.16.3

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


Re: [PATCH] Add name event to xdg-output

2018-04-08 Thread Drew DeVault
On 2018-04-08  3:22 PM, Daniel Stone wrote:
> A name event would be great, but this is missing a string param to
> carry the actual name.

Whoops!

> In order to not breaking existing clients, it also needs to:
>   - come after the 'done' event so we don't renumber events
>   - bump the xdg_output interface version
>   - annotate the event with a 'since' version attrib

Ah, yep. v2 shortly.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] Add name event to xdg-output

2018-04-08 Thread Daniel Stone
Hi all,

On 7 April 2018 at 19:01, Drew DeVault  wrote:
> +
> +  
> +Many compositors will assign names to their outputs, show them to the 
> user,
> +allow them to be configured by name, etc. The client may wish to know 
> this
> +name as well to offer the user similar behaviors.
> +
> +The name event is sent after creating an xdg_output (see
> +xdg_output_manager.get_xdg_output).
> +  
> +

A name event would be great, but this is missing a string param to
carry the actual name.

In order to not breaking existing clients, it also needs to:
  - come after the 'done' event so we don't renumber events
  - bump the xdg_output interface version
  - annotate the event with a 'since' version attrib

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