Commit Graph

10 Commits

Author SHA1 Message Date
Pekka Paalanen
e2583ca084 libweston-desktop: add weston_desktop_xwayland_fini()
This fixes the following leaks detected by ASan in
./tests/test-alpha-blending:

Direct leak of 176 byte(s) in 2 object(s) allocated from:
    #0 0x7fb447880518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7fb4432c12d7 in zalloc ../../git/weston/include/libweston/zalloc.h:38
    #2 0x7fb4432c2ca6 in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:410
    #3 0x7fb4432baadf in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87
    #4 0x7fb4432e1e1f in wet_shell_init ../../git/weston/tests/weston-test-desktop-shell.c:224
    #5 0x7fb44775fddd in wet_load_shell ../../git/weston/compositor/main.c:956
    #6 0x7fb447770db1 in wet_main ../../git/weston/compositor/main.c:3434
    #7 0x56172c599279 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
    #8 0x56172c59cce5 in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
    #9 0x56172c58dc8c in fixture_setup ../../git/weston/tests/alpha-blending-test.c:65
    #10 0x56172c58dd31 in fixture_setup_run_ ../../git/weston/tests/alpha-blending-test.c:67
    #11 0x56172c59d29a in main ../../git/weston/tests/weston-test-runner.c:661
    #12 0x7fb4473d509a in __libc_start_main ../csu/libc-start.c:308

Indirect leak of 144 byte(s) in 2 object(s) allocated from:
    #0 0x7fb447880518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7fb4432bb592 in zalloc ../../git/weston/include/libweston/zalloc.h:38
    #2 0x7fb4432bb882 in weston_desktop_client_create ../../git/weston/libweston-desktop/client.c:108
    #3 0x7fb4432c2d0e in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:415
    #4 0x7fb4432baadf in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87
    #5 0x7fb4432e1e1f in wet_shell_init ../../git/weston/tests/weston-test-desktop-shell.c:224
    #6 0x7fb44775fddd in wet_load_shell ../../git/weston/compositor/main.c:956
    #7 0x7fb447770db1 in wet_main ../../git/weston/compositor/main.c:3434
    #8 0x56172c599279 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
    #9 0x56172c59cce5 in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
    #10 0x56172c58dc8c in fixture_setup ../../git/weston/tests/alpha-blending-test.c:65
    #11 0x56172c58dd31 in fixture_setup_run_ ../../git/weston/tests/alpha-blending-test.c:67
    #12 0x56172c59d29a in main ../../git/weston/tests/weston-test-runner.c:661
    #13 0x7fb4473d509a in __libc_start_main ../csu/libc-start.c:308

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
f53c05d3c2 libweston-desktop: introduce weston_desktop_client_destroy()
This new function is callable explicitly, unlike the old function that
used to have the same name.

This will be needed when tearing down what
weston_desktop_xwayland_init() puts up.

Since calling weston_desktop_client_destroy() for an external client
(one that has a wl_resource for this) is a bug, add asserts to prevent
it. This will only be needed for the internal client: XWM.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
3d5d9476e3 Rename compositor.h to libweston/libweston.h
The main idea is to make libweston users use the form

 #include <libweston/libweston.h>

instead of the plain

 #include <compositor.h>

which is prone to name conflicts. This is reflected both in the installed
files, and the internal header search paths so that Weston would use the exact
same form as an external project using libweston would.

The public headers are moved under a new top-level directory include/ to make
them clearly stand out as special (public API).

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
ant8me
d8d9f5e6e1 libweston-desktop: implement the new xdg_shell (stable) protocol
Some clients like the mpv video player now request the xdg_shell
protocol so these will fail if the compositor only provides the
xdg_shell_unstable_v6 protocol. Compositors like mir and gnome provide
both protocols.

The two protocols are very similar therefore the code in xdg-shell-v6.c
has been refactored to work with the new xdg_shell protocol and now
resides in xdg-shell.c.

Pekka:
- split the patch
- fix continued line alignment

Daniel
- allow anchor_rect to initially have zero dimensions
- account for get_popup allowing NULL parent surface

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-02-15 11:18:38 +00:00
Alexandros Frantzis
eba58edc6a libweston-desktop/xdg-shell-v5: Drop xdg-shell v5 support
Drop support for the obsolete xdg-shell v5 protocol. This clears the
path to properly support xdg-shell stable, since xdg-shell stable and
xdg-shell v5 can't currently co-exist in the same compositor, as both
define structures with the same name (such as struct
xdg_surface_interface).

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Proposed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
2018-02-14 10:09:51 +02:00
Pekka Paalanen
37111e157a libweston-desktop: add set_xwayland_position API
X11 applications expect -geometry command line option to work for
setting the initial window position, but currently this does not work.

Add provision to relay the initial position through libweston-desktop:
- weston_desktop_api gains a new entry set_xwayland_position
- implement set_toplevel_with_position() in xwayland internal interface

Once xwayland plugin starts calling set_toplevel_with_position(),
libweston-desktop can relay that information to a shell if the shell
wants to hear it.

If a shell does not implement the set_xwayland_position hook, the
old behaviour remains: the shell positions xwayland toplevels like any
other.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-18 13:21:02 +02:00
Bryce Harrington
097193369c Revert "libweston-desktop: Add listener and API to drop the idle inhibitor"
This reverts commit e7069bcf93.

(Accidental landing)
2016-08-30 12:04:37 -07:00
Bryce Harrington
e7069bcf93 libweston-desktop: Add listener and API to drop the idle inhibitor
Listen for the drop_idle_inhibitor signal from libweston, and propagate
the call to a corresponding libweston-desktop API.
2016-08-29 18:36:13 -07:00
Quentin Glidic
003da8863b libweston-desktop: Drop (wrongly named) new_buffer in committed
Instead we store the buffer move and just use it when the signal is
fired.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-08-15 20:07:28 +08:00
Quentin Glidic
248dd10965
Introduce libweston-desktop
libweston-desktop is an abstraction library for compositors wanting to
support desktop-like shells.

The API is designed from xdg_shell features, as it will eventually be
the recommended shell for modern applications to use.
In the future, adding new shell protocols support will be easier, as
limited to libweston-desktop.

The library versioning is the same as libweston. If one of them break
ABI compatibility, the other will too.

The compositor will only ever see toplevel surfaces (“windows”), with
all the other being internal implementation details.
Thus, popups and associated grabs are handled entirely in
libweston-desktop.
Xwayland special surfaces (override-redirect) are special-cased to a
dedicated layer, as the compositor should not know about them.

All the shell error checking is taken care of too, as well as some
specification rules (e.g. sizes constraint for maximized and fullscreen
surfaces).

All the compositor has to do is define a few callbacks in the interface
struct, and manage toplevel surfaces.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>

Differential Revision: https://phabricator.freedesktop.org/D1207
2016-08-14 09:29:00 +02:00