[PATCH weston 17/17] xwayland: Fix window positioning

Bill Spitzak spitzak at gmail.com
Fri Nov 30 16:01:07 PST 2012

Tiago Vignatti wrote:

> The approach used here shows a weakness of the Weston WM-as-client
> architecture: one cannot guarantee that the X11 stream needed to create
> windows with its right position will happen before Weston maps the surface,
> via Wayland. IOW we'd like always ConfigureNotify with the coordinates coming
> and only then Wayland compositor could map the surface:
>     1. xwm: gets XCB_CREATE_NOTIFY (via X11)
>     2. xwm: gets XCB_CONFIGURE_NOTIFY (via X11)
>     3. weston: gets correct position (wm_get_window, via Wayland)
>     4. weston: maps the surface (xserver_get_window_surface, via X11)
> but it was happening:
>     1. xwm: gets XCB_CREATE_NOTIFY (via X11)
>     2. weston: maps w/ wrong position (xserver_get_window_surface, via X11)
>     3. xwm: gets XCB_CONFIGURE_NOTIFY (via X11)
>     4. weston: gets outdated position (wm_get_window, via Wayland)

How come the compositor knows anything about a window before the xserver 
has decided to really physically map it (not the map override, but the 
real map)? It would seem that if it did not hear anything until after 
xwm got the XCB_CONFIGURE_NOTIFY there would be no synchronization 
problem and no need for the extra messages you are proposing adding.

I may be missing a reason weston has to know the window exists before it 
is mapped. A *buffer* may be allocated, but I don't see a weston surface 
needing to exist at all.

> This patch brings back a feature we removed previously (#3 window positioning,
> 2aee1248) and also put the X Windows in their global position (for instance,
> now xeyes works like expected and also menu windows are shifted correctly
> regarding output's dimensions).

I need to repeat my concern that X clients are "privileged" to get and 
set this information but normal clients are not. For software that is 
portable to Windows and OS/X this is a very strong incentive to work 
around Wayland by either using X or by a hack to extract the information 
from the xwm api, since we need to make portable saved window layouts, 
and those other systems store window positions as x,y integer pairs in 
global coordinates.

More information about the wayland-devel mailing list