display:weston的client端绘画[subsurface,fullscreen]

weston的源代码里面有关于client的绘画例子

建议追踪https://github.com/wayland-project/weston/blob/master/clients/

增加一种功能的操作例子shm.c[增加subsurface支持]

需要注意的是:
weston 本身来说并不支持surface去指定自己在屏幕上的位置。那如果我们希望固定surface的位置,我们需要绘画一个full-screen的主surface+subsurface,这样我们就一个固定subsurface的位置;
切记要用full-screen,而不是自己去确认屏幕的分辨率,不然多个不一样分辨率的情况,你无法确认主surface的大小。
另外一般来说你可以绘画一个透明的主surface,一般是在设置

                ret = create_shm_buffer(window->display, buffer,
                                        window->width, window->height,
-                                       WL_SHM_FORMAT_XRGB8888);
+                                       WL_SHM_FORMAT_ARGB8888);

当然也可以调用gl-api去实现。

struct display {
	struct wl_display *display;
	struct wl_registry *registry;
	struct wl_compositor *compositor;
#if 1
	struct wl_subcompositor *subcompositor;
#endif
	struct zxdg_shell_v6 *shell;
	struct zwp_fullscreen_shell_v1 *fshell;
	struct wl_shm *shm;
	bool has_xrgb;
	struct ivi_application *ivi_application;
};

struct window {
	struct display *display;
	int width, height;
	struct wl_surface *surface;
#if 1
	struct wl_surface *main_surface;
	struct wl_subsurface *subsurface;

	struct wl_surface *main1_surface;
	struct wl_subsurface *subsurface1;
#endif
	struct zxdg_surface_v6 *xdg_surface;
	struct zxdg_toplevel_v6 *xdg_toplevel;
	struct ivi_surface *ivi_surface;
	struct buffer buffers[4];
	struct buffer *prev_buffer;
	struct wl_callback *callback;
	bool wait_for_configure;
};


static struct window *
create_window(struct display *display, int width, int height)
{
	struct window *window;
#if 1
    struct wl_subcompositor *subcompo = display->subcompositor;
#endif

	window = zalloc(sizeof *window);
	if (!window)
		return NULL;

	window->callback = NULL;
	window->display = display;
	window->width = width;
	window->height = height;
    window->surface = wl_compositor_create_surface(display->compositor);
#if 1
	window->main_surface = wl_compositor_create_surface(display->compositor);
	window->subsurface = wl_subcompositor_get_subsurface(subcompo, window->main_surface, window->surface)
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值