struct wl_buffer;
struct wl_callback;
struct wl_compositor;
struct wl_data_device;
struct wl_data_device_manager;
struct wl_data_offer;
struct wl_data_source;
struct wl_display;
struct wl_keyboard;
struct wl_output;
struct wl_pointer;
struct wl_region;
struct wl_registry;
struct wl_seat;
struct wl_shell;
struct wl_shell_surface;
struct wl_shm;
struct wl_shm_pool;
struct wl_subcompositor;
struct wl_subsurface;
struct wl_surface;
struct wl_touch;
其中除wl_display,其余全部只是声明,没有实际结构。
除wl_display外其他结构体都是由wl_proxy转换生成,或者说都是wl_proxy。
以下为各个结构体来源介绍除wl_display外,其他结构体最终均定位到
wl_proxy_marshal_flags-->wl_proxy_marshal_array_flags如有兴趣,以下总结可以看下。
注:有3个暂未找到来源。
1.struct wl_display; 核心全局对象
wayland-client-core.h
struct wl_display {
struct wl_proxy proxy;
struct wl_connection *connection;
int last_error;
struct {
uint32_t code;
const struct wl_interface *interface;
uint32_t id;
} protocol_error;
int fd;
struct wl_map objects;
struct wl_event_queue display_queue;
struct wl_event_queue default_queue;
pthread_mutex_t mutex;
int reader_count;
uint32_t read_serial;
pthread_cond_t reader_cond;
};
2.struct wl_registry; 全局注册对象
生成方式:
(simple-shm.c 等所有客户端程序)
display->registry = wl_display_get_registry(display->display);
最终实现:
wl_display_get_registry (wayland-client-protocol.h)
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
3.struct wl_callback; 回调对象
生成方式:
callback = wl_display_sync(client->wl_display);
最终实现:
wl_display_sync
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
4.struct wl_compositor; 合成器单例
生成方式:
d->compositor = wl_registry_bind(registry,id, &wl_compositor_interface, 1);
最终实现:
wl_registry_bind
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
5.struct wl_shm_pool; 共享内存池
生成方式:
(simple-shm.c 等所有客户端程序)
pool = wl_shm_create_pool(display->shm, fd, size);
最终实现:
wl_shm_create_pool
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
6. struct wl_shm; 共享内存支持
生成方式:
(simple-shm.c 等所有客户端程序)
d->shm = wl_registry_bind(registry,id, &wl_shm_interface, 1);
最终实现:
wl_registry_bind
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
7.struct wl_buffer; wl_surface的内容
生成方式:
(window.c)
data->buffer = wl_shm_pool_create_buffer(pool->pool, offset,
rectangle->width,
rectangle->height,
stride, format);
最终实现:
wl_shm_pool_create_buffer
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
8.struct wl_data_offer; 提供传输数据
没找到
9.struct wl_data_source; 提供传输数据
没找到
10.struct wl_data_device; 数据传输设备
生成方式:
(window.c)
input->data_device =
wl_data_device_manager_get_data_device(d->data_device_manager,
input->seat);
最终实现:
wl_data_device_manager_get_data_device
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
11.struct wl_data_device_manager; 数据传输接口
生成方式:
d->data_device_manager = wl_registry_bind(d->registry, id,
&wl_data_device_manager_interface,
d->data_device_manager_version);
最终实现:
wl_registry_bind
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
12.struct wl_shell; 创建桌面样式的surface
没找到
13.struct wl_shell_surface; 桌面样式元数据界面
生成方式:
static inline struct wl_shell_surface *
wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface)
{
struct wl_proxy *id;
id = wl_proxy_marshal_flags((struct wl_proxy *) wl_shell,
WL_SHELL_GET_SHELL_SURFACE, &wl_shell_surface_interface,
wl_proxy_get_version((struct wl_proxy *) wl_shell), 0, NULL, surface);
return (struct wl_shell_surface *) id;
}
最终实现:
(暂未发现调用位置)
wl_shell_get_shell_surface
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
14.struct wl_surface; 屏幕surface
生成方式:
(simple-touch.c等)
window->surface = wl_compositor_create_surface(display->compositor);
最终实现:
wl_compositor_create_surface
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
15.struct wl_seat; 输入设备组
生成方式:
(simple-touch.c等)
seat->seat = wl_registry_bind(touch->registry, name,
&wl_seat_interface, 1);
最终实现:
wl_registry_bind
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
16.struct wl_pointer; 指针输入设备
生成方式:
(simple-egl.c等)
d->pointer = wl_seat_get_pointer(seat);
最终实现:
wl_seat_get_pointer
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
17.struct wl_keyboard; 键盘输入设备
生成方式:
(multi-resource.c)
device->p.keyboard = wl_seat_get_keyboard(display->seat);
最终实现:
wl_seat_get_keyboard
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
18.struct wl_touch; 触摸屏输入设备
生成方式:
(simple-touch.c等)
seat->wl_touch = wl_seat_get_touch(wl_seat);
最终实现:
wl_seat_get_touch
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
19.struct wl_output; 合成器输出区域
生成方式:
output->output = display_bind(desktop->display, id, &wl_output_interface, 2);
最终实现:
display_bind
-->wl_registry_bind
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
20.struct wl_region; 区域界面
生成方式:
region = wl_compositor_create_region(window->display->compositor);
最终实现:
wl_compositor_create_region
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
21.struct wl_subcompositor; 子表面合成
生成方式:
(window.c)
d->subcompositor =wl_registry_bind(registry, id,&wl_subcompositor_interface, 1);
最终实现:
wl_registry_bind
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)
22.wl_subsurface wl_surface的子表面
生成方式:
surface->subsurface = wl_subcompositor_get_subsurface(subcompo,surface->surface,parent);
最终实现:
wl_subcompositor_get_subsurface
-->wl_proxy_marshal_flags (wayland-client-core.h)
-->wl_proxy_marshal_array_flags (wayland-client-core.h)