Pango, Cairo, and fontconfig, all want to leave thread-global data
hanging around in order to maintain a cache. Try to clean up as much of
it as we possibly can on exit, apart from the Pango language string
which appears to be unfreeable, so has been added to LSan suppressions.
Signed-off-by: Daniel Stone <daniels@collabora.com>
We need these values to calculate frame extents to properly set
_NET_FRAME_EXTENTS, but we don't want to calculate them twice.
Break out these bits from frame_resize_inside, and update it to use
the new function.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The cairo surface used for the icon must be completely given to the
frame as soon as said frame has been created. To prevent both the
window and the frame from sharing ownership of the icon, we set
window->icon_surface back to NULL right after creating or changing the
frame, only keeping it there when no frame has been created yet.
Fixes https://lists.freedesktop.org/archives/wayland-devel/2018-January/036655.html
Reported-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
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.
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
The title in X11 windows and Wayland application using Weston toy
toolkit were placing the title in a very naive fashion. It was
only try to center the string in the title bar. This patch:
* Makes sure the title isn't renderer underneath buttons;
* Move the title to the left if the titlebar isn't large enough;
* Clip the end of the title if needed.
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This silences two warnings:
clients/window.c:2450:20: warning: implicit conversion from enumeration
type 'enum wl_pointer_button_state' to different enumeration type 'enum
frame_button_state' [-Wenum-conversion]
button, state);
^~~~~
clients/window.c:2453:15: warning: implicit conversion from enumeration
type 'enum wl_pointer_button_state' to different enumeration type 'enum
frame_button_state' [-Wenum-conversion]
button, state);
^~~~~
Warning produced by Clang 3.8.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
I'll be using this in a follow up patch that adds touch input to weston's
wayland backend.
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
This function is used and clearly designed only for drawing the shadows.
Rename it so that it has name after what it does and also move some
common code into the function.
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Previously geometry was changed to leave space for titlebar if a frame
has only buttons but no title. This patch fixes theme_render_frame to
avoid transparent titlebar.
Signed-off-by: Boyan Ding <stu_dby@126.com>
This is used to figure out the size of "invisible" decorations, which we'll
use to better know the visible extents of the surface, which we can use for
constraining, titlebars, and more.
This makes button handling more correct concerning drags. Also,
frame_pointer_button returns the original button location in the case of a
release. This makes filtering of button events much easier for users of
the cair-util frame code.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Before, cairo-util.h would combine pixman and cairo includes. X11 and
Wayland compositors uses this to load an image as a pixman_image_t but are
forced to include cairo headers. Clients use load_cairo_surface to
load images as cairo_surface_t's, but are forced to include pixman.h.
We move the load_image pixman prototype to its own header, so compositors
can get at the pixman prototype without including cairo.h and clients
can include the cairo based function without including pixman.h.
Fix the following build warnings, and the build failures due to the
warning fixes:
CC libshared_cairo_la-image-loader.lo
image-loader.c:369:1: warning: no previous prototype for 'load_image'
CC x11_backend_la-compositor-x11.lo
compositor-x11.c: In function 'x11_output_set_icon':
compositor-x11.c:396:2: warning: implicit declaration of function 'load_image'
compositor-x11.c:396:8: warning: assignment makes pointer from integer without a cast
CC wayland_backend_la-compositor-wayland.lo
compositor-wayland.c: In function 'create_border':
compositor-wayland.c:97:2: warning: implicit declaration of function 'load_image'
compositor-wayland.c:97:8: warning: assignment makes pointer from integer without a cast
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
We were pulling in cairo and the image loading libraries through libshared.
Split out libshared into a core libshared and a libshared-cairo that
pulls in the extra libraries.
Add THEME_FRAME_MAXIMIZED flag so the theming system can know not to draw
shadows for maximized windows. This allows maximized surfaces' content to be
sized and placed in a more expectable fashion.