如何在Wayland中设置窗口的x,y坐标?

时间:2016-02-25 17:09:58

标签: wayland

显然,这不是Wayland核心协议的一部分,但我使用的是Weston,xdg-shell扩展似乎有必要的方法:

xdg_surface_set_window_geometry

所以我运行wayland-scanner来创建xdg代码和头文件:

wayland-scanner code < ./weston-1.6.0/protocol/xdg-shell.xml > xdg_shell.c

wayland-scanner client-header < ./weston-1.6.0/protocol/xdg-shell.xml > xdg_shell.h

我使用的代码大致如下:

surface = wl_compositor_create_surface(compositor);
if(surface == NULL) {
    ...
}

native_window = wl_egl_window_create(surface, some_width, some_height);
if(native_window == NULL) {
    ...
}

_xdg_surface  = xdg_shell_get_xdg_surface(_xdg_shell, surface);

xdg_surface_set_window_geometry(_xdg_surface, 0, 0, some_width, some_height);

代码运行没有错误但什么也没做。我正在使用Wayland和Weston股票包装在Debian Jessie上运行。

如果xdg_shell以外的其他方法可能有用,我会全神贯顺。

1 个答案:

答案 0 :(得分:2)

不确定它是否符合您的需要,但在weston_view_set_initial_position(...)中的weston / desktop-shell / shell.c中有一个函数,名为set_position。

我设置了默认的xy值,它可以工作。

相关问题