gdk: remove the display->list_devices vfunc

gdk_display_list_devices is deprecated and all the backends
implement the same fallback by delegating to the device manager
and caching the list (caching it is needed since the method does
not transfer ownership of the container).
The compat code can be shared among all backends and we can
initialize the list lazily only in the case someone calls the
deprecated method.

https://bugzilla.gnome.org/show_bug.cgi?id=762891
This commit is contained in:
Paolo Borelli
2016-02-29 20:59:36 +01:00
parent d000b212c6
commit 4a6f8a065a
11 changed files with 46 additions and 228 deletions

View File

@ -1337,42 +1337,6 @@ gdk_event_init (GdkDisplay *display)
G_GNUC_END_IGNORE_DEPRECATIONS;
}
static void
gdk_x11_display_init_input (GdkDisplay *display)
{
GdkX11Display *display_x11;
GdkDeviceManager *device_manager;
GdkDevice *device;
GList *list, *l;
display_x11 = GDK_X11_DISPLAY (display);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
device_manager = gdk_display_get_device_manager (display);
/* For backwards compatibility, just add
* floating devices that are not keyboards.
*/
list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING);
G_GNUC_END_IGNORE_DEPRECATIONS;
for (l = list; l; l = l->next)
{
device = l->data;
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
continue;
display_x11->input_devices = g_list_prepend (display_x11->input_devices,
g_object_ref (l->data));
}
g_list_free (list);
display_x11->input_devices = g_list_prepend (display_x11->input_devices,
g_object_ref (gdk_seat_get_pointer (gdk_display_get_default_seat (display))));
}
static void
set_sm_client_id (GdkDisplay *display,
const gchar *sm_client_id)
@ -1639,8 +1603,6 @@ _gdk_x11_display_open (const gchar *display_name)
}
#endif
gdk_x11_display_init_input (display);
_gdk_x11_screen_setup (display_x11->screen);
g_signal_emit_by_name (display, "opened");
@ -1898,8 +1860,6 @@ gdk_x11_display_dispose (GObject *object)
{
GdkX11Display *display_x11 = GDK_X11_DISPLAY (object);
g_list_foreach (display_x11->input_devices, (GFunc) g_object_run_dispose, NULL);
_gdk_screen_close (display_x11->screen);
if (display_x11->event_source)
@ -1936,9 +1896,6 @@ gdk_x11_display_finalize (GObject *object)
/* List of event window extraction functions */
g_slist_free_full (display_x11->event_types, g_free);
/* input GdkDevice list */
g_list_free_full (display_x11->input_devices, g_object_unref);
/* input GdkWindow list */
g_list_free_full (display_x11->input_windows, g_free);
@ -2497,14 +2454,6 @@ gdk_x11_display_supports_composite (GdkDisplay *display)
x11_display->have_xfixes;
}
static GList *
gdk_x11_display_list_devices (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_X11_DISPLAY (display)->input_devices;
}
/**
* gdk_x11_register_standard_event_type:
* @display: (type GdkX11Display): a #GdkDisplay
@ -2981,7 +2930,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
display_class->supports_shapes = gdk_x11_display_supports_shapes;
display_class->supports_input_shapes = gdk_x11_display_supports_input_shapes;
display_class->supports_composite = gdk_x11_display_supports_composite;
display_class->list_devices = gdk_x11_display_list_devices;
display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context;
display_class->get_cursor_for_type = _gdk_x11_display_get_cursor_for_type;
display_class->get_cursor_for_name = _gdk_x11_display_get_cursor_for_name;