Commit Graph

74 Commits

Author SHA1 Message Date
Pekka Paalanen 336f7fabec Rename compositor/ to frontend/
"Frontend" is a much more descriptive name for the code that is in the
directory called "compositor".

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/633

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-12-18 15:34:26 +00:00
Tomohito Esaki 7dbb166de6 hmi-controller: activate and deactivate sruface
Activate when a surface is created and change focus when an active
surface is removed. The Surface is added to layers when it is created,
because it must be added to a layer to be active.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2023-10-16 16:24:19 +00:00
Derek Foreman 5fa3ef26c9 libweston: Use weston_coord for touch interfaces
Most of these don't use the parameter that changes at all, but some get
a nice simplification.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-18 20:35:37 +00:00
Philipp Zabel 1ffcc535ef hmi-controller: Do not call hmi_controller_destroy() from _create()
Move the destroy listener registration to the top, to avoid having
to call hmi_controller_destroy() for cleanup when it fails.

This would segfault trying to remove the destroy listener from a list
when its link was never initialized or inserted into any list.

The failure case can be hit by setting both modules=hmi-controller.so in
weston.ini and --modules=hmi-controller.so on the command line.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-07-14 11:44:46 +00:00
Daniel Stone abe893d8ea frontend: Rename weston_client_start to wet_client_start
It's not libweston, so it shouldn't be weston_.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Derek Foreman 0bf2d82e0c libweston: Use weston_coord in struct weston_touch
Convert the grab coordinate to a weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:58:17 -05:00
Michael Olbrich 3805bcad90 hmi-controller: prepare for API simplification
The return values for most of the API functions will be removed and replaced by
asserts. So remove the return value checks. The end result will be the same:
These functions only fail for incorrect API usage, so basically the asserts are
moved from the hmi-controller into the shell.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-04-19 09:38:09 +03:00
Michael Olbrich 3c6866088d hmi-controller: add input panel support
Implement listeners for the new input panel API of the IVI shell.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-14 10:40:04 +01:00
Derek Foreman 583fbcda3b libweston: Use weston_coord in struct weston_pointer
Convert the bare x,y coordinates into struct weston_coord and update all
users.

We keep the surface position in wl_fixed_t for now so it still exactly
matches the position most recently sent to clients.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman f7e936ae2a input: Convert weston_pointer_motion_to_abs() to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Tran Ba Khang(MS/EMC31-XC) f866dfaa09 hmi-controller: doesn't do a configuring when surface has no content
ivi-shell has allowed to notify a surface configuring when detecting
an unmapping commit. To avoid the commit_change with source_width
and source_height are zero, we should don't do a configuring when
surface has no content.

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-14 11:23:57 +02:00
Tran Ba Khang(MS/EMC31-XC) 91750cdbd4 hmi-controller: switch to listening the shell destroy signal
Listening the shell destroy instead of compositor destroy signal.
This show how to in case the controller depends on shell resource.
The order destroying had changed in this commit, the controller
is destroyed first now

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2022-11-10 11:47:05 +02:00
Tran Ba Khang(MS/EMC31-XC) 9fa161ed09 hmi-controller: add missing removals of surface listeners
The surface listeners must remove when hmi-controller destroying.
To avoid to use after free.

Suggested-by: Marius Vlad <marius.vlad@collabora.com>

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2022-11-10 11:46:58 +02:00
Marius Vlad cfbf2b0ab2 hmi-controller: Add missing removal of destroy listener
Shutting down the compositor gives us:

