diff --git a/meson.build b/meson.build
index 8e28f2a2..a5ef524b 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project(
'wayland', 'c',
- version: '1.23.0',
+ version: '1.23.1',
license: 'MIT',
meson_version: '>= 0.57.0',
default_options: [
@@ -131,7 +131,9 @@ if get_option('scanner')
'wayland-scanner.mk',
'protocol/wayland.xml',
'protocol/wayland.dtd',
- ])
+ ],
+ install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'wayland'),
+ )
install_data(
[ 'wayland-scanner.m4' ],
diff --git a/src/scanner.c b/src/scanner.c
index 95524513..3cd05d13 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1378,6 +1378,50 @@ emit_event_wrappers(struct wl_list *message_list, struct interface *interface)
}
}
+static void
+emit_validator(struct interface *interface, struct enumeration *e)
+{
+ struct entry *entry;
+
+ printf("/**\n"
+ " * @ingroup iface_%s\n"
+ " * Validate a %s %s value.\n"
+ " *\n"
+ " * @return true on success, false on error.\n"
+ " * @ref %s_%s\n"
+ " */\n"
+ "static inline bool\n"
+ "%s_%s_is_valid(uint32_t value, uint32_t version) {\n",
+ interface->name, interface->name, e->name,
+ interface->name, e->name,
+ interface->name, e->name);
+
+ if (e->bitfield) {
+ printf(" uint32_t valid = 0;\n");
+ wl_list_for_each(entry, &e->entry_list, link) {
+ printf(" if (version >= %d)\n"
+ " valid |= %s_%s_%s;\n",
+ entry->since,
+ interface->uppercase_name, e->uppercase_name,
+ entry->uppercase_name);
+ }
+ printf(" return (value & ~valid) == 0;\n");
+ } else {
+ printf(" switch (value) {\n");
+ wl_list_for_each(entry, &e->entry_list, link) {
+ printf(" case %s%s_%s_%s:\n"
+ " return version >= %d;\n",
+ entry->value[0] == '-' ? "(uint32_t)" : "",
+ interface->uppercase_name, e->uppercase_name,
+ entry->uppercase_name, entry->since);
+ }
+ printf(" default:\n"
+ " return false;\n"
+ " }\n");
+ }
+ printf("}\n");
+}
+
static void
emit_enumerations(struct interface *interface, bool with_validators)
{
@@ -1439,32 +1483,8 @@ emit_enumerations(struct interface *interface, bool with_validators)
}
- if (with_validators) {
- printf("/**\n"
- " * @ingroup iface_%s\n"
- " * Validate a %s %s value.\n"
- " *\n"
- " * @return true on success, false on error.\n"
- " * @ref %s_%s\n"
- " */\n"
- "static inline bool\n"
- "%s_%s_is_valid(uint32_t value, uint32_t version) {\n"
- " switch (value) {\n",
- interface->name, interface->name, e->name,
- interface->name, e->name,
- interface->name, e->name);
- wl_list_for_each(entry, &e->entry_list, link) {
- printf(" case %s%s_%s_%s:\n"
- " return version >= %d;\n",
- entry->value[0] == '-' ? "(uint32_t)" : "",
- interface->uppercase_name, e->uppercase_name,
- entry->uppercase_name, entry->since);
- }
- printf(" default:\n"
- " return false;\n"
- " }\n"
- "}\n");
- }
+ if (with_validators)
+ emit_validator(interface, e);
printf("#endif /* %s_%s_ENUM */\n\n",
interface->uppercase_name, e->uppercase_name);
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 9cf27939..ef305c32 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -921,10 +921,14 @@ wl_proxy_marshal_array_flags(struct wl_proxy *proxy, uint32_t opcode,
if (debug_client) {
struct wl_event_queue *queue;
+ const char *queue_name = NULL;
queue = wl_proxy_get_queue(proxy);
+ if (queue)
+ queue_name = wl_event_queue_get_name(queue);
+
wl_closure_print(closure, &proxy->object, true, false, NULL,
- wl_event_queue_get_name(queue));
+ queue_name);
}
if (wl_closure_send(closure, proxy->display->connection)) {
diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h
index 63d0f02d..fb900a91 100644
--- a/src/wayland-server-core.h
+++ b/src/wayland-server-core.h
@@ -674,10 +674,11 @@ wl_display_init_shm(struct wl_display *display);
uint32_t *
wl_display_add_shm_format(struct wl_display *display, uint32_t format);
+WL_DEPRECATED
struct wl_shm_buffer *
wl_shm_buffer_create(struct wl_client *client,
uint32_t id, int32_t width, int32_t height,
- int32_t stride, uint32_t format) WL_DEPRECATED;
+ int32_t stride, uint32_t format);
void
wl_log_set_handler_server(wl_log_func_t handler);
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 2e185634..0ba1bcc0 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -2483,9 +2483,10 @@ wl_priv_signal_final_emit(struct wl_priv_signal *signal, void *data)
/** \cond */ /* Deprecated functions below. */
+WL_DEPRECATED
uint32_t
wl_client_add_resource(struct wl_client *client,
- struct wl_resource *resource) WL_DEPRECATED;
+ struct wl_resource *resource);
WL_EXPORT uint32_t
wl_client_add_resource(struct wl_client *client,
@@ -2514,11 +2515,12 @@ wl_client_add_resource(struct wl_client *client,
return resource->object.id;
}
+WL_DEPRECATED
struct wl_resource *
wl_client_add_object(struct wl_client *client,
const struct wl_interface *interface,
const void *implementation,
- uint32_t id, void *data) WL_DEPRECATED;
+ uint32_t id, void *data);
WL_EXPORT struct wl_resource *
wl_client_add_object(struct wl_client *client,
@@ -2537,10 +2539,11 @@ wl_client_add_object(struct wl_client *client,
return resource;
}
+WL_DEPRECATED
struct wl_resource *
wl_client_new_object(struct wl_client *client,
const struct wl_interface *interface,
- const void *implementation, void *data) WL_DEPRECATED;
+ const void *implementation, void *data);
WL_EXPORT struct wl_resource *
wl_client_new_object(struct wl_client *client,
@@ -2599,10 +2602,11 @@ wl_client_get_user_data(struct wl_client *client)
return client->data;
}
+WL_DEPRECATED
struct wl_global *
wl_display_add_global(struct wl_display *display,
const struct wl_interface *interface,
- void *data, wl_global_bind_func_t bind) WL_DEPRECATED;
+ void *data, wl_global_bind_func_t bind);
WL_EXPORT struct wl_global *
wl_display_add_global(struct wl_display *display,
@@ -2612,9 +2616,10 @@ wl_display_add_global(struct wl_display *display,
return wl_global_create(display, interface, interface->version, data, bind);
}
+WL_DEPRECATED
void
wl_display_remove_global(struct wl_display *display,
- struct wl_global *global) WL_DEPRECATED;
+ struct wl_global *global);
WL_EXPORT void
wl_display_remove_global(struct wl_display *display, struct wl_global *global)
diff --git a/src/wayland-server.h b/src/wayland-server.h
index 1be565f2..48fab1dd 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -70,30 +70,35 @@ struct wl_resource {
void *data;
};
+WL_DEPRECATED
uint32_t
wl_client_add_resource(struct wl_client *client,
- struct wl_resource *resource) WL_DEPRECATED;
+ struct wl_resource *resource);
+WL_DEPRECATED
struct wl_resource *
wl_client_add_object(struct wl_client *client,
const struct wl_interface *interface,
const void *implementation,
- uint32_t id, void *data) WL_DEPRECATED;
+ uint32_t id, void *data);
+WL_DEPRECATED
struct wl_resource *
wl_client_new_object(struct wl_client *client,
const struct wl_interface *interface,
- const void *implementation, void *data) WL_DEPRECATED;
+ const void *implementation, void *data);
+WL_DEPRECATED
struct wl_global *
wl_display_add_global(struct wl_display *display,
const struct wl_interface *interface,
void *data,
- wl_global_bind_func_t bind) WL_DEPRECATED;
+ wl_global_bind_func_t bind);
+WL_DEPRECATED
void
wl_display_remove_global(struct wl_display *display,
- struct wl_global *global) WL_DEPRECATED;
+ struct wl_global *global);
#endif
diff --git a/tests/data/example-server.h b/tests/data/example-server.h
index b0d9226d..2fad7097 100644
--- a/tests/data/example-server.h
+++ b/tests/data/example-server.h
@@ -2396,18 +2396,16 @@ enum wl_data_device_manager_dnd_action {
*/
static inline bool
wl_data_device_manager_dnd_action_is_valid(uint32_t value, uint32_t version) {
- switch (value) {
- case WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE:
- return version >= 1;
- case WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY:
- return version >= 1;
- case WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE:
- return version >= 1;
- case WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK:
- return version >= 1;
- default:
- return false;
- }
+ uint32_t valid = 0;
+ if (version >= 1)
+ valid |= WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
+ if (version >= 1)
+ valid |= WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
+ if (version >= 1)
+ valid |= WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
+ if (version >= 1)
+ valid |= WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK;
+ return (value & ~valid) == 0;
}
#endif /* WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM */
@@ -2560,28 +2558,26 @@ enum wl_shell_surface_resize {
*/
static inline bool
wl_shell_surface_resize_is_valid(uint32_t value, uint32_t version) {
- switch (value) {
- case WL_SHELL_SURFACE_RESIZE_NONE:
- return version >= 1;
- case WL_SHELL_SURFACE_RESIZE_TOP:
- return version >= 1;
- case WL_SHELL_SURFACE_RESIZE_BOTTOM:
- return version >= 1;
- case WL_SHELL_SURFACE_RESIZE_LEFT:
- return version >= 1;
- case WL_SHELL_SURFACE_RESIZE_TOP_LEFT:
- return version >= 1;
- case WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT:
- return version >= 1;
- case WL_SHELL_SURFACE_RESIZE_RIGHT:
- return version >= 1;
- case WL_SHELL_SURFACE_RESIZE_TOP_RIGHT:
- return version >= 1;
- case WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT:
- return version >= 1;
- default:
- return false;
- }
+ uint32_t valid = 0;
+ if (version >= 1)
+ valid |= WL_SHELL_SURFACE_RESIZE_NONE;
+ if (version >= 1)
+ valid |= WL_SHELL_SURFACE_RESIZE_TOP;
+ if (version >= 1)
+ valid |= WL_SHELL_SURFACE_RESIZE_BOTTOM;
+ if (version >= 1)
+ valid |= WL_SHELL_SURFACE_RESIZE_LEFT;
+ if (version >= 1)
+ valid |= WL_SHELL_SURFACE_RESIZE_TOP_LEFT;
+ if (version >= 1)
+ valid |= WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT;
+ if (version >= 1)
+ valid |= WL_SHELL_SURFACE_RESIZE_RIGHT;
+ if (version >= 1)
+ valid |= WL_SHELL_SURFACE_RESIZE_TOP_RIGHT;
+ if (version >= 1)
+ valid |= WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT;
+ return (value & ~valid) == 0;
}
#endif /* WL_SHELL_SURFACE_RESIZE_ENUM */
@@ -2609,12 +2605,10 @@ enum wl_shell_surface_transient {
*/
static inline bool
wl_shell_surface_transient_is_valid(uint32_t value, uint32_t version) {
- switch (value) {
- case WL_SHELL_SURFACE_TRANSIENT_INACTIVE:
- return version >= 1;
- default:
- return false;
- }
+ uint32_t valid = 0;
+ if (version >= 1)
+ valid |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE;
+ return (value & ~valid) == 0;
}
#endif /* WL_SHELL_SURFACE_TRANSIENT_ENUM */
@@ -3486,16 +3480,14 @@ enum wl_seat_capability {
*/
static inline bool
wl_seat_capability_is_valid(uint32_t value, uint32_t version) {
- switch (value) {
- case WL_SEAT_CAPABILITY_POINTER:
- return version >= 1;
- case WL_SEAT_CAPABILITY_KEYBOARD:
- return version >= 1;
- case WL_SEAT_CAPABILITY_TOUCH:
- return version >= 1;
- default:
- return false;
- }
+ uint32_t valid = 0;
+ if (version >= 1)
+ valid |= WL_SEAT_CAPABILITY_POINTER;
+ if (version >= 1)
+ valid |= WL_SEAT_CAPABILITY_KEYBOARD;
+ if (version >= 1)
+ valid |= WL_SEAT_CAPABILITY_TOUCH;
+ return (value & ~valid) == 0;
}
#endif /* WL_SEAT_CAPABILITY_ENUM */
@@ -4567,14 +4559,12 @@ enum wl_output_mode {
*/
static inline bool
wl_output_mode_is_valid(uint32_t value, uint32_t version) {
- switch (value) {
- case WL_OUTPUT_MODE_CURRENT:
- return version >= 1;
- case WL_OUTPUT_MODE_PREFERRED:
- return version >= 1;
- default:
- return false;
- }
+ uint32_t valid = 0;
+ if (version >= 1)
+ valid |= WL_OUTPUT_MODE_CURRENT;
+ if (version >= 1)
+ valid |= WL_OUTPUT_MODE_PREFERRED;
+ return (value & ~valid) == 0;
}
#endif /* WL_OUTPUT_MODE_ENUM */
diff --git a/tests/data/small-client-core.h b/tests/data/small-client-core.h
index 0e722441..03f889c8 100644
--- a/tests/data/small-client-core.h
+++ b/tests/data/small-client-core.h
@@ -106,6 +106,29 @@ enum intf_A_foo {
#define INTF_A_FOO_DEPRECATED_SINCE_VERSION 2
#endif /* INTF_A_FOO_ENUM */
+#ifndef INTF_A_BAR_ENUM
+#define INTF_A_BAR_ENUM
+enum intf_A_bar {
+ /**
+ * this is the first
+ */
+ INTF_A_BAR_FIRST = 0x01,
+ /**
+ * this is the second
+ */
+ INTF_A_BAR_SECOND = 0x02,
+ /**
+ * this is the third
+ * @since 2
+ */
+ INTF_A_BAR_THIRD = 0x04,
+};
+/**
+ * @ingroup iface_intf_A
+ */
+#define INTF_A_BAR_THIRD_SINCE_VERSION 2
+#endif /* INTF_A_BAR_ENUM */
+
/**
* @ingroup iface_intf_A
* @struct intf_A_listener
diff --git a/tests/data/small-client.h b/tests/data/small-client.h
index ad435923..0d5b6055 100644
--- a/tests/data/small-client.h
+++ b/tests/data/small-client.h
@@ -106,6 +106,29 @@ enum intf_A_foo {
#define INTF_A_FOO_DEPRECATED_SINCE_VERSION 2
#endif /* INTF_A_FOO_ENUM */
+#ifndef INTF_A_BAR_ENUM
+#define INTF_A_BAR_ENUM
+enum intf_A_bar {
+ /**
+ * this is the first
+ */
+ INTF_A_BAR_FIRST = 0x01,
+ /**
+ * this is the second
+ */
+ INTF_A_BAR_SECOND = 0x02,
+ /**
+ * this is the third
+ * @since 2
+ */
+ INTF_A_BAR_THIRD = 0x04,
+};
+/**
+ * @ingroup iface_intf_A
+ */
+#define INTF_A_BAR_THIRD_SINCE_VERSION 2
+#endif /* INTF_A_BAR_ENUM */
+
/**
* @ingroup iface_intf_A
* @struct intf_A_listener
diff --git a/tests/data/small-server-core.h b/tests/data/small-server-core.h
index e696cde7..d4476959 100644
--- a/tests/data/small-server-core.h
+++ b/tests/data/small-server-core.h
@@ -133,6 +133,47 @@ intf_A_foo_is_valid(uint32_t value, uint32_t version) {
}
#endif /* INTF_A_FOO_ENUM */
+#ifndef INTF_A_BAR_ENUM
+#define INTF_A_BAR_ENUM
+enum intf_A_bar {
+ /**
+ * this is the first
+ */
+ INTF_A_BAR_FIRST = 0x01,
+ /**
+ * this is the second
+ */
+ INTF_A_BAR_SECOND = 0x02,
+ /**
+ * this is the third
+ * @since 2
+ */
+ INTF_A_BAR_THIRD = 0x04,
+};
+/**
+ * @ingroup iface_intf_A
+ */
+#define INTF_A_BAR_THIRD_SINCE_VERSION 2
+/**
+ * @ingroup iface_intf_A
+ * Validate a intf_A bar value.
+ *
+ * @return true on success, false on error.
+ * @ref intf_A_bar
+ */
+static inline bool
+intf_A_bar_is_valid(uint32_t value, uint32_t version) {
+ uint32_t valid = 0;
+ if (version >= 1)
+ valid |= INTF_A_BAR_FIRST;
+ if (version >= 1)
+ valid |= INTF_A_BAR_SECOND;
+ if (version >= 2)
+ valid |= INTF_A_BAR_THIRD;
+ return (value & ~valid) == 0;
+}
+#endif /* INTF_A_BAR_ENUM */
+
/**
* @ingroup iface_intf_A
* @struct intf_A_interface
diff --git a/tests/data/small-server.h b/tests/data/small-server.h
index 009d9cdd..9cafcd93 100644
--- a/tests/data/small-server.h
+++ b/tests/data/small-server.h
@@ -133,6 +133,47 @@ intf_A_foo_is_valid(uint32_t value, uint32_t version) {
}
#endif /* INTF_A_FOO_ENUM */
+#ifndef INTF_A_BAR_ENUM
+#define INTF_A_BAR_ENUM
+enum intf_A_bar {
+ /**
+ * this is the first
+ */
+ INTF_A_BAR_FIRST = 0x01,
+ /**
+ * this is the second
+ */
+ INTF_A_BAR_SECOND = 0x02,
+ /**
+ * this is the third
+ * @since 2
+ */
+ INTF_A_BAR_THIRD = 0x04,
+};
+/**
+ * @ingroup iface_intf_A
+ */
+#define INTF_A_BAR_THIRD_SINCE_VERSION 2
+/**
+ * @ingroup iface_intf_A
+ * Validate a intf_A bar value.
+ *
+ * @return true on success, false on error.
+ * @ref intf_A_bar
+ */
+static inline bool
+intf_A_bar_is_valid(uint32_t value, uint32_t version) {
+ uint32_t valid = 0;
+ if (version >= 1)
+ valid |= INTF_A_BAR_FIRST;
+ if (version >= 1)
+ valid |= INTF_A_BAR_SECOND;
+ if (version >= 2)
+ valid |= INTF_A_BAR_THIRD;
+ return (value & ~valid) == 0;
+}
+#endif /* INTF_A_BAR_ENUM */
+
/**
* @ingroup iface_intf_A
* @struct intf_A_interface
diff --git a/tests/data/small.xml b/tests/data/small.xml
index ac527795..ab297490 100644
--- a/tests/data/small.xml
+++ b/tests/data/small.xml
@@ -58,5 +58,12 @@
+
+
+
+
+
+
+
diff --git a/tests/enum-validator-test.c b/tests/enum-validator-test.c
index 92037cff..8fb05b43 100644
--- a/tests/enum-validator-test.c
+++ b/tests/enum-validator-test.c
@@ -10,4 +10,19 @@ main(int argc, char *argv[]) {
assert(intf_A_foo_is_valid(INTF_A_FOO_THIRD, 2));
assert(intf_A_foo_is_valid(INTF_A_FOO_NEGATIVE, 2));
+
+ assert(intf_A_bar_is_valid(INTF_A_BAR_FIRST, 1));
+ assert(intf_A_bar_is_valid(INTF_A_BAR_FIRST, 2));
+ assert(intf_A_bar_is_valid(INTF_A_BAR_SECOND, 1));
+ assert(intf_A_bar_is_valid(INTF_A_BAR_SECOND, 2));
+ assert(intf_A_bar_is_valid(INTF_A_BAR_FIRST | INTF_A_BAR_SECOND, 1));
+ assert(intf_A_bar_is_valid(INTF_A_BAR_FIRST | INTF_A_BAR_SECOND, 2));
+
+ assert(!intf_A_bar_is_valid(INTF_A_BAR_THIRD, 1));
+ assert(!intf_A_bar_is_valid(INTF_A_BAR_FIRST | INTF_A_BAR_THIRD, 1));
+ assert(intf_A_bar_is_valid(INTF_A_BAR_THIRD, 2));
+ assert(intf_A_bar_is_valid(INTF_A_BAR_FIRST | INTF_A_BAR_THIRD, 2));
+
+ assert(!intf_A_bar_is_valid(0xFF, 1));
+ assert(!intf_A_bar_is_valid(0xFF, 2));
}