mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
wayland: Handle NULL event node/vendor/product on tablet methods
We currently don't handle NULLs on these correctly, yet they can be so when running nested. Just refrain from sending those wp_tablet(_pad) events in that case.
This commit is contained in:
parent
ac502c921d
commit
c75eac27a8
@ -277,9 +277,13 @@ meta_wayland_tablet_pad_notify (MetaWaylandTabletPad *pad,
|
|||||||
struct wl_resource *resource)
|
struct wl_resource *resource)
|
||||||
{
|
{
|
||||||
struct wl_client *client = wl_resource_get_client (resource);
|
struct wl_client *client = wl_resource_get_client (resource);
|
||||||
|
const gchar *node_path;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
zwp_tablet_pad_v2_send_path (resource, clutter_input_device_get_device_node (pad->device));
|
node_path = clutter_input_device_get_device_node (pad->device);
|
||||||
|
if (node_path)
|
||||||
|
zwp_tablet_pad_v2_send_path (resource, node_path);
|
||||||
|
|
||||||
zwp_tablet_pad_v2_send_buttons (resource, pad->n_buttons);
|
zwp_tablet_pad_v2_send_buttons (resource, pad->n_buttons);
|
||||||
|
|
||||||
for (l = pad->groups; l; l = l->next)
|
for (l = pad->groups; l; l = l->next)
|
||||||
|
@ -85,13 +85,20 @@ meta_wayland_tablet_notify (MetaWaylandTablet *tablet,
|
|||||||
struct wl_resource *resource)
|
struct wl_resource *resource)
|
||||||
{
|
{
|
||||||
ClutterInputDevice *device = tablet->device;
|
ClutterInputDevice *device = tablet->device;
|
||||||
|
const gchar *node_path, *vendor, *product;
|
||||||
guint vid, pid;
|
guint vid, pid;
|
||||||
|
|
||||||
zwp_tablet_v2_send_name (resource, clutter_input_device_get_device_name (device));
|
zwp_tablet_v2_send_name (resource, clutter_input_device_get_device_name (device));
|
||||||
zwp_tablet_v2_send_path (resource, clutter_input_device_get_device_node (device));
|
|
||||||
|
|
||||||
if (sscanf (clutter_input_device_get_vendor_id (device), "%x", &vid) == 1 &&
|
node_path = clutter_input_device_get_device_node (device);
|
||||||
sscanf (clutter_input_device_get_product_id (device), "%x", &pid) == 1)
|
if (node_path)
|
||||||
|
zwp_tablet_v2_send_path (resource, node_path);
|
||||||
|
|
||||||
|
vendor = clutter_input_device_get_vendor_id (device);
|
||||||
|
product = clutter_input_device_get_product_id (device);
|
||||||
|
|
||||||
|
if (vendor && sscanf (vendor, "%x", &vid) == 1 &&
|
||||||
|
product && sscanf (product, "%x", &pid) == 1)
|
||||||
zwp_tablet_v2_send_id (resource, vid, pid);
|
zwp_tablet_v2_send_id (resource, vid, pid);
|
||||||
|
|
||||||
zwp_tablet_v2_send_done (resource);
|
zwp_tablet_v2_send_done (resource);
|
||||||
|
Loading…
Reference in New Issue
Block a user