Invalid write of size 8
   at 0x4B1AEDB: wl_list_remove (wayland-util.c:56)
   by 0x4AF05BF: weston_signal_emit_mutable (signal.c:66)
   by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
   by 0x4864A4B: wet_main (main.c:3908)
   by 0x10915D: main (executable.c:33)
 Address 0x17435f20 is 224 bytes inside a block of size 384 free'd
   at 0x484617B: free (vg_replace_malloc.c:872)
   by 0x17718C7E: hmi_controller_destroy (hmi-controller.c:761)
   by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
   by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
   by 0x4864A4B: wet_main (main.c:3908)
   by 0x10915D: main (executable.c:33)

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-11-07 14:02:20 +02:00
Tomohito Esaki 036a76e3eb hmi-controller: don't add surface to layer in mode_random_replace()
There is no need to call layer_add_surface() in mode_random_replace()
because the surface has already been added to the layer. Rather, calling
layer_add_surface() has the issue that the child surface is displayed
below the parent surface.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2022-09-29 11:08:55 +09:00
Pekka Paalanen cbbf0e59a5 ivi-shell: replace MEM_ALLOC() with mostly xcalloc()
Drop the even more home-grown alloc wrapper and use the xalloc.h
wrappers directly.

xcalloc() is added and used, because calloc() will detect integer
overflows in the size multiplication, while doing a simple
multiplication in the caller is subject to overflows which may result in
allocating not what was expected, subjecting to out-of-bounds access.

All MEM_ALLOC() calls that had a meaningful multiplication in them were
converted to xcalloc(), the rest to xzalloc().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-07-20 12:12:22 +03:00
Pekka Paalanen 6ffbba3ac1 Use weston_compositor_add_destroy_listener_once() in plugins
This introduces a new convention of checking through the compositor destroy
listener if the plugin is already initialized. If the plugin is already
initialized, then the plugin entry function succeeds as a no-op. This makes it
safe to load the same plugin multiple times in a running compositor.

Currently module loading functions return failure if a plugin is already
loaded, but that will change in the future. Therefore we need this other method
of ensuring we do not double-initialize a plugin which would lead to list
corruptions the very least.

All plugins are converted to use the new helper, except:
- those that do not have a destroy listener already, and
- hmi-controller which does the same open-coded as the common code pattern
  did not fit there.

Plugins should always have a compositor destroy listener registered since they
very least allocate a struct to hold their data. Hence omissions are
highlighted in code.

Backends do not need this because weston_compositor_load_backend() already
protects against double-init. GL-renderer does not export a standard module
init function so cannot be initialized the usual way and therefore is not
vulnerable to double-init.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:32:55 +00:00
Michael Teyfel e894b3e4a3 hmi-controller: register for desktop_surface_configured
Since ivi-shell now supports xdg-protocol, the surface_created listener
can be removed and the desktop_surface_configured listener is needed.
ivi-layout: libweston-desktop api is used to send configure event to
application.

Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
2019-02-06 17:45:09 +00:00
Marius Vlad 64fbd0f41f compositor: Add some handy wrappers for wet_get_binary_path()
This allows to possibility to specify where to look for the executable
but also simplifies the need of having to pass either BINDIR/LIBEXECDIR
for retrieving full-path of the executable.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 15:37:34 +02:00
Marius Vlad 6bc37259e6 ivi-shell/hmi-controller: Include config.h as to not break ivi-shell build on meson
We're going to eventually pass bindir to weston-screenshooter and we
will need config.h info.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 15:37:34 +02:00
Daniel Stone 78a42116ae tests: Reshuffle IVI layout tests
Rename the IVI tests to be more consistent with the others, and invert
the naming of plugin/client to make it slightly more clear what's going
to happen. Handle the renaming by using wet_get_binary_path to rewrite
the local binaries.

As a side-effect, weston.ini ivi-shell-user-interface no longer needs to
be given as an absolute path.

Signed-off-by: Daniel Stone <daniels@collabora.com>

v2:

Call ivi-layout.ivi as ivi-layout-test-client.ivi to keep the same name
in both the file and the lookup, so that the module map does not need to
change the name.

Update code comments to reflect the new names.

Rename ivi_layout-test-plugin.c to ivi-layout-test-plugin.c.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-20 16:10:12 +03:00
Emre Ucan 16ac6a0f9d hmi-controller: remove dead assignments in add_launchers
assigned values of x, y, ret and layout_surface are
never read.

