Commit graph

569 commits

Author SHA1 Message Date
Derek Foreman
777a52ef4d Revert "desktop-shell: Add a placeholder curtain on new outputs"
This reverts commit 0ff5ac0f7b.

Now that we have a way to prevent repaints of empty scene graphs from
the shells, remove the curtains and just have our first paint be
proper content.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-27 05:55:51 +00:00
Derek Foreman
0bfcb700b9 compositor/shells: Require shells to flag outputs as ready to allow repaint
We've added a curtain to the shells so at startup we have something to
render, but this causes a flicker if someone is trying to have a seamless
transition from boot to weston.

Add a ready flag that allows the shell to indicate repaints are safe, so
we can remove the curtains and have no wasted frames at startup.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-27 05:55:51 +00:00
liang zhou
1560cc3f0b compositor: prevent crash when moving view with popup on first output removal
In a multi-screen setup, removing the first screen triggers `handle_output_move`.
If `weston_view_set_position` is called on an output that has an active popup,
it causes a weston crash due to the view has a parent.

Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
2025-09-30 13:17:23 +00:00
liang zhou
0b540ba8d6 desktop-shell: Fix crash when fullscreen surface has no output
The shell_set_view_fullscreen function was dereferencing
shsurf->fullscreen_output without checking if it was NULL first. This
could lead to a crash when a fullscreen surface had no associated
output during display hotplug.

Fix issue: https://gitlab.freedesktop.org/wayland/weston/-/issues/1028

Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
2025-09-30 12:10:41 +00:00
Daniel Stone
179aae34f7 desktop-shell: Remove damage for curtain
There is no need to damage a curtain. Adding or removing a view is what
causes the damage.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-05-28 15:47:30 +01:00
Daniel Stone
44c2c3ce72 desktop-shell: Remove weston_surface_damage() from rotate
This already calls either weston_view_add_transform() or
weston_view_remove_transform() followed by
weston_view_update_transform(), the combination of which will already
force a repaint for those views.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-05-28 15:47:30 +01:00
Vlad Zahorodnii
09c8902225 desktop-shell: Fix leaking weston_desktop_surface
If the view has become unmapped, the weston_desktop_surface should still
be unreferenced, otherwise it'll be leaked until the client disconnects.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2025-04-16 11:19:59 +00:00
Derek Foreman
9660a4f315 desktop-shell: Use output shell_private data
Replace find_shell_output_from_weston_output with private data.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-03-04 12:30:51 +00:00
Derek Foreman
013c21ec38 desktop-shell: Store struct shell_output in internal structs
Similar to what's just been done to kiosk-shell, use our internal
shell_output instead of directly using weston_output in our internal
structures.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-03-04 12:30:51 +00:00
gpotter2
59c6015c52 Move shell structures of desktop-shell to the header
Signed-off-by: gpotter2 <10530980+gpotter2@users.noreply.github.com>
2025-02-12 14:13:53 +00:00
Marius Vlad
207fed2710 Revert "shared/helpers.h: Migrate helpers.h to libweston"
This is problematic as we don't have namespacing for these and some of
the macros can interfere with other defines.

This reverts commit 8634c7e349.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-01-17 10:18:26 +02:00
Paul Pu
ddb6225338 desktop-shell: support disallow-output-changed-move
With this, when unplugging an extended display, the view displayed on
the extended display won't be re-positioned to other displays.

On some embedded devices, the views are often fullscreen displayed, even
on the extended displays. When disconnecting the extended displays, the
views are not desired to be moved onto the existing displays. Without
this change, we can see the view flash across the existing displays
even though the UI program hides the view as soon as it can, which is
unexpected.

Signed-off-by: Paul Pu <hui.pu@gehealthcare.com>
2025-01-14 08:05:14 +00:00
Derek Foreman
0ff5ac0f7b desktop-shell: Add a placeholder curtain on new outputs
Desktop-shell currently waits for the desktop-shell client to set up a
background image. But the outputs are enabled before this happens, which
forces a repaint.

If the fade animation is enabled, there's a fade curtain in place, but if
it's disabled the scene graph is empty at the repaint.

This repaint with an empty scene graph can have very nasty consequences,
especially if frame buffer compression is in use, as the buffer isn't
rendered into and can be in an undefined state that confuses whatever
video hardware is trying to decode the buffer.

