clutter/evdev: Emit ClutterDeviceManager::tool-changed

We do so whenever a tool enters or leaves proximity. We now also
ensure that last_tool is NULL after it leaves proximity, although
the CLUTTER_PROXIMITY_OUT event itself should still contain tool
information.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
This commit is contained in:
Carlos Garnacho 2016-10-31 17:36:50 +01:00
parent bd83873a7f
commit 75c3f0ffba

View File

@ -1210,7 +1210,12 @@ input_device_update_tool (ClutterInputDevice *input_device,
} }
} }
if (evdev_device->last_tool != tool)
{
evdev_device->last_tool = tool; evdev_device->last_tool = tool;
g_signal_emit_by_name (clutter_device_manager_get_default (),
"tool-changed", input_device, tool);
}
} }
static gdouble * static gdouble *
@ -1753,8 +1758,11 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
libinput_tool = libinput_event_tablet_tool_get_tool (tablet_event); libinput_tool = libinput_event_tablet_tool_get_tool (tablet_event);
if (state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN)
input_device_update_tool (device, libinput_tool); input_device_update_tool (device, libinput_tool);
notify_proximity (device, time, state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); notify_proximity (device, time, state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
if (state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT)
input_device_update_tool (device, NULL);
break; break;
} }
case LIBINPUT_EVENT_TABLET_TOOL_BUTTON: case LIBINPUT_EVENT_TABLET_TOOL_BUTTON: