Content type hint
此接口允许客户端描述 surface 将显示的内容种类,以允许 compositor 为其优化行为。
警告!此文件中描述的协议目前处于测试阶段。向后兼容的更改可能会与相应的接口版本增加一起添加。向后不兼容的更改只能通过创建扩展的新主版本来完成。
get_surface_content_type(id: new_id<wp_content_type_v1>, surface: object<wl_surface>)
参数 | 类型 | 描述 |
|---|---|---|
| id | new_id<wp_content_type_v1> | |
| surface | object<wl_surface> |
创建与给定 surface 关联的新内容类型对象。
从已附加内容类型对象的 wl_surface 创建 wp_content_type_v1 会导致客户端错误:already_constructed。
error { already_constructed }
参数 | 值 | 描述 |
|---|---|---|
| already_constructed | 0 | wl_surface 已经拥有内容类型对象 |
内容类型对象允许 compositor 针对 surface 上显示的内容类型进行优化。例如,compositor 可以使用它来设置相关的 drm 属性(如“内容类型”)。
客户端可以随时请求切换到另一种内容类型。 当关联的 surface 被销毁时,此对象将变得无效,客户端应将其销毁。
destroy()
切换回未指定此 surface 的内容类型。这等效于将内容类型设置为 none,包括双缓冲语义。有关详细信息,请参阅 set_content_type。
set_content_type(content_type: uint<wp_content_type_v1.type>)
参数 | 类型 | 描述 |
|---|---|---|
| content_type | uint<wp_content_type_v1.type> | the content type |
设置 surface 内容类型。这会通知 compositor 客户端认为它正在显示匹配此内容类型的 buffer。
这纯粹是为 compositor 提供的一个提示,可用于调整其行为或硬件设置,以最适合所呈现的内容。
内容类型是双缓冲状态,有关详细信息,请参阅 wl_surface.commit。
合成器支持
Cage | COSMIC | GameScope | Hyprland | Jay | KWin | Labwc | Louvre | Mir | Muffin | Mutter | niri | phoc | river | Sway | Treeland | Wayfire | Weston | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wp_content_type_manager_v1 | x | x | x | 1 | 1 | 1 | x | 1 | x | x | x | x | x | x | 1 | x | x | x |
Copyright
Copyright © 2021 Emmanuel Gil Peyrot Copyright © 2022 Xaver Hugl
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.