From 493eda337ae7cc5530c23833f91f1738690d7ba3 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 24 Jan 2017 09:56:36 +1000 Subject: [PATCH] tests: sync example.xml with wayland.xml These are the protocol.xml changes from: 66a26aeb2a: protocol: Remove inconsistent line breaks a26ed0949e: protocol: indentation fixes 6a18a87727: protocol: Extend wl_touch with touchpoint shape and orientation and a few other, smaller ones. Signed-off-by: Peter Hutterer Reviewed-by: Daniel Stone Reviewed-by: Yong Bakos Tested-by: Yong Bakos Reviewed-by: Pekka Paalanen --- tests/data/example-client.h | 112 +++++++++++++++++++-- tests/data/example-code.c | 12 ++- tests/data/example-server.h | 51 ++++++++-- tests/data/example.xml | 231 ++++++++++++++++++++++++++------------------ 4 files changed, 294 insertions(+), 112 deletions(-) diff --git a/tests/data/example-client.h b/tests/data/example-client.h index b2bb24e..857aacf 100644 --- a/tests/data/example-client.h +++ b/tests/data/example-client.h @@ -108,8 +108,8 @@ extern const struct wl_interface wl_display_interface; * @page page_iface_wl_registry wl_registry * @section page_iface_wl_registry_desc Description * - * The global registry object. The server has a number of global - * objects that are available to all clients. These objects + * The singleton global registry object. The server has a number of + * global objects that are available to all clients. These objects * typically represent an actual object in the server (for example, * an input device) or they are singleton objects that provide * extension functionality. @@ -134,8 +134,8 @@ extern const struct wl_interface wl_display_interface; /** * @defgroup iface_wl_registry The wl_registry interface * - * The global registry object. The server has a number of global - * objects that are available to all clients. These objects + * The singleton global registry object. The server has a number of + * global objects that are available to all clients. These objects * typically represent an actual object in the server (for example, * an input device) or they are singleton objects that provide * extension functionality. @@ -220,7 +220,7 @@ extern const struct wl_interface wl_shm_pool_interface; * @page page_iface_wl_shm wl_shm * @section page_iface_wl_shm_desc Description * - * A global singleton object that provides support for shared + * A singleton global object that provides support for shared * memory. * * Clients can create wl_shm_pool objects using the create_pool @@ -235,7 +235,7 @@ extern const struct wl_interface wl_shm_pool_interface; /** * @defgroup iface_wl_shm The wl_shm interface * - * A global singleton object that provides support for shared + * A singleton global object that provides support for shared * memory. * * Clients can create wl_shm_pool objects using the create_pool @@ -4038,7 +4038,7 @@ enum wl_pointer_axis { */ enum wl_pointer_axis_source { /** - * a physical wheel + * a physical wheel rotation */ WL_POINTER_AXIS_SOURCE_WHEEL = 0, /** @@ -4115,6 +4115,14 @@ struct wl_pointer_listener { * The location of the click is given by the last motion or enter * event. The time argument is a timestamp with millisecond * granularity, with an undefined base. + * + * The button is a button code as defined in the Linux kernel's + * linux/input-event-codes.h header file, e.g. BTN_LEFT. + * + * Any 16-bit button code value is reserved for future additions to + * the kernel's event code list. All other button codes above + * 0xFFFF are currently undefined but may be used in future + * versions of this protocol. * @param serial serial number of the button event * @param time timestamp with millisecond granularity * @param button button that produced the event @@ -4731,7 +4739,14 @@ struct wl_touch_listener { /** * end of touch frame event * - * Indicates the end of a contact point list. + * Indicates the end of a set of events that logically belong + * together. A client is expected to accumulate the data in all + * events within the frame before proceeding. + * + * A wl_touch.frame terminates at least one event but otherwise no + * guarantee is provided about the set of events within a frame. A + * client must assume that any state not updated in a frame is + * unchanged from the previously known state. */ void (*frame)(void *data, struct wl_touch *wl_touch); @@ -4747,6 +4762,79 @@ struct wl_touch_listener { */ void (*cancel)(void *data, struct wl_touch *wl_touch); + /** + * update shape of touch point + * + * Sent when a touchpoint has changed its shape. + * + * This event does not occur on its own. It is sent before a + * wl_touch.frame event and carries the new shape information for + * any previously reported, or new touch points of that frame. + * + * Other events describing the touch point such as wl_touch.down, + * wl_touch.motion or wl_touch.orientation may be sent within the + * same wl_touch.frame. A client should treat these events as a + * single logical touch point update. The order of wl_touch.shape, + * wl_touch.orientation and wl_touch.motion is not guaranteed. A + * wl_touch.down event is guaranteed to occur before the first + * wl_touch.shape event for this touch ID but both events may occur + * within the same wl_touch.frame. + * + * A touchpoint shape is approximated by an ellipse through the + * major and minor axis length. The major axis length describes the + * longer diameter of the ellipse, while the minor axis length + * describes the shorter diameter. Major and minor are orthogonal + * and both are specified in surface-local coordinates. The center + * of the ellipse is always at the touchpoint location as reported + * by wl_touch.down or wl_touch.move. + * + * This event is only sent by the compositor if the touch device + * supports shape reports. The client has to make reasonable + * assumptions about the shape if it did not receive this event. + * @param id the unique ID of this touch point + * @param major length of the major axis in surface-local coordinates + * @param minor length of the minor axis in surface-local coordinates + * @since 6 + */ + void (*shape)(void *data, + struct wl_touch *wl_touch, + int32_t id, + wl_fixed_t major, + wl_fixed_t minor); + /** + * update orientation of touch point + * + * Sent when a touchpoint has changed its orientation. + * + * This event does not occur on its own. It is sent before a + * wl_touch.frame event and carries the new shape information for + * any previously reported, or new touch points of that frame. + * + * Other events describing the touch point such as wl_touch.down, + * wl_touch.motion or wl_touch.shape may be sent within the same + * wl_touch.frame. A client should treat these events as a single + * logical touch point update. The order of wl_touch.shape, + * wl_touch.orientation and wl_touch.motion is not guaranteed. A + * wl_touch.down event is guaranteed to occur before the first + * wl_touch.orientation event for this touch ID but both events may + * occur within the same wl_touch.frame. + * + * The orientation describes the clockwise angle of a touchpoint's + * major axis to the positive surface y-axis and is normalized to + * the -180 to +180 degree range. The granularity of orientation + * depends on the touch device, some devices only support binary + * rotation values between 0 and 90 degrees. + * + * This event is only sent by the compositor if the touch device + * supports orientation reports. + * @param id the unique ID of this touch point + * @param orientation angle between major axis and positive surface y-axis in degrees + * @since 6 + */ + void (*orientation)(void *data, + struct wl_touch *wl_touch, + int32_t id, + wl_fixed_t orientation); }; /** @@ -4782,6 +4870,14 @@ wl_touch_add_listener(struct wl_touch *wl_touch, * @ingroup iface_wl_touch */ #define WL_TOUCH_CANCEL_SINCE_VERSION 1 +/** + * @ingroup iface_wl_touch + */ +#define WL_TOUCH_SHAPE_SINCE_VERSION 6 +/** + * @ingroup iface_wl_touch + */ +#define WL_TOUCH_ORIENTATION_SINCE_VERSION 6 /** * @ingroup iface_wl_touch diff --git a/tests/data/example-code.c b/tests/data/example-code.c index 7dea253..bc03fe5 100644 --- a/tests/data/example-code.c +++ b/tests/data/example-code.c @@ -383,7 +383,7 @@ static const struct wl_message wl_seat_events[] = { }; WL_EXPORT const struct wl_interface wl_seat_interface = { - "wl_seat", 5, + "wl_seat", 6, 4, wl_seat_requests, 2, wl_seat_events, }; @@ -406,7 +406,7 @@ static const struct wl_message wl_pointer_events[] = { }; WL_EXPORT const struct wl_interface wl_pointer_interface = { - "wl_pointer", 5, + "wl_pointer", 6, 2, wl_pointer_requests, 9, wl_pointer_events, }; @@ -425,7 +425,7 @@ static const struct wl_message wl_keyboard_events[] = { }; WL_EXPORT const struct wl_interface wl_keyboard_interface = { - "wl_keyboard", 5, + "wl_keyboard", 6, 1, wl_keyboard_requests, 6, wl_keyboard_events, }; @@ -440,12 +440,14 @@ static const struct wl_message wl_touch_events[] = { { "motion", "uiff", types + 0 }, { "frame", "", types + 0 }, { "cancel", "", types + 0 }, + { "shape", "6iff", types + 0 }, + { "orientation", "6if", types + 0 }, }; WL_EXPORT const struct wl_interface wl_touch_interface = { - "wl_touch", 5, + "wl_touch", 6, 1, wl_touch_requests, - 5, wl_touch_events, + 7, wl_touch_events, }; static const struct wl_message wl_output_requests[] = { diff --git a/tests/data/example-server.h b/tests/data/example-server.h index 22550f6..f22f70f 100644 --- a/tests/data/example-server.h +++ b/tests/data/example-server.h @@ -111,8 +111,8 @@ extern const struct wl_interface wl_display_interface; * @page page_iface_wl_registry wl_registry * @section page_iface_wl_registry_desc Description * - * The global registry object. The server has a number of global - * objects that are available to all clients. These objects + * The singleton global registry object. The server has a number of + * global objects that are available to all clients. These objects * typically represent an actual object in the server (for example, * an input device) or they are singleton objects that provide * extension functionality. @@ -137,8 +137,8 @@ extern const struct wl_interface wl_display_interface; /** * @defgroup iface_wl_registry The wl_registry interface * - * The global registry object. The server has a number of global - * objects that are available to all clients. These objects + * The singleton global registry object. The server has a number of + * global objects that are available to all clients. These objects * typically represent an actual object in the server (for example, * an input device) or they are singleton objects that provide * extension functionality. @@ -223,7 +223,7 @@ extern const struct wl_interface wl_shm_pool_interface; * @page page_iface_wl_shm wl_shm * @section page_iface_wl_shm_desc Description * - * A global singleton object that provides support for shared + * A singleton global object that provides support for shared * memory. * * Clients can create wl_shm_pool objects using the create_pool @@ -238,7 +238,7 @@ extern const struct wl_interface wl_shm_pool_interface; /** * @defgroup iface_wl_shm The wl_shm interface * - * A global singleton object that provides support for shared + * A singleton global object that provides support for shared * memory. * * Clients can create wl_shm_pool objects using the create_pool @@ -3247,7 +3247,7 @@ enum wl_pointer_axis { */ enum wl_pointer_axis_source { /** - * a physical wheel + * a physical wheel rotation */ WL_POINTER_AXIS_SOURCE_WHEEL = 0, /** @@ -3699,6 +3699,8 @@ struct wl_touch_interface { #define WL_TOUCH_MOTION 2 #define WL_TOUCH_FRAME 3 #define WL_TOUCH_CANCEL 4 +#define WL_TOUCH_SHAPE 5 +#define WL_TOUCH_ORIENTATION 6 /** * @ingroup iface_wl_touch @@ -3720,6 +3722,14 @@ struct wl_touch_interface { * @ingroup iface_wl_touch */ #define WL_TOUCH_CANCEL_SINCE_VERSION 1 +/** + * @ingroup iface_wl_touch + */ +#define WL_TOUCH_SHAPE_SINCE_VERSION 6 +/** + * @ingroup iface_wl_touch + */ +#define WL_TOUCH_ORIENTATION_SINCE_VERSION 6 /** * @ingroup iface_wl_touch @@ -3794,6 +3804,33 @@ wl_touch_send_cancel(struct wl_resource *resource_) wl_resource_post_event(resource_, WL_TOUCH_CANCEL); } +/** + * @ingroup iface_wl_touch + * Sends an shape event to the client owning the resource. + * @param resource_ The client's resource + * @param id the unique ID of this touch point + * @param major length of the major axis in surface-local coordinates + * @param minor length of the minor axis in surface-local coordinates + */ +static inline void +wl_touch_send_shape(struct wl_resource *resource_, int32_t id, wl_fixed_t major, wl_fixed_t minor) +{ + wl_resource_post_event(resource_, WL_TOUCH_SHAPE, id, major, minor); +} + +/** + * @ingroup iface_wl_touch + * Sends an orientation event to the client owning the resource. + * @param resource_ The client's resource + * @param id the unique ID of this touch point + * @param orientation angle between major axis and positive surface y-axis in degrees + */ +static inline void +wl_touch_send_orientation(struct wl_resource *resource_, int32_t id, wl_fixed_t orientation) +{ + wl_resource_post_event(resource_, WL_TOUCH_ORIENTATION, id, orientation); +} + #ifndef WL_OUTPUT_SUBPIXEL_ENUM #define WL_OUTPUT_SUBPIXEL_ENUM /** diff --git a/tests/data/example.xml b/tests/data/example.xml index 6c6d078..22dcffd 100644 --- a/tests/data/example.xml +++ b/tests/data/example.xml @@ -104,8 +104,8 @@ - The global registry object. The server has a number of global - objects that are available to all clients. These objects + The singleton global registry object. The server has a number of + global objects that are available to all clients. These objects typically represent an actual object in the server (for example, an input device) or they are singleton objects that provide extension functionality. @@ -129,7 +129,7 @@ Binds a new, client-created object to the server using the - specified name as the identifier. + specified name as the identifier. @@ -139,9 +139,9 @@ Notify the client of global objects. - The event notifies the client that a global object with - the given name is now available, and it implements the - given version of the given interface. + The event notifies the client that a global object with + the given name is now available, and it implements the + given version of the given interface. @@ -152,10 +152,10 @@ Notify the client of removed global objects. - This event notifies the client that the global identified - by name is no longer available. If the client bound to - the global using the bind request, the client should now - destroy that object. + This event notifies the client that the global identified + by name is no longer available. If the client bound to + the global using the bind request, the client should now + destroy that object. The object remains valid and requests to the object will be ignored until the client destroys it, to avoid races between @@ -226,7 +226,6 @@ so it is valid to destroy the pool immediately after creating a buffer from it. - @@ -252,14 +251,13 @@ created, but using the new size. This request can only be used to make the pool bigger. - - A global singleton object that provides support for shared + A singleton global object that provides support for shared memory. Clients can create wl_shm_pool objects using the create_pool @@ -357,9 +355,8 @@ The pool can be used to create shared memory based buffer objects. The server will mmap size bytes of the passed file - descriptor, to use as backing memory for the pool. + descriptor, to use as backing memory for the pool. - @@ -449,7 +446,6 @@ wl_data_source.cancelled. Clients may still use this event in conjunction with wl_data_source.action for feedback. - @@ -487,7 +483,6 @@ Sent immediately after creating the wl_data_offer object. One event per offered mime type. - @@ -635,7 +630,6 @@ Used for feedback during drag-and-drop. - @@ -645,7 +639,6 @@ specified mime type over the passed file descriptor, then close it. - @@ -823,7 +816,6 @@ object will send out data_offer.offer events to describe the mime types it offers. - @@ -834,7 +826,6 @@ enter time is provided by the x and y arguments, in surface-local coordinates. - @@ -924,14 +915,14 @@ - Create a new data source. + Create a new data source. - Create a new data device for a given seat. + Create a new data device for a given seat. @@ -1090,7 +1081,6 @@ The flags argument controls details of the transient behaviour. - @@ -1173,7 +1163,6 @@ corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates. - @@ -1260,7 +1249,6 @@ The width and height arguments specify the size of the window in surface-local coordinates. - @@ -1320,7 +1308,7 @@ - These errors can be emitted in response to wl_surface requests. + These errors can be emitted in response to wl_surface requests. @@ -1374,7 +1362,6 @@ If wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. - @@ -1405,7 +1392,6 @@ which uses buffer coordinates instead of surface coordinates, and is probably the preferred and intuitive way of doing this. - @@ -1447,7 +1433,6 @@ The callback_data passed in the callback is the current time, in milliseconds, with an undefined base. - @@ -1478,7 +1463,6 @@ destroyed immediately. A NULL wl_region causes the pending opaque region to be set to empty. - @@ -1508,7 +1492,6 @@ immediately. A NULL wl_region causes the input region to be set to infinite. - @@ -1661,7 +1644,6 @@ two requests separately and only transform from one to the other after receiving the wl_surface.commit. - @@ -1669,7 +1651,7 @@ - + A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1679,8 +1661,8 @@ - This is a bitmask of capabilities this seat has; if a member is - set, then it is present on the seat. + This is a bitmask of capabilities this seat has; if a member is + set, then it is present on the seat. @@ -1778,7 +1760,7 @@ - + The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -1828,7 +1810,6 @@ cursor ends, the current and pending input regions become undefined, and the wl_surface is unmapped. - @@ -1845,7 +1826,6 @@ is undefined and a client should respond to this event by setting an appropriate pointer image with the set_cursor request. - @@ -1870,7 +1850,6 @@ surface_x and surface_y are the location relative to the focused surface. - @@ -1878,7 +1857,7 @@ - Describes the physical state of a button that produced the button + Describes the physical state of a button that produced the button event. @@ -1891,10 +1870,17 @@ The location of the click is given by the last motion or enter event. - The time argument is a timestamp with millisecond - granularity, with an undefined base. - + The time argument is a timestamp with millisecond + granularity, with an undefined base. + + The button is a button code as defined in the Linux kernel's + linux/input-event-codes.h header file, e.g. BTN_LEFT. + Any 16-bit button code value is reserved for future additions to the + kernel's event code list. All other button codes above 0xFFFF are + currently undefined but may be used in future versions of this + protocol. + @@ -1928,7 +1914,6 @@ When applicable, a client can transform its content relative to the scroll distance. - @@ -2002,7 +1987,7 @@ the vertical motion of a device is converted to scroll events while a button is held down. - + @@ -2092,7 +2077,7 @@ - + The wl_keyboard interface represents one or more keyboards associated with a seat. @@ -2106,7 +2091,7 @@ + summary="libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode"/> @@ -2152,10 +2137,9 @@ A key was pressed or released. - The time argument is a timestamp with millisecond - granularity, with an undefined base. + The time argument is a timestamp with millisecond + granularity, with an undefined base. - @@ -2167,7 +2151,6 @@ Notifies clients that the modifier and/or group state has changed, and it should update its local state. - @@ -2185,28 +2168,27 @@ - Informs the client about the keyboard's repeat rate and delay. + Informs the client about the keyboard's repeat rate and delay. - This event is sent as soon as the wl_keyboard object has been created, - and is guaranteed to be received by the client before any key press - event. + This event is sent as soon as the wl_keyboard object has been created, + and is guaranteed to be received by the client before any key press + event. - Negative values for either rate or delay are illegal. A rate of zero - will disable any repeating (regardless of the value of delay). + Negative values for either rate or delay are illegal. A rate of zero + will disable any repeating (regardless of the value of delay). - This event can be sent later on as well with a new value if necessary, - so clients should continue listening for the event past the creation - of wl_keyboard. + This event can be sent later on as well with a new value if necessary, + so clients should continue listening for the event past the creation + of wl_keyboard. - + summary="the rate of repeating keys in characters per second"/> + summary="delay in milliseconds since key down until repeating starts"/> - + The wl_touch interface represents a touchscreen associated with a seat. @@ -2256,7 +2238,14 @@ - Indicates the end of a contact point list. + Indicates the end of a set of events that logically belong together. + A client is expected to accumulate the data in all events within the + frame before proceeding. + + A wl_touch.frame terminates at least one event but otherwise no + guarantee is provided about the set of events within a frame. A client + must assume that any state not updated in a frame is unchanged from the + previously known state. @@ -2276,6 +2265,71 @@ + + + + + + Sent when a touchpoint has changed its shape. + + This event does not occur on its own. It is sent before a + wl_touch.frame event and carries the new shape information for + any previously reported, or new touch points of that frame. + + Other events describing the touch point such as wl_touch.down, + wl_touch.motion or wl_touch.orientation may be sent within the + same wl_touch.frame. A client should treat these events as a single + logical touch point update. The order of wl_touch.shape, + wl_touch.orientation and wl_touch.motion is not guaranteed. + A wl_touch.down event is guaranteed to occur before the first + wl_touch.shape event for this touch ID but both events may occur within + the same wl_touch.frame. + + A touchpoint shape is approximated by an ellipse through the major and + minor axis length. The major axis length describes the longer diameter + of the ellipse, while the minor axis length describes the shorter + diameter. Major and minor are orthogonal and both are specified in + surface-local coordinates. The center of the ellipse is always at the + touchpoint location as reported by wl_touch.down or wl_touch.move. + + This event is only sent by the compositor if the touch device supports + shape reports. The client has to make reasonable assumptions about the + shape if it did not receive this event. + + + + + + + + + Sent when a touchpoint has changed its orientation. + + This event does not occur on its own. It is sent before a + wl_touch.frame event and carries the new shape information for + any previously reported, or new touch points of that frame. + + Other events describing the touch point such as wl_touch.down, + wl_touch.motion or wl_touch.shape may be sent within the + same wl_touch.frame. A client should treat these events as a single + logical touch point update. The order of wl_touch.shape, + wl_touch.orientation and wl_touch.motion is not guaranteed. + A wl_touch.down event is guaranteed to occur before the first + wl_touch.orientation event for this touch ID but both events may occur + within the same wl_touch.frame. + + The orientation describes the clockwise angle of a touchpoint's major + axis to the positive surface y-axis and is normalized to the -180 to + +180 degree range. The granularity of orientation depends on the touch + device, some devices only support binary rotation values between 0 and + 90 degrees. + + This event is only sent by the compositor if the touch device supports + orientation reports. + + + + @@ -2315,7 +2369,6 @@ compositor will still be able to scan out directly from client surfaces. - @@ -2372,10 +2425,10 @@ mode that was received with the current flag set. The size of a mode is given in physical hardware units of - the output device. This is not necessarily the same as - the output size in the global compositor space. For instance, - the output may be scaled, as described in wl_output.scale, - or transformed, as described in wl_output.transform. + the output device. This is not necessarily the same as + the output size in the global compositor space. For instance, + the output may be scaled, as described in wl_output.scale, + or transformed, as described in wl_output.transform. @@ -2387,20 +2440,20 @@ - This event is sent after all other properties have been - sent after binding to the output object and after any - other property changes done after that. This allows - changes to the output properties to be seen as - atomic, even if they happen via multiple events. + This event is sent after all other properties have been + sent after binding to the output object and after any + other property changes done after that. This allows + changes to the output properties to be seen as + atomic, even if they happen via multiple events. This event contains scaling geometry information - that is not in the geometry event. It may be sent after - binding the output object or if the output scale changes - later. If it is not sent, the client should assume a + that is not in the geometry event. It may be sent after + binding the output object or if the output scale changes + later. If it is not sent, the client should assume a scale of 1. A scale larger than 1 means that the compositor will @@ -2447,7 +2500,6 @@ Add the specified rectangle to the region. - @@ -2458,7 +2510,6 @@ Subtract the specified rectangle from the region. - @@ -2499,7 +2550,7 @@ + summary="the to-be sub-surface is invalid"/> @@ -2512,13 +2563,12 @@ must not have an existing wl_subsurface object. Otherwise a protocol error is raised. - + summary="the new sub-surface object ID"/> + summary="the surface to be turned into a sub-surface"/> + summary="the parent surface"/> @@ -2587,7 +2637,7 @@ + summary="wl_surface is not a sibling or the parent"/> @@ -2609,7 +2659,6 @@ The initial position is 0, 0. - @@ -2632,9 +2681,8 @@ A new sub-surface is initially added as the top-most in the stack of its siblings and parent. - + summary="the reference surface"/> @@ -2642,9 +2690,8 @@ The sub-surface is placed just below the reference surface. See wl_subsurface.place_above. - + summary="the reference surface"/> -- 2.7.4