Commit graph

160 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
He Yong 98606d6a03 replace weston_signal_emit_mutable with wl_signal_emit_mutable
wayland upstream has introduced wl_signal_emit_mutable
now we can use it

[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/208

Signed-off-by: He Yong <hyyoxhk@163.com>
2023-12-04 11:37:17 +02:00
Tomohito Esaki 0e082315d7 ivi-shell: activate desktop surface
The keyboard focus is active, but the desktop surface itself is not
displayed as active. Therefore, the surface should also be displayed as
active, as in kiosk-shell.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2023-10-16 16:24:19 +00:00
Philipp Zabel 5c1adb1cab ivi-layout: Remove weston_view_schedule_repaint()
There is no need to manually schedule a repaint anymore, it will be
triggered by changes to opacity or transform.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-07-25 10:46:59 +03:00
Philipp Zabel 1ad9687571 ivi-layout: Use weston_view_move_to_layer()
Use the weston_view_move_to_layer() helper instead of calling
weston_layer_entry_insert() / weston_view_unmap() directly.

This requires us to stop just clearing out the layer view list and then
adding visible surfaces' views to it. Instead, we have to explicitly
move all views onto or off of the layers.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-07-25 10:46:59 +03:00
Philipp Zabel d0dc464f15 ivi-layout: Use weston_view_set_alpha()
Stop setting view->alpha directly. Use weston_view_set_alpha() to also
apply damage as required.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-07-25 10:46:59 +03:00
Philipp Zabel 2df127c180 ivi-layout: Use weston_view_add/remove_transform()
Stop manipulating the view->geometry.transformation_list directly and
replace weston_view_geometry_dirty() and weston_view_update_transform()
calls with weston_view_add/remove_transform().

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-07-25 10:46:59 +03:00
Derek Foreman e8208d21d7 libweston: Use weston_coord in struct weston_output
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:22 -05:00
Michael Olbrich a3a8431634 ivi-layout: simplify API
Use assert() to check for invalid NULL arguments. Something like that happens
during development and assert() makes it easier to find the error. And it avoids
unnecessary additional error handling.
The hmi-controller asserted anyways so this just moves the assert on level
deeper. Other controller probably do the same thing, or don't check the return
values at all.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-04-19 09:38:09 +03:00
Michael Olbrich 5d68a6c4b5 ivi-shell: add input panel support
Input panels are used for complex text composition for CJK alphabets and for
onscreen keyboards. Support for this is already implemented in libweston and
the desktop shell.

This adds extends the IVI shell to add support for input panels as well. The
low-level parts are implemented in the IVI shell. The positioning of the input
panels is delegated to the controller.
Support for input panels and the relevant protocols is only enabled if the
controller attaches a listener to the new signals.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-14 10:40:04 +01:00
Michael Olbrich ad2c014ef3 ivi-layout: add surface type to the surface properties
This makes it possible for the controller to distinguish different surface
types. For IVI and desktop surfaces, this is not all that useful, but it will be
needed for a new surface type: input panels.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-14 10:40:04 +01:00
Tran Ba Khang(MS/EMC31-XC) fe392d23b9 ivi-shell: add commit_current into ivi_layout interface
If a client commits a null buffer, weston will unmap all the views of
the surface and marks it is unmapping. In the case, the client commits
a new valid buffer, then the controller wants to rebuild the views
without applies the pending properties of surfaces and layers.
The ivi_layout_interface should prodive an interface for this.

Suggested-by: Michael Olbrich's avatarMichael Olbrich <m.olbrich@pengutronix.de>
Suggested-by: K J Rajendraprasad's avatarRajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-14 11:23:57 +02:00
Michael Olbrich 2c96bdbdbf ivi-shell: simplify surface creation
The weston_surface passed to surface_create() should never be NULL. And other
code already relies on that anyway, so just remove the check.

Now surface_create() will never fail, so more checks can be removed.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-07 15:43:18 +01:00
Michael Olbrich c4fab1633b ivi-shell: use x*alloc for small allocations
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-07 15:43:18 +01:00
Tran Ba Khang(MS/EMC31-XC) dea53c33ea ivi-shell: add new signal to notify ivi shell destroying
In the case the controlelrs are depended on ivi-shell resource,
it must be destroy before the ivi shell destroy. To do this,
add new ivi shell destroy signal on ivi shell, emit it on
the begining of the shell destroying

Suggested-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
Suggested-by: Michael Olbrich <m.olbrich@pengutronix.de>
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:56 +02:00
Emre Ucan 28842f210d ivi-shell: listen output_destroyed_signal
listen the signal and destroy the screen
corresponding to the destroyed weston_output.

clear also pending and order layer lists and
unmap all active views on the screen.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>

The controller should decide what to do with the views. It can
destroy the views or move the view to other screen. So, don't unmap
the views on the destroy screen event in ivi-layout. Removing typecast

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2022-11-04 16:14:13 +07:00
Emre Ucan cbf476f208 ivi-shell: listen output_created signal
listen the signal and create new ivi screens.
this is required to handle hotplug events.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>

don't need to check the output in event, remove the typecast

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2022-11-04 16:09:39 +07:00
Harsha M M 2e39630214 ivi-shell: Set view mask solely based on source rectangle
The controller sets the source and destination rectangles for any surface,
based on these parameters configure event is sent from the client application.

The controller commit the properties in the initial time, so
the view mask is capped to the current buffer dimensions of the
client. In runtime the client maybe sends some the bigger
configures of buffers. In this case view mask will be of smaller
dimension compared to the client buffer and it results in un-desired
clipping of client buffer.

To resolve this, use source rectangle as view mask. weston will take
care to clip the boundingbox of view to client buffer dimension if the
view mask is smaller.

Signed-off-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
2022-11-03 12:27:42 +02:00
Michael Olbrich bdc39b5909 ivi-layout: fix rectangle calculation by calc_inverse_matrix_transform()
It's ok if the rectangle is too large: If the calculation fails, the
bounding rectangle is used anyways. However, a rectangle that is too small
will create incorrect results. So make sure to round all edges outwards.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-10-24 17:37:05 +03:00
Michael Tretter c56e69bc85 ivi-shell: fix free in get_layers_under_surface
If a controller requests the layers under a surface that has no views attached,
Weston crashes since it tries to free the array that would be used to return the
found layers, but has not been allocated before.

Free the ppArray only if it was allocated in ivi_layout_get_layers_under_surface
before and no layers were found.

While at it, make it obvious that checking the length is an integer comparison
by comparing it to 0.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2022-10-19 14:16:06 +02:00
Tomohito Esaki 9cdb7c7450 ivi-shell: activate keyboard focus for xdg-shell surface
Activate keyboard focus for surfaces created with xdg-shell protocol. If
the surface has child surface, the child surface is activated instead of
the parent surface.

Fixes: #630

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2022-09-29 11:08:55 +09:00
Daniel Stone 0c69688aa2 libweston: Add weston_surface_map() wrapper
Change all instances of surface->is_mapped = true, to a specialised
function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Michael Olbrich 924e79f4f2 ivi-shell: emit created notification earlier for desktop surfaces
Without this, the earliest signal the ivi controller receives for a new surface
is configure_desktop_changed signal. And this is not emitted until the surface
has the first buffer attached.
By emitting the signal during surface creation, the controller is able to set
the initial width and height for the first configure.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-04-14 13:10:04 +00:00
Pekka Paalanen 9706a807f9 ivi-shell: call weston_layer_fini()
This ensures the layers are torn down properly.

See commit: libweston: add weston_layer_fini()

There would be a lot more to tear down here, but that is for another
time.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Rajendraprasad K J 4a378afa3b ivi-shell: Avoid unnecessary scaling of the view transformation matrix
The opaque region of a weston view is updated only if the alpha value is 1
and the transform matrix is of type WESTON_MATRIX_TRANSFORM_TRANSLATE.

While using ivi-shell, opaque region is never updated, as we are performing
scaling operations to the view transform matrix, even when the scaling
factor is 1 and thereby changing the type to WESTON_MATRIX_TRANSFORM_SCALE.

Perform scaling of the view transformation matrix only when the scaling
factor is non-zero.

Signed-off-by: Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>
2020-08-17 09:58:23 +00:00
Michael Olbrich 6ef2d45a2d ivi-layout: unmap desktop surfaces in ivi_view_destroy()
weston_desktop_surface_unlink_view() does now call weston_view_destroy() so the
weston_view is not destroyed here. This is a problem because the view remains in
the weston_layer view_list. If ivi_view_destroy() is called from
ivi_layout_surface_destroy() and the view list is rebuilt in the 'removed'
signal, then the list gets corrupted when the view is destroyed immediately
afterwards.
Fix this by calling weston_view_destroy() unconditionally for all view.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2019-07-01 15:51:57 +00:00
Michael Olbrich 640109cf5e ivi-layout: use libweston-desktop api is to send configure events everywhere
Whenever shell_surface_send_configure() is called
weston_desktop_surface_set_size() should be used instead for desktop
surfaces. It is already done for IVI_LAYOUT_TRANSITION_VIEW_FADE_ONLY, do
it everywhere else too.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2019-07-01 15:50:08 +00: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
Emmanuel Gil Peyrot 426c24673f Fix typos all around (thanks codespell!) 2019-02-20 16:47:35 +01:00
Michael Teyfel c04188e546 ivi-layout: use libweston-desktop api for configure event
The 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
Michael Teyfel 831e58f8e6 ivi-layout: use libweston-desktop api for views
Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
2019-02-06 17:45:09 +00:00
Michael Teyfel 4d886d6058 ivi-layout: introduced surface create and configure
Introduced surface create and configure function for xdg-apps.

Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
2019-02-06 17:45:09 +00:00
Michael Teyfel 65e1be1234 ivi-layout: introduced configure_desktop_changed
Introduced signal configure_desktop_changed with interface. This signal
should be sent, when a desktop-surface is configured.

Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
2019-02-06 17:45:09 +00:00
Michael Teyfel c9c247730b layout-interface: added interface to change surface id
This interface enables an id-agent to change the surface ids of an
ivi-layout-surface once.

Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
2019-02-06 17:45:09 +00:00
Emre Ucan d93a52a6f9 ivi-shell: check ivi_view mappedness in commit_changes()
If the view is not mapped, we do not need to update its
properties. We can use ivi_view_is_mapped() function to
check it.

Also we don't need to call weston_view_damage_below()
for weston_views, which were in the scenegraph. Because
we are calling weston_view_unmap for views of unmapped
ivi_views in build_view_list() function

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
2018-11-02 11:28:32 +01:00
Emre Ucan f6638a7f0f ivi-shell: unmap views which are not in scenegraph
From Michael Olbrich:
"Both the core in weston_compositor_build_view_list() with view.link
and the ivi-shell in commit_screen_list() with view.layer_link
don't remove the old views from the list.

As a result, all views that are not currently in the list have
old broken links. Destroying such a view tries to remove
the view from these lists and will access the old, invalid pointers."

Therefore, we have to unmap weston_views which are not in current
scenegraph of ivi-shell. I implemented ivi_view_is_mapped() function
to check mappedness of ivi_views. The functions checks:
   - the view is on a layer's order list
   - the layer is on a screen
   - the layer and view's ivi_surface are visible

If ivi_view is not mapped but weston_view is still mapped,
we have to unmap the weston_view with weston_view_unmap() call.

Reported-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
2018-11-02 11:28:32 +01:00
Emre Ucan e1e7ebdbea ivi-shell: Add build_view_list function
Move the implementation from commit_screen_list to
build_view_list function

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
2018-11-02 11:28:31 +01:00
Emre Ucan e8ff7df863 ivi-shell: fix the layer assignment change from one screen to another
if the layer is in order of some screen we need to remove it
from there and mark the screen order as dirty so it will be removed
in commit_screen_list call later
layer should only be assigned to one screen at a time

Signed-off-by: Eugen Friedrich <efriedrich@de.adit-jv.com>
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-08 14:17:12 +02:00
Emre Ucan 40d67c2862 ivi-shell: don't expilicitly assign outputs to views
it is assigned in weston_view_assign_outputs

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-08 14:16:57 +02:00
Emre Ucan 7b690559a5 ivi-shell: don't schedule compositor repaint
it is not necessary to repaint all outputs after
each commit_changes. Only outputs with modified
views has to be repainted.

We need to call weston_view_update_transform
for assigning views to outputs first.
Then, We can call weston_view_schedule_repaint
to trigger repaint for outputs.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-08 14:16:44 +02:00
Emre Ucan 0c1bbb9e52 ivi-shell: don't load controller modules
controller modules can be loaded as weston modules
from the main function of weston.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:55:03 +02:00
Emre Ucan ce9bc35185 ivi-shell: register ivi_layout_interface
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:54:37 +02:00
Alexandros Frantzis 0343c6ac69 ivi-shell: Fix incorrect use of logical instead of bitwise operator
Fix the code to use the correct bitwise AND operator '&', instead of the
currently used logical AND operator '&&', to check the value of a bit
flag in a bit mask.

This problem was reported as a warning when building with clang.

Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
2017-11-24 14:02:19 +02:00
Ucan, Emre (ADITG/SW1) 57ac260c5d ivi-shell: remove orientation calculation
Dead code as orientation cannot be changed anymore, see patches:
ivi-shell: remove layer_set_orientation API
ivi-shell: remove surface_set_orientation API

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: added commit message]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-07-24 13:33:05 +03:00
Ucan, Emre (ADITG/SW1) 6e423ed996 ivi-shell: remove layer_set_orientation API
This API is used to rotate the contents of
application's buffer, which are in the render
order list of the layer. But this API is not
needed because an application can rotate
its buffers with set_buffer_transform request
of wl_surface interface

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-07-24 13:33:00 +03:00
Ucan, Emre (ADITG/SW1) 9337197f82 ivi-shell: remove surface_set_orientation API
This API is used to rotate the contents of
application's buffer. But it is not needed
because an application can rotate its buffers
with set_buffer_transform request of
wl_surface interface.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-07-24 13:32:48 +03:00
Ucan, Emre (ADITG/SW1) deee858b0b ivi-shell: add_screen_remove_layer API
It is analagous to layer_remove_surface API.
The API removes a layer from the render order
of the screen.

v3:
add the new vfunc at the end of
the ivi_layout_interface struct.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Eugen Friedrich <friedrix@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-07-24 13:13:37 +03:00
Raúl Peñacoba bd8dc0a255
ivi-layout: Add missing free() in ivi_view_create
Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-31 01:32:46 +02:00
Ucan, Emre (ADITG/SW1) 7fe0bb2580 ivi-shell: Damage view below after unmapping
If ivilayer or ivisurf of ivi_view is made invisible in the
commit_changes call, we have to damage the weston_view below this
ivi_view. Otherwise content of this ivi_view will stay visible.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-02-07 15:03:10 +02:00
Ucan, Emre (ADITG/SW1) 27799355a9 ivi-shell: simplify commit_changes function
It is a better idea to use one for loop instead
of using three nested for loops.

We do not need to update the transformation of
views according to the scenegraph. The important
thing is that every visible view is updated before
commit_changes function returns.

The first if statement checks, if the view is on
the currently rendered scenegraph. The second if
statement checks, if the view's layer or surface
is visible. These checks ensure that we do not
update the transformation matrix of a view, which
is not visible on the screen.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: minor whitespace fix]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-02-06 12:11:33 +02:00