Clutter Reference Manual: ClutterDeviceManager

## ClutterDeviceManager ClutterDeviceManager — Maintains the list of input devices |

## Functions

ClutterDeviceManager * | clutter_device_manager_get_default ()
GSList * | clutter_device_manager_list_devices ()
const GSList * | clutter_device_manager_peek_devices ()
ClutterInputDevice * | clutter_device_manager_get_device ()
ClutterInputDevice * | clutter_device_manager_get_core_device ()
ClutterInputDevice * | clutter_get_input_device_for_id ()

## Properties

ClutterBackend * | backend | Read / Write / Construct Only

## Signals

void | device-added | Run Last
void | device-removed | Run Last

## Types and Values

struct | ClutterDeviceManager
struct | ClutterDeviceManagerClass

## Object Hierarchy

        GObject
        ╰── ClutterDeviceManager

## Description

ClutterDeviceManager is a singleton object, owned by Clutter, which maintains the list of ClutterInputDevice<!-- -->s.

Depending on the backend used by Clutter it is possible to use the “device-added” and “device-removed” to monitor addition and removal of devices.

ClutterDeviceManager is available since Clutter 1.2

## Functions

### clutter_device_manager_get_default ()

    ClutterDeviceManager *
    clutter_device_manager_get_default (void);

Retrieves the device manager singleton

#### Returns

the ClutterDeviceManager singleton. The returned instance is owned by Clutter and it should not be modified or freed.

[transfer none]

Since 1.2

### clutter_device_manager_list_devices ()

    GSList *
    clutter_device_manager_list_devices (ClutterDeviceManager *device_manager);

Lists all currently registered input devices

#### Parameters

device_manager | a ClutterDeviceManager |

#### Returns

a newly allocated list of ClutterInputDevice objects. Use `g_slist_free()` to deallocate it when done.

[transfer container][element-type Clutter.InputDevice]

Since 1.2

### clutter_device_manager_peek_devices ()

    const GSList *
    clutter_device_manager_peek_devices (ClutterDeviceManager *device_manager);

Lists all currently registered input devices

#### Parameters

device_manager | a ClutterDeviceManager |

#### Returns

a pointer to the internal list of ClutterInputDevice objects. The returned list is owned by the ClutterDeviceManager and should never be modified or freed.

[transfer none][element-type Clutter.InputDevice]

Since 1.2

### clutter_device_manager_get_device ()

    ClutterInputDevice *
    clutter_device_manager_get_device (ClutterDeviceManager *device_manager,
                                       gint device_id);

Retrieves the ClutterInputDevice with the given `device_id`

#### Parameters

device_manager | a ClutterDeviceManager |
device_id | the integer id of a device |

#### Returns

a ClutterInputDevice or `NULL`. The returned device is owned by the ClutterDeviceManager and should never be modified or freed.

[transfer none]

Since 1.2

### clutter_device_manager_get_core_device ()

    ClutterInputDevice *
    clutter_device_manager_get_core_device
                                   (ClutterDeviceManager *device_manager,
                                    ClutterInputDeviceType device_type);

Retrieves the core ClutterInputDevice of type `device_type`

Core devices are devices created automatically by the default Clutter backend

#### Parameters

device_manager | a ClutterDeviceManager |
device_type | the type of the core device |

#### Returns

a ClutterInputDevice or `NULL`. The returned device is owned by the ClutterDeviceManager and should not be modified or freed.

[transfer none]

Since 1.2

### clutter_get_input_device_for_id ()

    ClutterInputDevice *
    clutter_get_input_device_for_id (gint id_);

`clutter_get_input_device_for_id` has been deprecated since version 1.10 and should not be used in newly-written code.

Use `clutter_device_manager_get_device()` instead.

Retrieves the ClutterInputDevice from its `id_` . This is a convenience wrapper for `clutter_device_manager_get_device()` and it is functionally equivalent to:

    1
    2
    3
    4
    5
    ClutterDeviceManager *manager;
    ClutterInputDevice *device;

    manager = clutter_device_manager_get_default ();
    device = clutter_device_manager_get_device (manager, id);

#### Parameters

id_ | the unique id for a device |

#### Returns

a ClutterInputDevice, or `NULL`.

[transfer none]

Since 0.8

## Types and Values

### struct ClutterDeviceManager

    struct ClutterDeviceManager;

The ClutterDeviceManager structure contains only private data

Since 1.2

### struct ClutterDeviceManagerClass

    struct ClutterDeviceManagerClass {
    };

The ClutterDeviceManagerClass structure contains only private data

Since 1.2

## Property Details

### The `“backend”` property

      “backend”                  ClutterBackend *

The ClutterBackend of the device manager.

Flags: Read / Write / Construct Only

## Signal Details

### The `“device-added”` signal

    void
    user_function (ClutterDeviceManager *manager,
                   ClutterInputDevice   *device,
                   gpointer              user_data)

The ::device-added signal is emitted each time a device has been added to the ClutterDeviceManager

#### Parameters

manager | the ClutterDeviceManager that emitted the signal |
device | the newly added ClutterInputDevice |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since 1.2

### The `“device-removed”` signal

    void
    user_function (ClutterDeviceManager *manager,
                   ClutterInputDevice   *device,
                   gpointer              user_data)

The ::device-removed signal is emitted each time a device has been removed from the ClutterDeviceManager

#### Parameters

manager | the ClutterDeviceManager that emitted the signal |
device | the removed ClutterInputDevice |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since 1.2