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

mpr*_*mpr 9 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);
Run Code Online (Sandbox Code Playgroud)

代码运行没有错误但什么都不做.我正在使用Wayland和Weston的包裹运行Debian Jessie.

如果除此之外的其他方法xdg_shell可行,我全都耳朵.

Erw*_*lle 1

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

我设置了默认的 xy 值并且它有效。