diff --git a/clutter/clutter/clutter-seat.c b/clutter/clutter/clutter-seat.c index a641aae99..73672bd36 100644 --- a/clutter/clutter/clutter-seat.c +++ b/clutter/clutter/clutter-seat.c @@ -354,6 +354,17 @@ clutter_seat_get_keyboard (ClutterSeat *seat) return CLUTTER_SEAT_GET_CLASS (seat)->get_keyboard (seat); } +/** + * clutter_seat_peek_devices: (skip) + **/ +const GList * +clutter_seat_peek_devices (ClutterSeat *seat) +{ + g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL); + + return CLUTTER_SEAT_GET_CLASS (seat)->peek_devices (seat); +} + /** * clutter_seat_list_devices: * @seat: a #ClutterSeat @@ -370,7 +381,7 @@ clutter_seat_list_devices (ClutterSeat *seat) { g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL); - return CLUTTER_SEAT_GET_CLASS (seat)->list_devices (seat); + return g_list_copy ((GList *)clutter_seat_peek_devices (seat)); } void diff --git a/clutter/clutter/clutter-seat.h b/clutter/clutter/clutter-seat.h index e12965e00..7818647af 100644 --- a/clutter/clutter/clutter-seat.h +++ b/clutter/clutter/clutter-seat.h @@ -96,7 +96,7 @@ struct _ClutterSeatClass ClutterInputDevice * (* get_pointer) (ClutterSeat *seat); ClutterInputDevice * (* get_keyboard) (ClutterSeat *seat); - GList * (* list_devices) (ClutterSeat *seat); + const GList * (* peek_devices) (ClutterSeat *seat); void (* bell_notify) (ClutterSeat *seat); @@ -133,6 +133,7 @@ CLUTTER_EXPORT ClutterInputDevice * clutter_seat_get_keyboard (ClutterSeat *seat); CLUTTER_EXPORT GList * clutter_seat_list_devices (ClutterSeat *seat); +const GList * clutter_seat_peek_devices (ClutterSeat *seat); CLUTTER_EXPORT void clutter_seat_bell_notify (ClutterSeat *seat); diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c index ecff929bd..fa984fd1b 100644 --- a/src/backends/native/meta-seat-native.c +++ b/src/backends/native/meta-seat-native.c @@ -2636,17 +2636,12 @@ meta_seat_native_get_keyboard (ClutterSeat *seat) return seat_native->core_keyboard; } -static GList * -meta_seat_native_list_devices (ClutterSeat *seat) +static const GList * +meta_seat_native_peek_devices (ClutterSeat *seat) { MetaSeatNative *seat_native = META_SEAT_NATIVE (seat); - GList *devices = NULL; - GSList *l; - for (l = seat_native->devices; l; l = l->next) - devices = g_list_prepend (devices, l->data); - - return devices; + return (const GList *) seat_native->devices; } static void @@ -2771,7 +2766,7 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass) seat_class->get_pointer = meta_seat_native_get_pointer; seat_class->get_keyboard = meta_seat_native_get_keyboard; - seat_class->list_devices = meta_seat_native_list_devices; + seat_class->peek_devices = meta_seat_native_peek_devices; seat_class->bell_notify = meta_seat_native_bell_notify; seat_class->get_keymap = meta_seat_native_get_keymap; seat_class->copy_event_data = meta_seat_native_copy_event_data; diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c index f20cac148..1a29bbbac 100644 --- a/src/backends/x11/meta-seat-x11.c +++ b/src/backends/x11/meta-seat-x11.c @@ -1471,16 +1471,12 @@ meta_seat_x11_get_keyboard (ClutterSeat *seat) return seat_x11->core_keyboard; } -static GList * -meta_seat_x11_list_devices (ClutterSeat *seat) +static const GList * +meta_seat_x11_peek_devices (ClutterSeat *seat) { MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat); - GList *retval = NULL, *l; - for (l = seat_x11->devices; l; l = l->next) - retval = g_list_prepend (retval, l->data); - - return retval; + return (const GList *) seat_x11->devices; } static void @@ -1565,7 +1561,7 @@ meta_seat_x11_class_init (MetaSeatX11Class *klass) seat_class->get_pointer = meta_seat_x11_get_pointer; seat_class->get_keyboard = meta_seat_x11_get_keyboard; - seat_class->list_devices = meta_seat_x11_list_devices; + seat_class->peek_devices = meta_seat_x11_peek_devices; seat_class->bell_notify = meta_seat_x11_bell_notify; seat_class->get_keymap = meta_seat_x11_get_keymap; seat_class->copy_event_data = meta_seat_x11_copy_event_data;