本文介绍了如何在Wayland中设置窗口的x,y坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Apparently this is something that's not part of the core Wayland protocol, but I am using Weston and the xdg-shell extension appears to have the necessary method:

xdg_surface_set_window_geometry

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

So I ran wayland-scanner to create xdg code and header files:

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

我使用的代码大致如下:

The code I'm using is roughly as follows:

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.

The code runs without error but does nothing. I'm running on Debian Jessie with the stock Wayland and Weston packages.

如果除了xdg_shell之外还有其他可行的方法,我全神贯注.

If there are approaches other than xdg_shell that might work I'm all ears.

推荐答案

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

Not sure if it corresponds to your need, but in weston/desktop-shell/shell.c in weston_view_set_initial_position(...) there is a function used in it, named set_position.

我设置了默认的xy值,并且可以正常工作.

I set default xy value and it works.

这篇关于如何在Wayland中设置窗口的x,y坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 08:53