struct list devices_list;
void *user_data;
int refcount;
- char *name;
+ char *physical_name;
+ char *logical_name;
libinput_seat_destroy_func destroy;
};
void
libinput_seat_init(struct libinput_seat *seat,
struct libinput *libinput,
- const char *name,
+ const char *physical_name,
+ const char *logical_name,
libinput_seat_destroy_func destroy);
void
void
libinput_seat_init(struct libinput_seat *seat,
struct libinput *libinput,
- const char *name,
+ const char *physical_name,
+ const char *logical_name,
libinput_seat_destroy_func destroy)
{
seat->refcount = 1;
seat->libinput = libinput;
- seat->name = strdup(name);
+ seat->physical_name = strdup(physical_name);
+ seat->logical_name = strdup(logical_name);
seat->destroy = destroy;
list_init(&seat->devices_list);
}
libinput_seat_destroy(struct libinput_seat *seat)
{
list_remove(&seat->link);
- free(seat->name);
+ free(seat->logical_name);
+ free(seat->physical_name);
seat->destroy(seat);
}
}
LIBINPUT_EXPORT const char *
-libinput_seat_get_name(struct libinput_seat *seat)
+libinput_seat_get_physical_name(struct libinput_seat *seat)
{
- return seat->name;
+ return seat->physical_name;
+}
+
+LIBINPUT_EXPORT const char *
+libinput_seat_get_logical_name(struct libinput_seat *seat)
+{
+ return seat->logical_name;
}
void
/**
* @defgroup seat Initialization and manipulation of seats
+ *
+ * A seat has two identifiers, the physical name and the logical name. The
+ * physical name is summarized as the list of devices a process on the same
+ * physical seat has access to.
+ *
+ * The logical seat name is the seat name for a logical group of devices. A
+ * compositor may use that to create additonal seats as independent device
+ * sets. Alternatively, a compositor may limit itself to a single logical
+ * seat, leaving a second compositor to manage devices on the other logical
+ * seats.
+ *
+ * @code
+ * +---+--------+------------+------------------------+------------+
+ * | | event0 | | | log seat A |
+ * | K +--------+ | +------------+
+ * | e | event1 | phys seat0 | libinput context 1 | |
+ * | r +--------+ | | log seat B |
+ * | n | event2 | | | |
+ * | e +--------+------------+------------------------+------------+
+ * | l | event3 | phys seat1 | libinput context 2 | log seat C |
+ * +---+--------+------------+------------------------+------------+
+ * @endcode
*/
/**
/**
* @ingroup seat
*
+ * Return the physical name of the seat. For libinput contexts created from
+ * udev, this is always the same value as passed into
+ * libinput_create_from_udev() and all seats from that context will have the
+ * same physical name.
+ *
+ * The physical name of the seat is one that is usually set by the system or
+ * lower levels of the stack. In most cases, this is the base filter for
+ * devices - devices assigned to seats outside the current seat will not
+ * be available to the caller.
+ *
+ * @param seat A previously obtained seat
+ * @return the physical name of this seat
+ */
+const char *
+libinput_seat_get_physical_name(struct libinput_seat *seat);
+
+/**
+ * @ingroup seat
+ *
+ * Return the logical name of the seat. This is an identifier to group sets
+ * of devices within the compositor.
+ *
* @param seat A previously obtained seat
- * @return the name of this seat
+ * @return the logical name of this seat
*/
const char *
-libinput_seat_get_name(struct libinput_seat *seat);
+libinput_seat_get_logical_name(struct libinput_seat *seat);
/**
* @defgroup device Initialization and manipulation of input devices
seat->name = "default";
- libinput_seat_init(&seat->base, &input->base, seat->name, path_seat_destroy);
+ /* FIXME: get physical seat from udev */
+ libinput_seat_init(&seat->base, &input->base, seat->name, seat->name, path_seat_destroy);
list_insert(&input->base.seat_list, &seat->base.link);
return seat;
static const char default_seat_name[] = "default";
static struct udev_seat *
-udev_seat_create(struct udev_input *input, const char *seat_name);
+udev_seat_create(struct udev_input *input,
+ const char *device_seat,
+ const char *seat_name);
static struct udev_seat *
udev_seat_get_named(struct udev_input *input, const char *seat_name);
if (seat)
libinput_seat_ref(&seat->base);
else {
- seat = udev_seat_create(input, seat_name);
+ seat = udev_seat_create(input, device_seat, seat_name);
if (!seat)
return -1;
}
/* if the seat may be referenced by the
client, so make sure it's dropped from
the seat list now, to be freed whenever
- the device is removed */
+ * the device is removed */
list_remove(&seat->base.link);
list_init(&seat->base.link);
}
}
static struct udev_seat *
-udev_seat_create(struct udev_input *input, const char *seat_name)
+udev_seat_create(struct udev_input *input,
+ const char *device_seat,
+ const char *seat_name)
{
struct udev_seat *seat;
if (!seat)
return NULL;
- libinput_seat_init(&seat->base, &input->base, seat_name, udev_seat_destroy);
+ libinput_seat_init(&seat->base, &input->base,
+ device_seat, seat_name,
+ udev_seat_destroy);
list_insert(&input->base.seat_list, &seat->base.link);
return seat;
struct udev_seat *seat;
list_for_each(seat, &input->base.seat_list, base.link) {
- if (strcmp(seat->base.name, seat_name) == 0)
+ if (strcmp(seat->base.logical_name, seat_name) == 0)
return seat;
}
seat = libinput_device_get_seat(device);
ck_assert(seat != NULL);
- seat_name = libinput_seat_get_name(seat);
+ seat_name = libinput_seat_get_logical_name(seat);
ck_assert_int_eq(strcmp(seat_name, "default"), 0);
libinput_event_destroy(event);
seat = libinput_device_get_seat(device);
ck_assert(seat != NULL);
- seat_name = libinput_seat_get_name(seat);
+ seat_name = libinput_seat_get_logical_name(seat);
default_seat_found = !strcmp(seat_name, "default");
libinput_event_destroy(event);
}