Skip to content
Snippets Groups Projects
  1. Apr 30, 2018
    • Louis-Francis Ratté-Boulianne's avatar
      clients: add a new touchscreen calibrator · fd4efb1d
      Louis-Francis Ratté-Boulianne authored and Pekka Paalanen's avatar Pekka Paalanen committed
      
      The new calibrator uses weston_touch_calibration protocol extension and
      provides the following features:
      
      - chooses the physical touch device to be calibrated by DEVPATH or by
        the output/head name; device enumeration provided
      
      - the compositor ensures the calibrator window is shown in the correct
        position and size
      
      - no matter how wrong the old calibration is, the touch events will
        always arrive in the application
      
      - the calibration is complete, not incremental; the received touch
        events are guaranteed to be unmodified
      
      - computes a libinput style calibration matrix directly, not the
        WL_CALIBRATION format
      
      - supports multiple touch devices: calibrate one device at a time, and
        show user feedback on touching a wrong device instead of recording bad
        data
      
      - uses four touch point samples: three to compute the calibration, and
        one to verify the calibration is roughly correct
      
      - consistent exit codes
      
      - upload the new calibration into the server after successful
        and verified calibration
      
      Due to using special touchscreen calibration protocol extension, this
      application cannot be tested without touch input from the compositor.
      
      Practically all of the above mentioned are unlike how the old
      calibrator client worked.
      
      Co-developed by Louis-Francis and Pekka.
      
      v2:
      - improve help() text
      - rename wrong_touch_handler() to invalid_touch_handler()
      - improve debug prints by adding sample number
      - reorganize code into sample funcs vs. touch funcs
      - add a state machine to properly process touch and related events
      
      Signed-off-by: default avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      fd4efb1d
    • Louis-Francis Ratté-Boulianne's avatar
      weston: add touchscreen_calibrator option · 552e1bcc
      Louis-Francis Ratté-Boulianne authored and Pekka Paalanen's avatar Pekka Paalanen committed
      
      Add an option to enable the touchscreen calibrator interface. This is a
      global on/off toggle, in lack of more fine-grained access restrictions.
      
      As Weston should not hardcode system specifics, the actual permanent
      saving of a new calibration is left for a user supplied script or a
      program. Usually this script would write an appropriate udev rule to set
      LIBINPUT_CALIBRATION_MATRIX for the touch device.
      
      Co-developed by Louis-Francis and Pekka.
      
      v2:
      - use syspath instead of devpath
      
      Signed-off-by: default avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      552e1bcc
    • Louis-Francis Ratté-Boulianne's avatar
      libweston: implement touch calibration protocol · d0e939a8
      Louis-Francis Ratté-Boulianne authored and Pekka Paalanen's avatar Pekka Paalanen committed
      
      This implements a new global interface weston_touch_calibration, which
      allows one client at a time to perform touchscreen calibration. This
      also implements the calibrator window management.
      
      A client asks to calibrate a specific physical touch device (not a
      wl_seat which may have several physical touch devices aggregated).
      Libweston grabs all touch devices and prevents normal touch event
      handling during the calibation sequence.
      
      API is added to enable this new global interface, but it not yet called
      by anything. Since the implementation allows clients to grab touch devices
      arbitrarily, it is not enabled by default. The compositor should take
      measures to prevent unexpected access to the interface.
      
      A client may upload a new calibration to the compositor. There is a
      vfunc to allow the compositor to reject/accept it and save it to
      persistent storage. The persistent storage could be a udev rule
      setting LIBINPUT_CALIBRATION_MATRIX, so that all display server would
      load the new calibration automatically.
      
      Co-developed by Louis-Francis and Pekka.
      
      v2:
      - use struct weston_point2d_device_normalized
      - use syspath instead of devpath
      - wrong_touch was renamed to invalid_touch
      - rename weston_touch_calibrator::cancelled to calibration_cancelled
      - send invalid_touch on out-of-bounds touch-down
      - cancel touch sequence and send invalid_touch on motion going
        out-of-bounds
      - rename calcoord_from_double() to wire_uint_from_double()
      - send bad_coordinates error in touch_calibrator_convert()
      - conversion results in 0,0 if cancelled
      
      Signed-off-by: default avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      d0e939a8
    • Pekka Paalanen's avatar
      protocol: add weston_touch_calibration · 003ca402
      Pekka Paalanen authored
      This is a Wayland protocol extension to allow the calibration of
      touchscreens in Weston.
      
      See: https://phabricator.freedesktop.org/T7868
      
      
      
      v2:
      - replace "server" with "compositor"
      - rephrase error conditions to be simpler
      - reword the matrix description in 'save' request
      - rephrase when touch_device events are sent
      - change device id to DEVPATH with "/sys" prefix
      - qualify calibration units better
      - replace wrong_touch event with a more generic invalid_touch
      - fix error enum and add bad_coordinates
      - convert while cancelled will not raise any errors
      
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      003ca402
    • Louis-Francis Ratté-Boulianne's avatar
      input: introduce touch event mode for calibrator · 597dedc9
      Louis-Francis Ratté-Boulianne authored and Pekka Paalanen's avatar Pekka Paalanen committed
      
      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: default avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      597dedc9
    • Pekka Paalanen's avatar
      input: do not forward unmatched touch-ups · 8135e188
      Pekka Paalanen authored
      
      Commit a30e29af introduced the code to
      deal with a touchscreen with touches already down when Weston starts
      using it. It fixed the touchpoint counting problem.
      
      However, Weston still should not forward or process the unmatched
      touch-ups either. Code inspection says it would confuse the
      idle-inhibit counting, and it could probably confuse clients as well.
      Hence, just drop unmatched touch-ups.
      
      Enhance the warning message to allow identifying where the event came
      from.
      
      v2:
      - use syspath instead of devpath
      
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      v1 Reviewed-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      8135e188
    • Louis-Francis Ratté-Boulianne's avatar
      input: move touchpoint counting up · a0edc520
      Louis-Francis Ratté-Boulianne authored and Pekka Paalanen's avatar Pekka Paalanen committed
      
      The touchpoint counting is needed regardless of what we do with the
      touch events, so move it out of process_touch_normal() into the caller
      notify_touch_normalized().
      
      This is pure refactoring.
      
      Signed-off-by: default avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      a0edc520
    • Pekka Paalanen's avatar
      libweston: introduce notify_touch_normalized() and doc · f58ee743
      Pekka Paalanen authored
      
      notify_touch_normalized() 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_normalized() delegates to it.
      
      Co-developed by Louis-Francis and Pekka.
      
      v2:
      - introduce struct weston_point2d_device_normalized
      - rename notify_touch_cal() to notify_touch_normalized()
      - remove WESTON_INVALID_TOUCH_COORDINATE
      
      Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      f58ee743
    • Pekka Paalanen's avatar
      libweston: notify_touch API to use weston_touch_device · daeb7c9c
      Pekka Paalanen authored
      
      Relay touch input events into libweston core through the
      weston_touch_device, so that the core can tell which individual physical
      device they come from.
      
      This is necessary for supporting touchscreen calibration, where one
      needs to process a single physical device at a time instead of the
      aggregate of all touch devices on the weston_seat.
      
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      daeb7c9c
    • Pekka Paalanen's avatar
      libinput: move calibration printing into do_set_calibration() · 8bedb39f
      Pekka Paalanen authored
      
      Move calibration printing here and call do_set_calibration() from
      evdev_device_set_calibration() so that all matrix setting paths print
      the same way.
      
      Print the matrix values in a matrix style to help readability, and
      mention the input device.
      
      v2:
      - use 'cal' instead of 'calb' as variable name
      
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      8bedb39f
    • Louis-Francis Ratté-Boulianne's avatar
      input: introduce weston_touch_device · 8cf288ce
      Louis-Francis Ratté-Boulianne authored and Pekka Paalanen's avatar Pekka Paalanen committed
      
      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.
      
      v2:
      - Consistently use 'cal' instead of 'calb' or 'matrix'.
      - change devpath into syspath
      - update copyrights
      
      Signed-off-by: default avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      8cf288ce
    • Louis-Francis Ratté-Boulianne's avatar
      libweston: fix weston_touch_start_grab() arg name · 8549e165
      Louis-Francis Ratté-Boulianne authored and Pekka Paalanen's avatar Pekka Paalanen committed
      
      compositor.c has 'touch', so use 'touch' here as well. It is not a
      device to begin with.
      
      Signed-off-by: default avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      8549e165
    • Pekka Paalanen's avatar
      libweston: unexport weston_{pointer,keyboard,touch}_{create,destroy}() · 1b043b16
      Pekka Paalanen authored
      
      We have weston_seat_{init,release}_{pointer,keyboard,touch}() as the
      backend-facing API. There is no need to expose the create/destroy
      functions which have been for internal use only for quite a long time.
      
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      v1 Tested-by: default avatarMatt Hoosier <matt.hoosier@gmail.com>
      1b043b16
  2. Apr 26, 2018
  3. Apr 20, 2018
  4. Apr 18, 2018
Loading