backends/eis-client: Do not add device before adding EIS regions

When a device is added, libei does not allow adding additional regions
for that particular device, as it is already advertised to the EI
client.
As a result, mutter currently effectively only adds the first region to
a device, but not the others.
This makes input in multi monitor sessions only possible on one monitor,
as the EI client cannot look up the other regions, since they were not
advertised to it.

Fix this situation by not adding and resuming the device, when a shared
device is used.
Instead, for shared devices, always add all regions first, and then
after that, add and resume the device.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3273>
This commit is contained in:
Pascal Nowack 2023-09-12 19:03:25 +02:00
parent 4c5db8e3bd
commit 483601844b

View File

@ -308,12 +308,12 @@ configure_abs_standalone (MetaEisClient *client,
}
static MetaEisDevice *
add_device (MetaEisClient *client,
struct eis_seat *eis_seat,
ClutterInputDeviceType type,
const char *name_suffix,
MetaEisDeviceConfigFunc extra_config_func,
gpointer extra_config_user_data)
create_device (MetaEisClient *client,
struct eis_seat *eis_seat,
ClutterInputDeviceType type,
const char *name_suffix,
MetaEisDeviceConfigFunc extra_config_func,
gpointer extra_config_user_data)
{
MetaBackend *backend = meta_eis_get_backend (client->eis);
MetaEisDevice *device;
@ -339,13 +339,38 @@ add_device (MetaEisClient *client,
eis_device, /* owns the initial ref now */
device);
eis_device_add (eis_device);
eis_device_resume (eis_device);
g_free (name);
return device;
}
static void
propagate_device (MetaEisDevice *device)
{
eis_device_add (device->eis_device);
eis_device_resume (device->eis_device);
}
static MetaEisDevice *
add_device (MetaEisClient *client,
struct eis_seat *eis_seat,
ClutterInputDeviceType type,
const char *name_suffix,
MetaEisDeviceConfigFunc extra_config_func,
gpointer extra_config_user_data)
{
MetaEisDevice *device;
device = create_device (client,
eis_seat,
type,
name_suffix,
extra_config_func, extra_config_user_data);
propagate_device (device);
return device;
}
static void
handle_motion_relative (MetaEisClient *client,
struct eis_event *event)
@ -650,12 +675,12 @@ add_abs_pointer_devices (MetaEisClient *client)
{
if (!shared_device)
{
shared_device = add_device (client,
client->eis_seat,
CLUTTER_POINTER_DEVICE,
"shared virtual absolute pointer",
configure_abs_shared,
viewport);
shared_device = create_device (client,
client->eis_seat,
CLUTTER_POINTER_DEVICE,
"shared virtual absolute pointer",
configure_abs_shared,
viewport);
}
else
{
@ -663,6 +688,9 @@ add_abs_pointer_devices (MetaEisClient *client)
}
}
}
if (shared_device)
propagate_device (shared_device);
}
gboolean