(Found by clang source code analyzer)

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-28 13:09:50 +03:00
Emre Ucan ffaf09eb2f hmi-controller: load as weston module
weston loads hmi-controller as a weston module.
IVI-shell does not need to load it explicitly.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:54:53 +02:00
Emre Ucan a9db8d7d64 hmi-controller: remove ivi_layout_interface global
Put the interface into hmi_controller struct.
It is better to have it in an object.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:54:53 +02:00
Alexandros Frantzis 7d2abcf6c8 libweston: Use struct timespec for touch motion events
Change code related to touch motion events to use struct timespec to
represent time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 27a51b83e5 libweston: Use struct timespec for touch up events
Change code related to touch up events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 9448deb073 libweston: Use struct timespec for touch down events
Change code related to touch down events to use struct timespec to
represent time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 80321942e7 libweston: Use struct timespec for axis events
Change code related to axis events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 215bedc88b libweston: Use struct timespec for button events
Change code related to button events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 84b31f8956 libweston: Use struct timespec for motion events
Change code related to motion events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Abdur Rehman b833d742c7 ivi-shell: fix minor typos
- ivi-shell/hmi-controller.c:41: a to an
- ivi-shell/hmi-controller.c:1296: Duplicated 'a'
- ivi-shell/ivi-layout-export.h:28: An to A

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:58:52 +00:00
Jussi Kukkonen 649bbce607 include stdint.h for int32_t/uint32_t
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-07-26 16:26:08 -07:00
Ucan, Emre (ADITG/SW1) d97f10081e ivi-shell: add surface_created listener after launchers
Add surface_created listener after the initialization of launchers.
Otherwise, surfaces of the launchers will be added to the application
layer too.

This does create a race where we might miss some surfaces that get
created before the UI client signals ready, but it was agreed the race
is not significant. You cannot use the launchers before the UI is ready,
and someone using systemd integration to launch clients in parallel to
Weston with ivi-shell and hmi-controller is unlikely. After all,
hmi-controller is just a demo.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: added extra commit message notes]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-29 11:31:51 +03:00
Pekka Paalanen 58f98c99f5 Move weston source to compositor/
This is the start of separating weston-the-compositor source files from
libweston source files.

This is moving all the files related to the 'weston' binary. Also the
CMS and systemd plugins are moved.

xwayland plugin is not moved, because it will be turned into a
libweston feature.

To avoid breaking the build, #includes for weston.h are fixed to use
compositor/weston.h. This serves as a reminder that such files may need
further attention: moving to the right directory, or maybe using the
proper -I flags instead.

v2: Move also screen-share.c, and add a note about weston-launch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]
2016-06-23 17:44:54 +03:00
Giulio Camuffo d52f3b775b compositor: remove the weston_config field in weston_compositor
The config can now be retrieved with a new function defined in weston.h,
wet_get_config(weston_compositor*).

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-06-03 13:16:39 +03:00
Giulio Camuffo fba27fbef2 Move the functions launching clients to main.c
They belong in the compositor rather than libweston since they
set signals handlers, and a library should not do that behind its
user's back. Besides, they were using functions in main.c already
so they were not usable by other compositors.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-03 13:16:39 +03:00
Ucan, Emre (ADITG/SW1) c49aa5acad ivi-shell: rework configure_surface notification
The add_notification_configure_surface API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to
add_listener_configure_surface.

This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
   by controller plugins
3. Remove API is not needed. Controller plugins can easily
   remove the listener link.

The remove API is removed too:
- ivi_layout_remove_notification_configure_surface

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-05 11:53:48 +03:00
Ucan, Emre (ADITG/SW1) 67f0aa8767 ivi-shell: rework remove_surface notification
The add_notification_remove_surface API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to add_listener_remove_surface.

This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
   by controller plugins
3. Remove API is not needed. Controller plugins can easily
   remove the listener link.

