Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set the x,y coordinates of a window in Wayland?

Tags:

wayland

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

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);

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

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

like image 386
mpr Avatar asked Feb 25 '16 17:02

mpr


1 Answers

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.

I set default xy value and it works.

like image 193
Erwan Douaille Avatar answered Oct 22 '22 02:10

Erwan Douaille