[PATCH weston v2 00/21] Relative pointer motions, locking and confinement

Jonas Ådahl jadahl at gmail.com
Wed May 13 03:26:21 PDT 2015


Hi again,

This series is a follow up from the last series. It had received some
review (on the list and on phabricator), and I had some issues of my own,
so here is a new one. I'll briefly go through the differences from the
previous version below.

I'm sending it now, even though we are in the process of releasing a new
version, because it has been asked for so that people can test games etc
more easily on Wayland. I don't expect anyone to review these as long as
there are patches targeted at the release they need to review first.

Note that these protocols does not try to solve every possible use case
for dealing with a mouse device (as discussed in a couple of threads a
while ago). I.e. it is not a replacement for any kind of 'raw' (for
instance evdev fd passing) solution, but rather a way for clients that
doesn't want to reimplement bare metal input device processing to get
relative motion events from pointer devices (mice, touchpads,
trackpoints etc). Examples of such potential users are SDL, GLFW,
FreeGLUT(?), nested weston, virtual machine UI's and Xwayland, just to
mention a few.

Also note that the 'click-to-lock' semantics are not part of the
protocol, but a compositor policy used in order to avoid pointer
stealing.


Changes to the preparation (1-11):

 * The motion event now uses double's to store data. This change was due
   wl_fixed_t not being detailed enough for certain ridiculous mice[0].
   Note that there are more changes needed to make that small motion
   events work properly.

Changes to the relative pointer protocol (12-13):

 * Introduce a data type abstraction used for sending 64 bit fixed point.
   This is needed in order to be able to send very tiny motion events[0].
   On the wire it'll just be two 'i':s and the compositor/client manually
   translates to a more sane data type using the conversion helpers.

 * Change the relative pointer motion event to emit motion vectors in the
   64 bit fixed point data type as described above.

 * A relative pointer is created from a pointer. This is to make it more
   obvious that it is an extension to wl_pointer and not a separate
   device.

Changes to the pointer lock and confinement protocols (14):

 * Serials are dropped (from the confined/locked events and
   set_cursor_position_hint). They were useless as lock/confine objects
   are one-shot and the server can use other methods (checking instance
   pointer for example) to avoid races.

Other additions in this series:

 * Support for non-rectangular confinement regions is implemented. A
   command line flag to clickdot is added to illustrate how it works.
   There are plenty of potential for optimization, and tests are needed
   but yet to be written, but I don't want to delay something that works
   with that.

Other changes include various review issues fixes.

Updated implementation of GLFW can be found at
<https://github.com/jadahl/glfw/commits/pointer-lock-v2>, SDL2 at
<https://bitbucket.org/jadahl/sdl/branch/pointer-lock-v2>. The patches in
this series can, for easier testing, be found at
<https://github.com/jadahl/weston/commits/wip/pointer-lock-v4>.

Comments and input welcome.


Jonas


[0] https://bugs.freedesktop.org/show_bug.cgi?id=85715


Jonas Ådahl (21):
  input: Pass axis events through pointer grab interfaces
  input: Make pointer grab motion callbacks take an event struct
  desktop-shell: Add surface_keyboard_focus_lost helper
  desktop-shell: Make activate_binding take a view instead of surface
  desktop-shell: Track the black surface by its view
  desktop-shell: Change switcher to track views
  desktop-shell: Make activate() take a view instead of surface
  desktop-shell: Pass a flag bitmask instead of bool to activate()
  compositor: Keep track of what views were activated by clicking
  libinput: Expose unaccelerated motion deltas in motion event struct
  input: Don't send wl_pointer.motion if position didn't change
  Introduce a 'double fixed' data type abstraction
  Introduce wl_relative_pointer interface
  Introduce pointer locking and confinement protocol
  clients: Add API for pointer locking and pointer confinement
  clients/resizor: Use pointer locking for resizing window
  clients/clickdot: Use pointer confinement to confine drawed line
  input: Support non-rectangular pointer confine regions
  clients/clickdot: Reset motion lines on Backspace
  window: Add API for manually set confine region
  clients/clickdot: Add option for using a more complex confine region

 Makefile.am                    |   22 +-
 clients/clickdot.c             |  170 ++++-
 clients/resizor.c              |  159 ++++-
 clients/window.c               |  316 ++++++++++
 clients/window.h               |   68 ++
 desktop-shell/exposay.c        |   24 +-
 desktop-shell/shell.c          |  175 ++++--
 desktop-shell/shell.h          |    4 +-
 ivi-shell/hmi-controller.c     |   18 +-
 protocol/pointer-lock.xml      |  208 +++++++
 protocol/relative-pointer.xml  |  112 ++++
 shared/util.h                  |   57 ++
 src/compositor-x11.c           |   13 +-
 src/compositor.c               |    9 +
 src/compositor.h               |   74 ++-
 src/data-device.c              |   11 +-
 src/input.c                    | 1352 +++++++++++++++++++++++++++++++++++++++-
 src/libinput-device.c          |   20 +-
 tests/double-fixed-benchmark.c |  110 ++++
 tests/weston-test.c            |   11 +-
 20 files changed, 2797 insertions(+), 136 deletions(-)
 create mode 100644 protocol/pointer-lock.xml
 create mode 100644 protocol/relative-pointer.xml
 create mode 100644 shared/util.h
 create mode 100644 tests/double-fixed-benchmark.c

-- 
2.1.4



More information about the wayland-devel mailing list