The remove API is removed too:
- ivi_layout_remove_notification_remove_surface

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-05 11:53:48 +03:00
Ucan, Emre (ADITG/SW1) 970f831588 ivi-shell: rework create_surface notification
The add_notification_create_surface API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to
add_listener_create_surface.

This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
   by controller plugins
3. Remove API is not needed. Controller plugins can easily
   remove the listener link.

The remove API is removed too:
- ivi_layout_remove_notification_create_surface

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-05 11:53:48 +03:00
Ucan, Emre (ADITG/SW1) 273874e3c7 ivi-shell: use weston_output in public APIs
IVI layout APIs now are called with weston_output pointers,
instead of ivi_layout_screen pointers.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Wataru Natsume <wnatsume@jp.adit-jv.com>
2016-03-24 11:10:07 +02:00
Ucan, Emre (ADITG/SW1) 3a8521e005 ivi-shell: remove ivi_layout_get_screens API
The compositor data struct already has a list of weston outputs.
Therefore, this API is not required.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Wataru Natsume <wnatsume@jp.adit-jv.com>
2016-03-24 11:10:07 +02:00
Ucan, Emre (ADITG/SW1) ff6a9f8474 ivi-shell: remove ivi_layout_get_screen_resolution API
The controller plugins can get the screen resolution directly from
weston output. Therefore, this API is not required.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Wataru Natsume <wnatsume@jp.adit-jv.com>
2016-03-24 11:10:07 +02:00
Ucan, Emre (ADITG/SW1) c6459c495d hmi-controller: fix wrong panel width
The width of the first base layer is used for all panels.
Every display has a base layer which is as big as the
display. Therefore, it is wrong to use the width of the
first base layer for all panels, because every display
could have a different resolution.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-18 12:42:50 +02:00
Ucan, Emre (ADITG/SW1) 783cb4dcfe hmi-controller: fix wrong background surface size
In current implementation, the size of the first application
layer is used for the background image of a display.

This is wrong because:
	1. The background surface should be fullscreen.
	2. Each display could have different resolution.

We should use the size of the base layer of each display
for the background image.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-18 12:41:15 +02:00
Bryce Harrington e99e4bf2b9 clients & tests: Unify multiple definitions of x*alloc and related functions
Direct fail_on_null calls now produce output like:

    [weston-info] clients/weston-info.c:714: out of memory

xmalloc, et al produce output on failure like:

    [weston-info] out of memory (-1)

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-17 14:13:13 +02:00
Ucan, Emre \(ADITG/SW1\) e62bfd8d5e ivi-shell: remove ivi_layout_layer_set_position API
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Acked-by: wataru_natsume <wataru_natsume@xddp.denso.co.jp>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-04 10:33:34 -08:00
Ucan, Emre \(ADITG/SW1\) dfc2d76432 ivi-shell: remove ivi_layout_layer_get_position API
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Acked-by: wataru_natsume <wataru_natsume@xddp.denso.co.jp>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-04 10:33:34 -08:00
Wataru Natsume 9d8b4414d7 hmi-controller: fix leak of ivi surface list
get_surfaces_on_layer() allocates memory and stores the pointer to
'ivisurfs'. But it was not freed.

Signed-off-by: Wataru Natsume <WATARU_NATSUME@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-04 13:45:31 +02:00
Wataru Natsume 161255ea49 hmi-controller: remove duplicate commit_changes in random mode
Previous code cleaned up surfaces in layer once and then added
surfaces to a layer in random. In this flow, two commitchanges are
required.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
[WATARU_NATSUME@xddp.denso.co.jp: Removes unnecessary check]
Signed-off-by: Wataru Natsume <WATARU_NATSUME@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-04 13:22:17 +02:00
Peter Hutterer 87743e9303 Support axis source, axis discrete, frame and axis stop events
[jonas: only send focus wl_pointer.frame if resource supports it]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2016-01-19 12:33:26 +08:00