diff options
author | Manuel Stoeckl <code@mstoeckl.com> | 2023-03-29 18:59:58 -0400 |
---|---|---|
committer | Manuel Stoeckl <code@mstoeckl.com> | 2023-03-29 19:08:26 -0400 |
commit | aba20719cc4661b59e86020a1ec8a6ee37a35c24 (patch) | |
tree | ec059f24f5900aa615ca7edbd0c4d2f01b1266fb | |
parent | c31b65770cea2084cb50593f6a85fb21ef9f22f2 (diff) |
Update core Wayland protocol file and shm formats
Note: the version with updated shm formats has not yet been
released, but as updates to the wl_shm format list just pull
values from libdrm, it is very unlikely that libwayland will
conflict.
-rw-r--r-- | protocols/wayland.xml | 223 | ||||
-rw-r--r-- | src/handlers.c | 22 |
2 files changed, 207 insertions, 38 deletions
diff --git a/protocols/wayland.xml b/protocols/wayland.xml index 784d971..a7def4d 100644 --- a/protocols/wayland.xml +++ b/protocols/wayland.xml @@ -177,6 +177,9 @@ <description summary="callback object"> Clients can handle the 'done' event to get notified when the related request is done. + + Note, because wl_callback objects are created from multiple independent + factory interfaces, the wl_callback interface is frozen at version 1. </description> <event name="done" type="destructor"> @@ -187,7 +190,7 @@ </event> </interface> - <interface name="wl_compositor" version="5"> + <interface name="wl_compositor" version="6"> <description summary="the compositor singleton"> A compositor. This object is a singleton global. The compositor is in charge of combining the contents of multiple @@ -258,6 +261,12 @@ for the pool from the file descriptor passed when the pool was created, but using the new size. This request can only be used to make the pool bigger. + + This request only changes the amount of bytes that are mmapped + by the server and does not touch the file corresponding to the + file descriptor passed at creation time. It is the client's + responsibility to ensure that the file is at least as big as + the new pool size. </description> <arg name="size" type="int" summary="new size of the pool, in bytes"/> </request> @@ -271,8 +280,8 @@ Clients can create wl_shm_pool objects using the create_pool request. - At connection setup time, the wl_shm object emits one or more - format events to inform clients about the valid pixel formats + On binding the wl_shm object one or more format events + are emitted to inform clients about the valid pixel formats that can be used for buffers. </description> @@ -410,6 +419,21 @@ <entry name="xbgr16161616" value="0x38344258" summary="[63:0] x:B:G:R 16:16:16:16 little endian"/> <entry name="argb16161616" value="0x38345241" summary="[63:0] A:R:G:B 16:16:16:16 little endian"/> <entry name="abgr16161616" value="0x38344241" summary="[63:0] A:B:G:R 16:16:16:16 little endian"/> + <entry name="c1" value="0x20203143" summary="[7:0] C0:C1:C2:C3:C4:C5:C6:C7 1:1:1:1:1:1:1:1 eight pixels/byte"/> + <entry name="c2" value="0x20203243" summary="[7:0] C0:C1:C2:C3 2:2:2:2 four pixels/byte"/> + <entry name="c4" value="0x20203443" summary="[7:0] C0:C1 4:4 two pixels/byte"/> + <entry name="d1" value="0x20203144" summary="[7:0] D0:D1:D2:D3:D4:D5:D6:D7 1:1:1:1:1:1:1:1 eight pixels/byte"/> + <entry name="d2" value="0x20203244" summary="[7:0] D0:D1:D2:D3 2:2:2:2 four pixels/byte"/> + <entry name="d4" value="0x20203444" summary="[7:0] D0:D1 4:4 two pixels/byte"/> + <entry name="d8" value="0x20203844" summary="[7:0] D"/> + <entry name="r1" value="0x20203152" summary="[7:0] R0:R1:R2:R3:R4:R5:R6:R7 1:1:1:1:1:1:1:1 eight pixels/byte"/> + <entry name="r2" value="0x20203252" summary="[7:0] R0:R1:R2:R3 2:2:2:2 four pixels/byte"/> + <entry name="r4" value="0x20203452" summary="[7:0] R0:R1 4:4 two pixels/byte"/> + <entry name="r10" value="0x20303152" summary="[15:0] x:R 6:10 little endian"/> + <entry name="r12" value="0x20323152" summary="[15:0] x:R 4:12 little endian"/> + <entry name="avuy8888" value="0x59555641" summary="[31:0] A:Cr:Cb:Y 8:8:8:8 little endian"/> + <entry name="xvuy8888" value="0x59555658" summary="[31:0] X:Cr:Cb:Y 8:8:8:8 little endian"/> + <entry name="p030" value="0x30333050" summary="2x2 subsampled Cr:Cb plane 10 bits per channel packed"/> </enum> <request name="create_pool"> @@ -447,6 +471,9 @@ If the buffer uses a format that has an alpha channel, the alpha channel is assumed to be premultiplied in the color channels unless otherwise specified. + + Note, because wl_buffer objects are created from multiple independent + factory interfaces, the wl_buffer interface is frozen at version 1. </description> <request name="destroy" type="destructor"> @@ -618,8 +645,9 @@ <event name="source_actions" since="3"> <description summary="notify the source-side available actions"> This event indicates the actions offered by the data source. It - will be sent right after wl_data_device.enter, or anytime the source - side changes its offered actions through wl_data_source.set_actions. + will be sent immediately after creating the wl_data_offer object, + or anytime the source side changes its offered actions through + wl_data_source.set_actions. </description> <arg name="source_actions" type="uint" summary="actions offered by the data source" enum="wl_data_device_manager.dnd_action"/> @@ -861,11 +889,8 @@ a drag-and-drop icon. If the icon surface already has another role, it raises a protocol error. - The current and pending input regions of the icon wl_surface are - cleared, and wl_surface.set_input_region is ignored until the - wl_surface is no longer used as the icon surface. When the use - as an icon ends, the current and pending input regions become - undefined, and the wl_surface is unmapped. + The input region is ignored for wl_surfaces with the role of a + drag-and-drop icon. </description> <arg name="source" type="object" interface="wl_data_source" allow-null="true" summary="data source for the eventual transfer"/> <arg name="origin" type="object" interface="wl_surface" summary="surface where the drag originates"/> @@ -890,7 +915,7 @@ which will subsequently be used in either the data_device.enter event (for drag-and-drop) or the data_device.selection event (for selections). Immediately - following the data_device_data_offer event, the new data_offer + following the data_device.data_offer event, the new data_offer object will send out data_offer.offer events to describe the mime types it offers. </description> @@ -1051,7 +1076,8 @@ a basic surface. Note! This protocol is deprecated and not intended for production use. - For desktop-style user interfaces, use xdg_shell. + For desktop-style user interfaces, use xdg_shell. Compositors and clients + should not implement this interface. </description> <enum name="error"> @@ -1345,7 +1371,7 @@ </event> </interface> - <interface name="wl_surface" version="5"> + <interface name="wl_surface" version="6"> <description summary="an onscreen surface"> A surface is a rectangular area that may be displayed on zero or more outputs, and shown any number of times at the compositor's @@ -1377,8 +1403,9 @@ that this request gives a role to a wl_surface. Often, this request also creates a new protocol object that represents the role and adds additional functionality to wl_surface. When a - client wants to destroy a wl_surface, they must destroy this 'role - object' before the wl_surface. + client wants to destroy a wl_surface, they must destroy this role + object before the wl_surface, otherwise a defunct_role_object error is + sent. Destroying the role object does not remove the role from the wl_surface, but it may stop the wl_surface from "playing the role". @@ -1398,6 +1425,8 @@ <entry name="invalid_transform" value="1" summary="buffer transform value is invalid"/> <entry name="invalid_size" value="2" summary="buffer size is invalid"/> <entry name="invalid_offset" value="3" summary="buffer offset is invalid"/> + <entry name="defunct_role_object" value="4" + summary="surface was destroyed before its role object"/> </enum> <request name="destroy" type="destructor"> @@ -1426,8 +1455,9 @@ When the bound wl_surface version is 5 or higher, passing any non-zero x or y is a protocol violation, and will result in an - 'invalid_offset' error being raised. To achieve equivalent semantics, - use wl_surface.offset. + 'invalid_offset' error being raised. The x and y arguments are ignored + and do not change the pending state. To achieve equivalent semantics, + use wl_surface.offset. Surface contents are double-buffered state, see wl_surface.commit. @@ -1779,9 +1809,37 @@ <arg name="x" type="int" summary="surface-local x coordinate"/> <arg name="y" type="int" summary="surface-local y coordinate"/> </request> + + <!-- Version 6 additions --> + + <event name="preferred_buffer_scale" since="6"> + <description summary="preferred buffer scale for the surface"> + This event indicates the preferred buffer scale for this surface. It is + sent whenever the compositor's preference changes. + + It is intended that scaling aware clients use this event to scale their + content and use wl_surface.set_buffer_scale to indicate the scale they + have rendered with. This allows clients to supply a higher detail + buffer. + </description> + <arg name="factor" type="int" summary="preferred scaling factor"/> + </event> + + <event name="preferred_buffer_transform" since="6"> + <description summary="preferred buffer transform for the surface"> + This event indicates the preferred buffer transform for this surface. + It is sent whenever the compositor's preference changes. + + It is intended that transform aware clients use this event to apply the + transform to their content and use wl_surface.set_buffer_transform to + indicate the transform they have rendered with. + </description> + <arg name="transform" type="uint" enum="wl_output.transform" + summary="preferred transform"/> + </event> </interface> - <interface name="wl_seat" version="7"> + <interface name="wl_seat" version="9"> <description summary="group of input devices"> 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 @@ -1914,7 +1972,7 @@ </interface> - <interface name="wl_pointer" version="7"> + <interface name="wl_pointer" version="9"> <description summary="pointer input device"> The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -1958,11 +2016,9 @@ pointer surface to this request with new values for hotspot_x and hotspot_y. - The current and pending input regions of the wl_surface are - cleared, and wl_surface.set_input_region is ignored until the - wl_surface is no longer used as the cursor. When the use as a - cursor ends, the current and pending input regions become - undefined, and the wl_surface is unmapped. + The input region is ignored for wl_surfaces with the role of + a cursor. When the use as a cursor ends, the wl_surface is + unmapped. The serial parameter must match the latest wl_pointer.enter serial number sent to the client. Otherwise the request will be @@ -2214,6 +2270,9 @@ This event carries the axis value of the wl_pointer.axis event in discrete steps (e.g. mouse wheel clicks). + This event is deprecated with wl_pointer version 8 - this event is not + sent to clients supporting version 8 or later. + This event does not occur on its own, it is coupled with a wl_pointer.axis event that represents this axis value on a continuous scale. The protocol guarantees that each axis_discrete @@ -2221,7 +2280,8 @@ axis number within the same wl_pointer.frame. Note that the protocol allows for other events to occur between the axis_discrete and its coupled axis event, including other axis_discrete or axis - events. + events. A wl_pointer.frame must not contain more than one axis_discrete + event per axis type. This event is optional; continuous scrolling devices like two-finger scrolling on touchpads do not have discrete @@ -2239,9 +2299,93 @@ <arg name="axis" type="uint" enum="axis" summary="axis type"/> <arg name="discrete" type="int" summary="number of steps"/> </event> + + <event name="axis_value120" since="8"> + <description summary="axis high-resolution scroll event"> + Discrete high-resolution scroll information. + + This event carries high-resolution wheel scroll information, + with each multiple of 120 representing one logical scroll step + (a wheel detent). For example, an axis_value120 of 30 is one quarter of + a logical scroll step in the positive direction, a value120 of + -240 are two logical scroll steps in the negative direction within the + same hardware event. + Clients that rely on discrete scrolling should accumulate the + value120 to multiples of 120 before processing the event. + + The value120 must not be zero. + + This event replaces the wl_pointer.axis_discrete event in clients + supporting wl_pointer version 8 or later. + + Where a wl_pointer.axis_source event occurs in the same + wl_pointer.frame, the axis source applies to this event. + + The order of wl_pointer.axis_value120 and wl_pointer.axis_source is + not guaranteed. + </description> + <arg name="axis" type="uint" enum="axis" summary="axis type"/> + <arg name="value120" type="int" summary="scroll distance as fraction of 120"/> + </event> + + <!-- Version 9 additions --> + + <enum name="axis_relative_direction"> + <description summary="axis relative direction"> + This specifies the direction of the physical motion that caused a + wl_pointer.axis event, relative to the wl_pointer.axis direction. + </description> + <entry name="identical" value="0" + summary="physical motion matches axis direction"/> + <entry name="inverted" value="1" + summary="physical motion is the inverse of the axis direction"/> + </enum> + + <event name="axis_relative_direction" since="9"> + <description summary="axis relative physical direction event"> + Relative directional information of the entity causing the axis + motion. + + For a wl_pointer.axis event, the wl_pointer.axis_relative_direction + event specifies the movement direction of the entity causing the + wl_pointer.axis event. For example: + - if a user's fingers on a touchpad move down and this + causes a wl_pointer.axis vertical_scroll down event, the physical + direction is 'identical' + - if a user's fingers on a touchpad move down and this causes a + wl_pointer.axis vertical_scroll up scroll up event ('natural + scrolling'), the physical direction is 'inverted'. + + A client may use this information to adjust scroll motion of + components. Specifically, enabling natural scrolling causes the + content to change direction compared to traditional scrolling. + Some widgets like volume control sliders should usually match the + physical direction regardless of whether natural scrolling is + active. This event enables clients to match the scroll direction of + a widget to the physical direction. + + This event does not occur on its own, it is coupled with a + wl_pointer.axis event that represents this axis value. + The protocol guarantees that each axis_relative_direction event is + always followed by exactly one axis event with the same + axis number within the same wl_pointer.frame. Note that the protocol + allows for other events to occur between the axis_relative_direction + and its coupled axis event. + + The axis number is identical to the axis number in the associated + axis event. + + The order of wl_pointer.axis_relative_direction, + wl_pointer.axis_discrete and wl_pointer.axis_source is not + guaranteed. + </description> + <arg name="axis" type="uint" enum="axis" summary="axis type"/> + <arg name="direction" type="uint" enum="axis_relative_direction" + summary="physical direction relative to axis motion"/> + </event> </interface> - <interface name="wl_keyboard" version="7"> + <interface name="wl_keyboard" version="9"> <description summary="keyboard input device"> The wl_keyboard interface represents one or more keyboards associated with a seat. @@ -2255,7 +2399,7 @@ <entry name="no_keymap" value="0" summary="no keymap; client must understand how to interpret the raw keycode"/> <entry name="xkb_v1" value="1" - summary="libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode"/> + summary="libxkbcommon compatible, null-terminated string; to determine the xkb keycode, clients must add 8 to the key event keycode"/> </enum> <event name="keymap"> @@ -2368,7 +2512,7 @@ </event> </interface> - <interface name="wl_touch" version="7"> + <interface name="wl_touch" version="9"> <description summary="touchscreen input device"> The wl_touch interface represents a touchscreen associated with a seat. @@ -2822,6 +2966,8 @@ <enum name="error"> <entry name="bad_surface" value="0" summary="the to-be sub-surface is invalid"/> + <entry name="bad_parent" value="1" + summary="the to-be sub-surface parent is invalid"/> </enum> <request name="get_subsurface"> @@ -2831,14 +2977,18 @@ plain wl_surface into a sub-surface. The to-be sub-surface must not already have another role, and it - must not have an existing wl_subsurface object. Otherwise a protocol - error is raised. + must not have an existing wl_subsurface object. Otherwise the + bad_surface protocol error is raised. Adding sub-surfaces to a parent is a double-buffered operation on the parent (see wl_surface.commit). The effect of adding a sub-surface becomes visible on the next time the state of the parent surface is applied. + The parent surface must not be one of the child surface's descendants, + and the parent must be different from the child surface, otherwise the + bad_parent protocol error is raised. + This request modifies the behaviour of wl_surface.commit request on the sub-surface, see the documentation on wl_subsurface interface. </description> @@ -2893,12 +3043,10 @@ synchronized mode, and then assume that all its child and grand-child sub-surfaces are synchronized, too, without explicitly setting them. - If the wl_surface associated with the wl_subsurface is destroyed, the - wl_subsurface object becomes inert. Note, that destroying either object - takes effect immediately. If you need to synchronize the removal - of a sub-surface to the parent surface update, unmap the sub-surface - first by attaching a NULL wl_buffer, update parent, and then destroy - the sub-surface. + Destroying a sub-surface takes effect immediately. If you need to + synchronize the removal of a sub-surface to the parent surface update, + unmap the sub-surface first by attaching a NULL wl_buffer, update parent, + and then destroy the sub-surface. If the parent wl_surface object is destroyed, the sub-surface is unmapped. @@ -2909,8 +3057,7 @@ The sub-surface interface is removed from the wl_surface object that was turned into a sub-surface with a wl_subcompositor.get_subsurface request. The wl_surface's association - to the parent is deleted, and the wl_surface loses its role as - a sub-surface. The wl_surface is unmapped immediately. + to the parent is deleted. The wl_surface is unmapped immediately. </description> </request> diff --git a/src/handlers.c b/src/handlers.c index 6c789ee..9c32a92 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -618,6 +618,28 @@ int get_shm_bytes_per_pixel(uint32_t format) case WL_SHM_FORMAT_ARGB16161616: case WL_SHM_FORMAT_ABGR16161616: return 8; + // todo: adjust API to handle bit packed formats + case WL_SHM_FORMAT_C1: + case WL_SHM_FORMAT_C2: + case WL_SHM_FORMAT_C4: + case WL_SHM_FORMAT_D1: + case WL_SHM_FORMAT_D2: + case WL_SHM_FORMAT_D4: + goto planar; + case WL_SHM_FORMAT_D8: + return 1; + case WL_SHM_FORMAT_R1: + case WL_SHM_FORMAT_R2: + case WL_SHM_FORMAT_R4: + goto planar; + case WL_SHM_FORMAT_R10: + case WL_SHM_FORMAT_R12: + return 2; + case WL_SHM_FORMAT_AVUY8888: + case WL_SHM_FORMAT_XVUY8888: + return 4; + case WL_SHM_FORMAT_P030: + goto planar; default: wp_error("Unidentified WL_SHM format %x", format); return -1; |