Add a temporary black curtain placeholder that ensures the scene graph has
something in it before the client gets a chance to commit the real
background.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-12-04 14:52:34 +00:00
Marius Vlad
8634c7e349 shared/helpers.h: Migrate helpers.h to libweston
As weston_windowed_output_get_api needs ARRAY_LENGTH() move helpers to a
libweston/ so other users can re-use that instead of re-defining these
all over. Easier for other front-ends to make use of them.

With this change windowed-output-api.h also includes the helpers header.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-11-25 11:26:35 +00:00
Derek Foreman
1ee1b93bac desktop-shell: Don't crash if the output is removed in startup
If the output is destroyed between setting the panel and committing the
panel, or between setting the background and committing the background,
we have a use after free crash.

Handle this by clearing the surface private pointers on output destroy
so we can skip the useless commits.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-11-05 11:29:39 -06:00
Marius Vlad
217fb30847 desktop-shell: Don't attempt to re-add the view to panel layer
This change fixes a side-effect of weston_view_move_to_layer helper
which would basically unmap the view because the layer entry list is no
longer visible. Only add the view to panel layer the first time.

Fixes: #956

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-10-11 11:36:03 +03:00
Derek Foreman
067e977fe1 desktop-shell: Don't try to move parented views on output removal
These should be repositioned relative to their parents, attempting to
move them independently not only doesn't make sense, but violates
weston_coord sanity checks.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-09-18 09:13:19 -05:00
Derek Foreman
30fd16dae7 desktop-shell: check view mappedness in desktop_surface_removed
A "mapped" surface need not have a primary output assigned, or
be in a state such that it needs a fade out animation. The view
being mapped is what we should be testing here.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-08-08 08:02:09 -05:00
Loïc Molinari
d1ee47361c helpers: Add FALLTHROUGH macro
Use gcc and clang's 'fallthrough' attribute instead of a comment to
fall through switch statements. This allows to request fall through
inside a block and prevents issues with preprocessed files.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-04 14:15:04 +00:00
Marius Vlad
cc3542b574 desktop-shell: Use the correct link iterator
Mistakenly used weston_seat as opposed to shell_seat when iterating over
the shell seats. This unfortunately takes down the compositor upon switching
back.

Fixes: 4c100ca1d7 ('desktop-shell: Add session listener')

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-07-03 10:16:05 +00:00
Marius Vlad
4c100ca1d7 desktop-shell: Add session listener
And use it to perform keyboard activation on the currently focused
window. Similar to what kiosk-shell does, with the note that we go
over all seats in the system rather than picking the first one
available.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-06-21 13:21:27 +00:00
Witold Lipieta
215cceb45d desktop-shell: shell: Capture input on fade animation curtain
Shell fades out and in depending on user interactions. When screen
is faded out, first interaction wakes up the shell from idle and screen
fades back in. However, this first interaction is applied to whatever
is "behind" faded screen and it may trigger unwanted actions (first
touch or mouse click on active GUI elements). Behavior is the same for
both idle and lock screen (because unlock dialog is created after the
first interaction).

Update fade animation curtain creation function to capture inputs in
order to prevent unwanted interactions within faded or locked shell.

Fixes issues #147 and #569.

Signed-off-by: Witold Lipieta <witold.lipieta@thaumatec.com>
2024-02-29 15:29:23 +01:00
Paul Pu
4eee3c816d Fix segfault when using fullscreen when just hotplugging the display
Set the fullscreen_output to NULL when output gets destroyed. Otherwise,
a use-after-free case can happen, which result in a SEGFAULT crash.

Fixes #766

Signed-off-by: Paul Pu <hui.pu@gehealthcare.com>
2024-02-21 17:22:31 +08:00
Jeffy Chen
5dbf96fb6c desktop-shell: Avoid using maximized size in fullscreen state
The fullscreen should take precedence if the client requests both
window states at the same time.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2024-02-02 19:44:31 +08:00
Marius Vlad
04d9f7e738 libweston/animation: Remove weston_fade_run unused argument
And with it, bump libweston to next major version, 14. We seems like
we never used that argument so better just removed it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-01-09 13:15:16 +02:00
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
Arnaud Vrac
03fa71f153 desktop-shell: set proper curtain size when no output is created yet
In this case the curtain width and height would be calculated using
uninitialized values, triggering warnings in pixman calls.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
2023-12-01 12:43:27 +01:00
Arnaud Vrac
14e0fff19a desktop-shell: clamp view alpha correctly
Clamping of the alpha value is not done properly since the introduction of the
weston_view_set_alpha() helper.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
2023-12-01 12:43:27 +01:00
Daniel Stone
bd8a6da2f0 desktop-shell: Map input panel exactly once
When the input panel surface gets something committed to it, we have
content and thus the surface has become mapped. Do this from within the
input-panel surface committed handler.

