tests/wayland-client-utils: Use interface names instead of static strings

Let's be a good example here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2394>
This commit is contained in:
Robert Mader 2023-03-01 23:31:51 +01:00
parent c64a04678a
commit 692ea856fb

View File

@ -150,34 +150,34 @@ handle_registry_global (void *user_data,
{ {
WaylandDisplay *display = WAYLAND_DISPLAY (user_data); WaylandDisplay *display = WAYLAND_DISPLAY (user_data);
if (strcmp (interface, "wl_compositor") == 0) if (strcmp (interface, wl_compositor_interface.name) == 0)
{ {
display->compositor = display->compositor =
wl_registry_bind (registry, id, &wl_compositor_interface, wl_registry_bind (registry, id, &wl_compositor_interface,
MIN (version, 5)); MIN (version, 5));
} }
else if (strcmp (interface, "wl_subcompositor") == 0) else if (strcmp (interface, wl_subcompositor_interface.name) == 0)
{ {
display->subcompositor = display->subcompositor =
wl_registry_bind (registry, id, &wl_subcompositor_interface, 1); wl_registry_bind (registry, id, &wl_subcompositor_interface, 1);
} }
else if (strcmp (interface, "wl_shm") == 0) else if (strcmp (interface, wl_shm_interface.name) == 0)
{ {
display->shm = wl_registry_bind (registry, display->shm = wl_registry_bind (registry,
id, &wl_shm_interface, 1); id, &wl_shm_interface, 1);
} }
else if (strcmp (interface, "wp_single_pixel_buffer_manager_v1") == 0) else if (strcmp (interface, wp_single_pixel_buffer_manager_v1_interface.name) == 0)
{ {
display->single_pixel_mgr = display->single_pixel_mgr =
wl_registry_bind (registry, id, wl_registry_bind (registry, id,
&wp_single_pixel_buffer_manager_v1_interface, 1); &wp_single_pixel_buffer_manager_v1_interface, 1);
} }
else if (strcmp (interface, "wp_viewporter") == 0) else if (strcmp (interface, wp_viewporter_interface.name) == 0)
{ {
display->viewporter = wl_registry_bind (registry, id, display->viewporter = wl_registry_bind (registry, id,
&wp_viewporter_interface, 1); &wp_viewporter_interface, 1);
} }
else if (strcmp (interface, "xdg_wm_base") == 0) else if (strcmp (interface, xdg_wm_base_interface.name) == 0)
{ {
int xdg_wm_base_version = 1; int xdg_wm_base_version = 1;