Emit GdkDevice::changed when the slave device being used changes
When the slave device changes, the master takes the shape of the new one, modifying its axes, this signal is more useful to catch this situation than the n-axes property
This commit is contained in:
		| @ -64,6 +64,14 @@ struct _GdkDevicePrivate | ||||
|   GArray *axes; | ||||
| }; | ||||
|  | ||||
| enum { | ||||
|   CHANGED, | ||||
|   LAST_SIGNAL | ||||
| }; | ||||
|  | ||||
| static guint signals [LAST_SIGNAL] = { 0 }; | ||||
|  | ||||
|  | ||||
| static void gdk_device_dispose      (GObject      *object); | ||||
| static void gdk_device_set_property (GObject      *object, | ||||
|                                      guint         prop_id, | ||||
| @ -238,6 +246,26 @@ gdk_device_class_init (GdkDeviceClass *klass) | ||||
|                                                       0, G_MAXUINT, 0, | ||||
|                                                       G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); | ||||
|  | ||||
|   /** | ||||
|    * GdkDevice::changed: | ||||
|    * @device: the #GdkDevice that changed. | ||||
|    * | ||||
|    * The ::changed signal is emitted either when the #GdkDevice | ||||
|    * has changed the number of either axes or keys. For example | ||||
|    * In X this will normally happen when the slave device routing | ||||
|    * events through the master device changes (for example, user | ||||
|    * switches from the USB mouse to a tablet), in that case the | ||||
|    * master device will change to reflect the new slave device | ||||
|    * axes and keys. | ||||
|    */ | ||||
|   signals[CHANGED] = | ||||
|     g_signal_new (g_intern_static_string ("changed"), | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   NULL, NULL, NULL, | ||||
|                   g_cclosure_marshal_VOID__VOID, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   g_type_class_add_private (object_class, sizeof (GdkDevicePrivate)); | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -499,6 +499,8 @@ handle_device_changed (GdkDeviceManagerXI2  *device_manager, | ||||
|  | ||||
|   _gdk_device_reset_axes (device); | ||||
|   translate_device_classes (display, device, ev->classes, ev->num_classes); | ||||
|  | ||||
|   g_signal_emit_by_name (G_OBJECT (device), "changed"); | ||||
| } | ||||
|  | ||||
| static GdkCrossingMode | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Carlos Garnacho
					Carlos Garnacho