diff --git a/src/scanner.c b/src/scanner.c index 1b71e60c..959699ef 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -1101,6 +1101,16 @@ format_text_to_comment(const char *text, bool standalone_comment) printf(" */\n\n"); } +static void +emit_max_interface_version(struct interface *interface) +{ + printf("/**\n * @ingroup iface_%s\n */\n", interface->name); + printf("#define %s_MAX_VERSION %d\n", + interface->uppercase_name, interface->version); + + printf("\n"); +} + static void emit_opcodes(struct wl_list *message_list, struct interface *interface) { @@ -1776,12 +1786,14 @@ emit_header(struct protocol *protocol, enum side side) if (side == SERVER) { emit_structs(&i->request_list, i, side); + emit_max_interface_version(i); emit_opcodes(&i->event_list, i); emit_opcode_versions(&i->event_list, i); emit_opcode_versions(&i->request_list, i); emit_event_wrappers(&i->event_list, i); } else { emit_structs(&i->event_list, i, side); + emit_max_interface_version(i); emit_opcodes(&i->request_list, i); emit_opcode_versions(&i->event_list, i); emit_opcode_versions(&i->request_list, i); diff --git a/tests/data/empty-client.h b/tests/data/empty-client.h index bf1264a4..951dcc8e 100644 --- a/tests/data/empty-client.h +++ b/tests/data/empty-client.h @@ -31,6 +31,11 @@ struct empty; extern const struct wl_interface empty_interface; #endif +/** + * @ingroup iface_empty + */ +#define EMPTY_MAX_VERSION 1 + #define EMPTY_EMPTY 0 diff --git a/tests/data/empty-server.h b/tests/data/empty-server.h index 4baf6d6b..aca07053 100644 --- a/tests/data/empty-server.h +++ b/tests/data/empty-server.h @@ -45,6 +45,11 @@ struct empty_interface { struct wl_resource *resource); }; +/** + * @ingroup iface_empty + */ +#define EMPTY_MAX_VERSION 1 + /** * @ingroup iface_empty diff --git a/tests/data/example-client.h b/tests/data/example-client.h index a14b5e00..60ee4a6a 100644 --- a/tests/data/example-client.h +++ b/tests/data/example-client.h @@ -950,6 +950,11 @@ wl_display_add_listener(struct wl_display *wl_display, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_display + */ +#define WL_DISPLAY_MAX_VERSION 1 + #define WL_DISPLAY_SYNC 0 #define WL_DISPLAY_GET_REGISTRY 1 @@ -1088,6 +1093,11 @@ wl_registry_add_listener(struct wl_registry *wl_registry, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_registry + */ +#define WL_REGISTRY_MAX_VERSION 1 + #define WL_REGISTRY_BIND 0 /** @@ -1175,6 +1185,11 @@ wl_callback_add_listener(struct wl_callback *wl_callback, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_callback + */ +#define WL_CALLBACK_MAX_VERSION 1 + /** * @ingroup iface_wl_callback */ @@ -1208,6 +1223,11 @@ wl_callback_destroy(struct wl_callback *wl_callback) wl_proxy_destroy((struct wl_proxy *) wl_callback); } +/** + * @ingroup iface_wl_compositor + */ +#define WL_COMPOSITOR_MAX_VERSION 4 + #define WL_COMPOSITOR_CREATE_SURFACE 0 #define WL_COMPOSITOR_CREATE_REGION 1 @@ -1280,6 +1300,11 @@ wl_compositor_create_region(struct wl_compositor *wl_compositor) return (struct wl_region *) id; } +/** + * @ingroup iface_wl_shm_pool + */ +#define WL_SHM_POOL_MAX_VERSION 1 + #define WL_SHM_POOL_CREATE_BUFFER 0 #define WL_SHM_POOL_DESTROY 1 #define WL_SHM_POOL_RESIZE 2 @@ -1679,6 +1704,11 @@ wl_shm_add_listener(struct wl_shm *wl_shm, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_shm + */ +#define WL_SHM_MAX_VERSION 1 + #define WL_SHM_CREATE_POOL 0 /** @@ -1774,6 +1804,11 @@ wl_buffer_add_listener(struct wl_buffer *wl_buffer, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_buffer + */ +#define WL_BUFFER_MAX_VERSION 1 + #define WL_BUFFER_DESTROY 0 /** @@ -1930,6 +1965,11 @@ wl_data_offer_add_listener(struct wl_data_offer *wl_data_offer, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_data_offer + */ +#define WL_DATA_OFFER_MAX_VERSION 3 + #define WL_DATA_OFFER_ACCEPT 0 #define WL_DATA_OFFER_RECEIVE 1 #define WL_DATA_OFFER_DESTROY 2 @@ -2266,6 +2306,11 @@ wl_data_source_add_listener(struct wl_data_source *wl_data_source, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_data_source + */ +#define WL_DATA_SOURCE_MAX_VERSION 3 + #define WL_DATA_SOURCE_OFFER 0 #define WL_DATA_SOURCE_DESTROY 1 #define WL_DATA_SOURCE_SET_ACTIONS 2 @@ -2503,6 +2548,11 @@ wl_data_device_add_listener(struct wl_data_device *wl_data_device, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_data_device + */ +#define WL_DATA_DEVICE_MAX_VERSION 3 + #define WL_DATA_DEVICE_START_DRAG 0 #define WL_DATA_DEVICE_SET_SELECTION 1 #define WL_DATA_DEVICE_RELEASE 2 @@ -2687,6 +2737,11 @@ enum wl_data_device_manager_dnd_action { }; #endif /* WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM */ +/** + * @ingroup iface_wl_data_device_manager + */ +#define WL_DATA_DEVICE_MANAGER_MAX_VERSION 3 + #define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE 0 #define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE 1 @@ -2769,6 +2824,11 @@ enum wl_shell_error { }; #endif /* WL_SHELL_ERROR_ENUM */ +/** + * @ingroup iface_wl_shell + */ +#define WL_SHELL_MAX_VERSION 1 + #define WL_SHELL_GET_SHELL_SURFACE 0 @@ -2988,6 +3048,11 @@ wl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_shell_surface + */ +#define WL_SHELL_SURFACE_MAX_VERSION 1 + #define WL_SHELL_SURFACE_PONG 0 #define WL_SHELL_SURFACE_MOVE 1 #define WL_SHELL_SURFACE_RESIZE 2 @@ -3358,6 +3423,11 @@ wl_surface_add_listener(struct wl_surface *wl_surface, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_surface + */ +#define WL_SURFACE_MAX_VERSION 4 + #define WL_SURFACE_DESTROY 0 #define WL_SURFACE_ATTACH 1 #define WL_SURFACE_DAMAGE 2 @@ -3881,6 +3951,11 @@ wl_seat_add_listener(struct wl_seat *wl_seat, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_seat + */ +#define WL_SEAT_MAX_VERSION 6 + #define WL_SEAT_GET_POINTER 0 #define WL_SEAT_GET_KEYBOARD 1 #define WL_SEAT_GET_TOUCH 2 @@ -4378,6 +4453,11 @@ wl_pointer_add_listener(struct wl_pointer *wl_pointer, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_pointer + */ +#define WL_POINTER_MAX_VERSION 6 + #define WL_POINTER_SET_CURSOR 0 #define WL_POINTER_RELEASE 1 @@ -4672,6 +4752,11 @@ wl_keyboard_add_listener(struct wl_keyboard *wl_keyboard, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_keyboard + */ +#define WL_KEYBOARD_MAX_VERSION 6 + #define WL_KEYBOARD_RELEASE 0 /** @@ -4910,6 +4995,11 @@ wl_touch_add_listener(struct wl_touch *wl_touch, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_touch + */ +#define WL_TOUCH_MAX_VERSION 6 + #define WL_TOUCH_RELEASE 0 /** @@ -5202,6 +5292,11 @@ wl_output_add_listener(struct wl_output *wl_output, (void (**)(void)) listener, data); } +/** + * @ingroup iface_wl_output + */ +#define WL_OUTPUT_MAX_VERSION 3 + #define WL_OUTPUT_RELEASE 0 /** @@ -5266,6 +5361,11 @@ wl_output_release(struct wl_output *wl_output) WL_OUTPUT_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_output), WL_MARSHAL_FLAG_DESTROY); } +/** + * @ingroup iface_wl_region + */ +#define WL_REGION_MAX_VERSION 1 + #define WL_REGION_DESTROY 0 #define WL_REGION_ADD 1 #define WL_REGION_SUBTRACT 2 @@ -5350,6 +5450,11 @@ enum wl_subcompositor_error { }; #endif /* WL_SUBCOMPOSITOR_ERROR_ENUM */ +/** + * @ingroup iface_wl_subcompositor + */ +#define WL_SUBCOMPOSITOR_MAX_VERSION 1 + #define WL_SUBCOMPOSITOR_DESTROY 0 #define WL_SUBCOMPOSITOR_GET_SUBSURFACE 1 @@ -5429,6 +5534,11 @@ enum wl_subsurface_error { }; #endif /* WL_SUBSURFACE_ERROR_ENUM */ +/** + * @ingroup iface_wl_subsurface + */ +#define WL_SUBSURFACE_MAX_VERSION 1 + #define WL_SUBSURFACE_DESTROY 0 #define WL_SUBSURFACE_SET_POSITION 1 #define WL_SUBSURFACE_PLACE_ABOVE 2 diff --git a/tests/data/example-server.h b/tests/data/example-server.h index 0ddc73db..64a7bf69 100644 --- a/tests/data/example-server.h +++ b/tests/data/example-server.h @@ -964,6 +964,11 @@ struct wl_display_interface { uint32_t registry); }; +/** + * @ingroup iface_wl_display + */ +#define WL_DISPLAY_MAX_VERSION 1 + #define WL_DISPLAY_ERROR 0 #define WL_DISPLAY_DELETE_ID 1 @@ -1006,6 +1011,11 @@ struct wl_registry_interface { const char *interface, uint32_t version, uint32_t id); }; +/** + * @ingroup iface_wl_registry + */ +#define WL_REGISTRY_MAX_VERSION 1 + #define WL_REGISTRY_GLOBAL 0 #define WL_REGISTRY_GLOBAL_REMOVE 1 @@ -1049,6 +1059,11 @@ wl_registry_send_global_remove(struct wl_resource *resource_, uint32_t name) wl_resource_post_event(resource_, WL_REGISTRY_GLOBAL_REMOVE, name); } +/** + * @ingroup iface_wl_callback + */ +#define WL_CALLBACK_MAX_VERSION 1 + #define WL_CALLBACK_DONE 0 /** @@ -1094,6 +1109,11 @@ struct wl_compositor_interface { uint32_t id); }; +/** + * @ingroup iface_wl_compositor + */ +#define WL_COMPOSITOR_MAX_VERSION 4 + /** * @ingroup iface_wl_compositor @@ -1162,6 +1182,11 @@ struct wl_shm_pool_interface { int32_t size); }; +/** + * @ingroup iface_wl_shm_pool + */ +#define WL_SHM_POOL_MAX_VERSION 1 + /** * @ingroup iface_wl_shm_pool @@ -1634,6 +1659,11 @@ struct wl_shm_interface { int32_t size); }; +/** + * @ingroup iface_wl_shm + */ +#define WL_SHM_MAX_VERSION 1 + #define WL_SHM_FORMAT 0 /** @@ -1675,6 +1705,11 @@ struct wl_buffer_interface { struct wl_resource *resource); }; +/** + * @ingroup iface_wl_buffer + */ +#define WL_BUFFER_MAX_VERSION 1 + #define WL_BUFFER_RELEASE 0 /** @@ -1870,6 +1905,11 @@ struct wl_data_offer_interface { uint32_t preferred_action); }; +/** + * @ingroup iface_wl_data_offer + */ +#define WL_DATA_OFFER_MAX_VERSION 3 + #define WL_DATA_OFFER_OFFER 0 #define WL_DATA_OFFER_SOURCE_ACTIONS 1 #define WL_DATA_OFFER_ACTION 2 @@ -2027,6 +2067,11 @@ struct wl_data_source_interface { uint32_t dnd_actions); }; +/** + * @ingroup iface_wl_data_source + */ +#define WL_DATA_SOURCE_MAX_VERSION 3 + #define WL_DATA_SOURCE_TARGET 0 #define WL_DATA_SOURCE_SEND 1 #define WL_DATA_SOURCE_CANCELLED 2 @@ -2242,6 +2287,11 @@ struct wl_data_device_interface { struct wl_resource *resource); }; +/** + * @ingroup iface_wl_data_device + */ +#define WL_DATA_DEVICE_MAX_VERSION 3 + #define WL_DATA_DEVICE_DATA_OFFER 0 #define WL_DATA_DEVICE_ENTER 1 #define WL_DATA_DEVICE_LEAVE 2 @@ -2464,6 +2514,11 @@ struct wl_data_device_manager_interface { struct wl_resource *seat); }; +/** + * @ingroup iface_wl_data_device_manager + */ +#define WL_DATA_DEVICE_MANAGER_MAX_VERSION 3 + /** * @ingroup iface_wl_data_device_manager @@ -2526,6 +2581,11 @@ struct wl_shell_interface { struct wl_resource *surface); }; +/** + * @ingroup iface_wl_shell + */ +#define WL_SHELL_MAX_VERSION 1 + /** * @ingroup iface_wl_shell @@ -2925,6 +2985,11 @@ struct wl_shell_surface_interface { const char *class_); }; +/** + * @ingroup iface_wl_shell_surface + */ +#define WL_SHELL_SURFACE_MAX_VERSION 1 + #define WL_SHELL_SURFACE_PING 0 #define WL_SHELL_SURFACE_CONFIGURE 1 #define WL_SHELL_SURFACE_POPUP_DONE 2 @@ -3419,6 +3484,11 @@ struct wl_surface_interface { int32_t height); }; +/** + * @ingroup iface_wl_surface + */ +#define WL_SURFACE_MAX_VERSION 4 + #define WL_SURFACE_ENTER 0 #define WL_SURFACE_LEAVE 1 @@ -3604,6 +3674,11 @@ struct wl_seat_interface { struct wl_resource *resource); }; +/** + * @ingroup iface_wl_seat + */ +#define WL_SEAT_MAX_VERSION 6 + #define WL_SEAT_CAPABILITIES 0 #define WL_SEAT_NAME 1 @@ -3910,6 +3985,11 @@ struct wl_pointer_interface { struct wl_resource *resource); }; +/** + * @ingroup iface_wl_pointer + */ +#define WL_POINTER_MAX_VERSION 6 + #define WL_POINTER_ENTER 0 #define WL_POINTER_LEAVE 1 #define WL_POINTER_MOTION 2 @@ -4186,6 +4266,11 @@ struct wl_keyboard_interface { struct wl_resource *resource); }; +/** + * @ingroup iface_wl_keyboard + */ +#define WL_KEYBOARD_MAX_VERSION 6 + #define WL_KEYBOARD_KEYMAP 0 #define WL_KEYBOARD_ENTER 1 #define WL_KEYBOARD_LEAVE 2 @@ -4323,6 +4408,11 @@ struct wl_touch_interface { struct wl_resource *resource); }; +/** + * @ingroup iface_wl_touch + */ +#define WL_TOUCH_MAX_VERSION 6 + #define WL_TOUCH_DOWN 0 #define WL_TOUCH_UP 1 #define WL_TOUCH_MOTION 2 @@ -4672,6 +4762,11 @@ struct wl_output_interface { struct wl_resource *resource); }; +/** + * @ingroup iface_wl_output + */ +#define WL_OUTPUT_MAX_VERSION 3 + #define WL_OUTPUT_GEOMETRY 0 #define WL_OUTPUT_MODE 1 #define WL_OUTPUT_DONE 2 @@ -4800,6 +4895,11 @@ struct wl_region_interface { int32_t height); }; +/** + * @ingroup iface_wl_region + */ +#define WL_REGION_MAX_VERSION 1 + /** * @ingroup iface_wl_region @@ -4879,6 +4979,11 @@ struct wl_subcompositor_interface { struct wl_resource *parent); }; +/** + * @ingroup iface_wl_subcompositor + */ +#define WL_SUBCOMPOSITOR_MAX_VERSION 1 + /** * @ingroup iface_wl_subcompositor @@ -5042,6 +5147,11 @@ struct wl_subsurface_interface { struct wl_resource *resource); }; +/** + * @ingroup iface_wl_subsurface + */ +#define WL_SUBSURFACE_MAX_VERSION 1 + /** * @ingroup iface_wl_subsurface diff --git a/tests/data/small-client-core.h b/tests/data/small-client-core.h index 03f889c8..1e0767bb 100644 --- a/tests/data/small-client-core.h +++ b/tests/data/small-client-core.h @@ -157,6 +157,11 @@ intf_A_add_listener(struct intf_A *intf_A, (void (**)(void)) listener, data); } +/** + * @ingroup iface_intf_A + */ +#define INTF_A_MAX_VERSION 3 + #define INTF_A_RQ1 0 #define INTF_A_RQ2 1 #define INTF_A_DESTROY 2 diff --git a/tests/data/small-client.h b/tests/data/small-client.h index 0d5b6055..a23bcb44 100644 --- a/tests/data/small-client.h +++ b/tests/data/small-client.h @@ -157,6 +157,11 @@ intf_A_add_listener(struct intf_A *intf_A, (void (**)(void)) listener, data); } +/** + * @ingroup iface_intf_A + */ +#define INTF_A_MAX_VERSION 3 + #define INTF_A_RQ1 0 #define INTF_A_RQ2 1 #define INTF_A_DESTROY 2 diff --git a/tests/data/small-server-core.h b/tests/data/small-server-core.h index 4248d455..40e41cf4 100644 --- a/tests/data/small-server-core.h +++ b/tests/data/small-server-core.h @@ -211,6 +211,11 @@ struct intf_A_interface { struct wl_resource *resource); }; +/** + * @ingroup iface_intf_A + */ +#define INTF_A_MAX_VERSION 3 + #define INTF_A_HEY 0 #define INTF_A_YO 1 diff --git a/tests/data/small-server.h b/tests/data/small-server.h index 743fc8d7..151589cc 100644 --- a/tests/data/small-server.h +++ b/tests/data/small-server.h @@ -211,6 +211,11 @@ struct intf_A_interface { struct wl_resource *resource); }; +/** + * @ingroup iface_intf_A + */ +#define INTF_A_MAX_VERSION 3 + #define INTF_A_HEY 0 #define INTF_A_YO 1