seats.rst 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. .. _seats:
  2. ==============================================================================
  3. Seats
  4. ==============================================================================
  5. Each device in libinput is assigned to one seat.
  6. A seat has two identifiers, the physical name and the logical name. The
  7. physical name is summarized as the list of devices a process on the same
  8. physical seat has access to. The logical seat name is the seat name for a
  9. logical group of devices. A compositor may use that to create additional
  10. seats as independent device sets. Alternatively, a compositor may limit
  11. itself to a single logical seat, leaving a second compositor to manage
  12. devices on the other logical seats.
  13. .. _seats_overview:
  14. ------------------------------------------------------------------------------
  15. Overview
  16. ------------------------------------------------------------------------------
  17. Below is an illustration of how physical seats and logical seats interact:
  18. .. graphviz:: seats-sketch.gv
  19. The devices "Foo", "Bar" and "Spam" share the same physical seat and are
  20. thus available in the same libinput context. Only "Foo" and "Bar" share the
  21. same logical seat. The device "Egg" is not available in the libinput context
  22. associated with the physical seat 0.
  23. The above graph is for illustration purposes only. In libinput, a struct
  24. **libinput_seat** comprises both physical seat and logical seat. From a
  25. caller's point-of-view the above device layout is presented as:
  26. .. graphviz:: seats-sketch-libinput.gv
  27. Thus, devices "Foo" and "Bar" both reference the same struct
  28. **libinput_seat**, all other devices reference their own respective seats.
  29. .. _seats_and_features:
  30. ------------------------------------------------------------------------------
  31. The effect of seat assignment
  32. ------------------------------------------------------------------------------
  33. A logical seat is interpreted as a group of devices that usually belong to a
  34. single user that interacts with a computer. Thus, the devices are
  35. semantically related. This means for devices within the same logical seat:
  36. - if the same button is pressed on different devices, the button should only
  37. be considered logically pressed once.
  38. - if the same button is released on one device, the button should be
  39. considered logically down if still down on another device.
  40. - if two different buttons or keys are pressed on different devices, the
  41. logical state is that of both buttons/keys down.
  42. - if a button is pressed on one device and another device moves, this should
  43. count as dragging.
  44. - if two touches are down on different devices, the logical state is that of
  45. two touches down.
  46. libinput provides functions to aid with the above:
  47. **libinput_event_pointer_get_seat_button_count()**,
  48. **libinput_event_keyboard_get_seat_key_count()**, and
  49. **libinput_event_touch_get_seat_slot()**.
  50. Internally, libinput counts devices within the same logical seat as related.
  51. Cross-device features only activate if all required devices are in the same
  52. logical seat. For example, libinput will only activate the top software
  53. buttons (see :ref:`t440_support`) if both trackstick and touchpad are assigned
  54. to the same logical seat.
  55. .. _changing_seats:
  56. ------------------------------------------------------------------------------
  57. Changing seats
  58. ------------------------------------------------------------------------------
  59. A device may change the logical seat it is assigned to at runtime with
  60. **libinput_device_set_seat_logical_name()**. The physical seat is immutable and
  61. may not be changed.
  62. Changing the logical seat for a device is equivalent to unplugging the
  63. device and plugging it back in with the new logical seat. No device state
  64. carries over across a logical seat change.