xwm: Add icon support to the frame

Graphics / Wayland / Weston - Emmanuel Gil Peyrot [linkmauve.fr] - 18 January 2018 12:24 EST

This fetches the _NET_WM_ICON property of the X11 window, and use the first image found as the frame icon.

This has been tested with various X11 programs, and improves usability and user-friendliness a bit.

Changes since v1:- Changed frame_button_create() to use frame_button_create_from_surface() internally.
- Removed a check that should never have been commited.

Changes since v2:- Request UINT32_MAX items instead of 2048, to avoid cutting valid icons.
- Strengthen checks against malformed input.
- Handle XCB_PROPERTY_DELETE to remove the icon.
- Schedule a repaint if the icon changed.

Changes since v3:- Keep the previous Cairo surface until the new one has been successfully loaded.- Use uint32_t for cardinals. Unsigned is the same type except on 16-bit machines, but uint32_t is clearer.
- Declare length as uint32_t too, like in xcb_get_property_reply_t.

6b58ea8c xwm: Add icon support to the frame
clients/window.c | 4 +--
libweston/compositor-wayland.c | 2 +-
shared/cairo-util.h | 2 +-
shared/frame.c | 54 ++++++++++++++++++++++++++---------
xwayland/window-manager.c | 65 ++++++++++++++++++++++++++++++++++++++++--
5 files changed, 107 insertions(+), 20 deletions(-)

Upstream: cgit.freedesktop.org


  • Share