How to set x, y coordinates of a window in Wayland?

Apparently this is something that is not part of Wayland's main protocol, but I'm using Weston, and the xdg-shell extension seems to be necessary:

xdg_surface_set_window_geometry

So, I ran wayland-scanner to create the 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 use looks something like this:

 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 works without errors, but does nothing. I work on Debian Jessie with the Wayland and Weston packages.

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

+8
wayland
source share
2 answers

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

I set xy to default and it works.

+2
source share

With some help from the Wayland / Weston forums, I made a workaround that set my> windows to full-screen output sizes with a transparent background, and then shifted my> content to full screen. Wayland APIs are simply not designed for this kind of application level control.

How does this happen? Would you share the code?

0
source share

All Articles