When we want to show the input panel, this is when we map the view. Do
this exactly once as well, and make sure that we don't attempt to map
the view with an unmapped surface.

This regularises the logic to be the same as almost all the other
special surface users.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-11-21 13:30:50 +00:00
Daniel Stone
bdf2019ec9 desktop-shell: Map input panel surfaces before views
Separate the concept of a surface being mapped (where it has current
content) from views being mapped (visible on a layer).

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
ecc0d40314 desktop-shell: Use weston_view_move_to_layer() for input panels
Use our helper instead of open-coding view manipulation.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
40fdffdced desktop-shell: Create lock surface view when mapped
Wait until the lock surface is mapped until we create the view.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
7205e88e60 desktop-shell: Use consistent surface-has-content check for lock
Rather than checking if the surface has width 0, use our helper to see
if the surface has an attached buffer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
3e156720a9 desktop-shell: Inline configure_static_view for panels
This is pretty trivial, so why not.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
de243918e3 desktop-shell: Inline configure_static_view for background
This is a pretty trivial case which just sets up one static view.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
82d25f3ce7 desktop-shell: Use saved panel position
Don't look it up from the view every time, but instead just work
completely from global co-ordinates.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
aae1abb8df desktop-shell: Regularise panel position
Calculate everything in global co-ordinates and make it more consistent.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
a80a008479 desktop-shell: Directly look up output panel view
We don't need to traverse the layer-view list to find our view for an
output's panel.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
e165f15219 desktop-shell: Pass shell_output as special-surface private
We need to know which output we're on, and the surface type plus output
uniquely identifies us, so just pass that in.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
36d04b0347 desktop-shell: Store pointers to special-surface views
We only have one of those per output, and we need to dig them out later,
so just store a direct pointer to them.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
7f54341377 desktop-shell: Clean up surface/view mapping for special surfaces
Make background and panel surfaces do the right thing: map the surface
when it first gets content applied to it, and only move the view around
when required.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
2cb4feb6c2 desktop-shell: Remove useless surface-gone messages
We expect this to happen at shutdown, so don't act surprised when it
does.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
a54bc37c6c desktop-shell: Don't allow multiple special surfaces
We only want one background and/or panel per output. If another one
comes up, tell the client it's done something very bad, rather than
trying to gently negotiate our way out of the situation.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
22175a6a59 desktop-shell: Don't lose track of background/panel views
If our background and/or panel surface already has a view, something
extraordinarily weird has gone on. Don't try to deal with it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Derek Foreman
cec0ab7d23 libweston: Make better use of global coord helpers
Use wesotn_coord_sub/add() in many more places.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-10-03 18:19:17 +00:00
Marius Vlad
b0b24ab375 desktop-shell: Branch out the set_maxime/unset_full
And move it back to its place, as we can't differentiante between two
different states: coming back from unmaxized (which makes it so we send
out a widthXheight size matching that of maximized whereas we should send
out 0, 0) and that we're no longer fullscreen. We land basically in the
same spot in both cases, and trying one issue, creates a new one.

Moving the corner case in set_fullscreen makes it so we don't reach both
cases in the same time and avoid introducing other issues.

Fixes: #801

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-09-27 13:26:22 +03:00
Derek Foreman
d62c1b7f7b shell-utils: Use weston_coord in curtain params
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-18 20:35:37 +00:00
Derek Foreman
7dfc209824 desktop-shell: Use weston_coord for constrain_position
Update the desktop-shell specific cursor confinement code to use
weston_coord

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-18 20:35:37 +00:00
Derek Foreman
9e12250707 shells: Use weston_coord for shell API
Replaces a lot of x, y pairs with weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-18 20:35:37 +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