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>
Rework PangoCairo context initialisation, so we don't leak either the
Pango layout, or any of the derived objects it creates.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This doesn't actually fix a bug - cairo refcounts this. But I
really don't like the look of code that drops a reference then
continues to use it.
While we're here, set a different pattern when we're done so the
one we allocated loses its last reference.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The "sans" and "mono" aliases for "sans-serif" and "monospace" are
deprecated[1]. Let's standardize on the non-deprecated versions, which were
already in use in some places.
[1]: be453bd159/fonts.conf.in (L33-67)
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Fixes ASan reported leaks:
Direct leak of 256 byte(s) in 1 object(s) allocated from:
#0 0x7f8266f2d330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
#1 0x7f8266c8589a (/lib/x86_64-linux-gnu/libpixman-1.so.0+0x5089a)
#2 0x7f8266c4ea77 (/lib/x86_64-linux-gnu/libpixman-1.so.0+0x19a77)
#3 0x55fa7818f8e8 in load_png ../../git/weston/shared/image-loader.c:297
#4 0x55fa7819039e in load_image ../../git/weston/shared/image-loader.c:423
#5 0x55fa78187b3e in load_cairo_surface ../../git/weston/shared/cairo-util.c:354
#6 0x55fa7815ff8a in background_draw ../../git/weston/clients/desktop-shell.c:779
#7 0x55fa7817b2c2 in widget_redraw ../../git/weston/clients/window.c:4520
#8 0x55fa7817b831 in surface_redraw ../../git/weston/clients/window.c:4578
#9 0x55fa7817b9a7 in idle_redraw ../../git/weston/clients/window.c:4607
#10 0x55fa78184ea4 in display_run ../../git/weston/clients/window.c:6527
#11 0x55fa781646fb in main ../../git/weston/clients/desktop-shell.c:1556
#12 0x7f826659709a in __libc_start_main ../csu/libc-start.c:308
#13 0x55fa7815c0a9 in _start (/home/pq/build/weston-meson/clients/weston-desktop-shell+0x120a9)
Indirect leak of 8024 byte(s) in 1 object(s) allocated from:
#0 0x7f8266f2d330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
#1 0x55fa7818f5e7 in load_png ../../git/weston/shared/image-loader.c:275
#2 0x55fa7819039e in load_image ../../git/weston/shared/image-loader.c:423
#3 0x55fa78187b3e in load_cairo_surface ../../git/weston/shared/cairo-util.c:354
#4 0x55fa7815ff8a in background_draw ../../git/weston/clients/desktop-shell.c:779
#5 0x55fa7817b2c2 in widget_redraw ../../git/weston/clients/window.c:4520
#6 0x55fa7817b831 in surface_redraw ../../git/weston/clients/window.c:4578
#7 0x55fa7817b9a7 in idle_redraw ../../git/weston/clients/window.c:4607
#8 0x55fa78184ea4 in display_run ../../git/weston/clients/window.c:6527
#9 0x55fa781646fb in main ../../git/weston/clients/desktop-shell.c:1556
#10 0x7f826659709a in __libc_start_main ../csu/libc-start.c:308
#11 0x55fa7815c0a9 in _start (/home/pq/build/weston-meson/clients/weston-desktop-shell+0x120a9)
from the command
ASAN_OPTIONS=fast_unwind_on_malloc=0,malloc_context_size=50 \
LSAN_OPTIONS=suppressions=/home/pq/git/weston/.gitlab-ci/leak-sanitizer.supp \
./tests/test-viewporter test_viewporter_bad_source_rect
by recording the pixman image as user data so it can be freed when the
surface is destroyed.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
It is a public installed header used by libweston.h.
See "Rename compositor.h to libweston/libweston.h" for rationale.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
If buttons list isn't empty and title is NULL, SEGV is occured in
pango_layout_set_text(). This patch fixes this problem.
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
If Weston is built with Pango, use it to render the title for
X11 applications and Weston toy toolkit clients. It allows us
to ellipsize the title when there isn't enough space to show the
whole string.
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
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>
To help reduce code duplication and also 'kitchen-sink' includes
the ARRAY_LENGTH macro was moved to a stand-alone file and
referenced from the sources consuming it. Other macros will be
added in subsequent passes.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
If the client is small (< 128 pixels in any ward),
then the shadows overlap and create dark lines behind clients.
This is a problem mosly with pop-up menues. The lines become observable
when the menu has less than three items. The other case is when
the client doesn't restrict its size when resizing (try
'weston-eventdemo --max-width=1 --max-height=1' for example)
This fixes a part of the bug:
https://bugs.freedesktop.org/show_bug.cgi?id=78511
v2:
- rework computing of the size of corners
- rewrite some comments
- rename tile_mask to render_shadow (in separate patch)
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
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>
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system. This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.
Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries. This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
[pq: rebased and converted more files]
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.
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.