Skip to content
  • Pekka Paalanen's avatar
    xwayland: use _XWAYLAND_ALLOW_COMMITS property · 9f4d308c
    Pekka Paalanen authored and Adam Jackson's avatar Adam Jackson committed
    The X11 window manager (XWM) of a Wayland compositor can use the
    _XWAYLAND_ALLOW_COMMITS property to control when Xwayland sends
    wl_surface.commit requests. If the property is not set, the behaviour
    remains what it was.
    
    XWM uses the property to inhibit commits until the window is ready to be
    shown. This gives XWM time to set up the window decorations and internal
    state before Xwayland does the first commit. XWM can use this to ensure
    the first commit carries fully drawn decorations and the window
    management state is correct when the window becomes visible.
    
    Setting the property to zero inhibits further commits, and setting it to
    non-zero allows commits. Deleting the property allows commits.
    
    When the property is changed from zero to non-zero, there will be a
    commit on next block_handler() call provided that some damage has been
    recorded.
    
    Without this patch (i.e. with the old behaviour) Xwayland can and will
    commit the surface very soon as the application window has been realized
    and drawn into.  This races with XWM and may cause visible glitches.
    
    v3:
    - introduced a simple setter for xwl_window::allow_commits
    - split xwl_window_property_allow_commits() out of
      xwl_property_callback()
    - check MakeAtom(_XWAYLAND_ALLOW_COMMITS)
    
    v2:
    - use PropertyStateCallback instead of XACE, based on the patch
      "xwayland: Track per-window support for netwm frame sync" by
      Adam Jackson
    - check property type is XA_CARDINAL
    - drop a useless memcpy()
    
    Weston Bug: https://phabricator.freedesktop.org/T7622
    
    
    Reviewed-by: default avatarAdam Jackson <ajax@redhat.com>
    Signed-off-by: default avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
    9f4d308c