wayland: Use a named #define for the xdg-shell version

This commit is contained in:
Jasper St. Pierre 2014-07-17 17:37:29 -04:00
parent ac0b2fdc6f
commit c9a2a561f8
2 changed files with 6 additions and 4 deletions

View File

@ -1118,15 +1118,15 @@ bind_xdg_shell (struct wl_client *client,
{ {
XdgShell *xdg_shell; XdgShell *xdg_shell;
if (version != 1) if (version != META_XDG_SHELL_VERSION)
{ {
g_warning ("using xdg-shell without stable version 1\n"); g_warning ("using xdg-shell without stable version %d\n", META_XDG_SHELL_VERSION);
return; return;
} }
xdg_shell = g_slice_new (XdgShell); xdg_shell = g_slice_new (XdgShell);
xdg_shell->resource = wl_resource_create (client, &xdg_shell_interface, 1, id); xdg_shell->resource = wl_resource_create (client, &xdg_shell_interface, META_XDG_SHELL_VERSION, id);
wl_resource_set_implementation (xdg_shell->resource, &meta_wayland_xdg_shell_interface, data, NULL); wl_resource_set_implementation (xdg_shell->resource, &meta_wayland_xdg_shell_interface, data, NULL);
xdg_shell->client_destroy_listener.notify = xdg_shell_handle_client_destroy; xdg_shell->client_destroy_listener.notify = xdg_shell_handle_client_destroy;
@ -1752,7 +1752,8 @@ void
meta_wayland_shell_init (MetaWaylandCompositor *compositor) meta_wayland_shell_init (MetaWaylandCompositor *compositor)
{ {
if (wl_global_create (compositor->wayland_display, if (wl_global_create (compositor->wayland_display,
&xdg_shell_interface, 1, &xdg_shell_interface,
META_XDG_SHELL_VERSION,
compositor, bind_xdg_shell) == NULL) compositor, bind_xdg_shell) == NULL)
g_error ("Failed to register a global xdg-shell object"); g_error ("Failed to register a global xdg-shell object");

View File

@ -37,6 +37,7 @@
/* Global/master objects (version exported by wl_registry and negotiated through bind) */ /* Global/master objects (version exported by wl_registry and negotiated through bind) */
#define META_WL_COMPOSITOR_VERSION 3 #define META_WL_COMPOSITOR_VERSION 3
#define META_WL_DATA_DEVICE_MANAGER_VERSION 1 #define META_WL_DATA_DEVICE_MANAGER_VERSION 1
#define META_XDG_SHELL_VERSION 1
#define META_WL_SHELL_VERSION 1 #define META_WL_SHELL_VERSION 1
#define META_WL_SEAT_VERSION 3 #define META_WL_SEAT_VERSION 3
#define META_WL_OUTPUT_VERSION 2 #define META_WL_OUTPUT_VERSION 2