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>
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>
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>
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>
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>
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>
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>
There are many times when we want to set a global position with a surface
offset added.
It's a fairly nasty operation, and most places in the code currently do
it naively, ignoring the painful existence of freeform window rotations
and other complex transforms that could be in play (but probably aren't)
Add a helper for this and convert existing usage.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This is a trap - it's not harmful to let the animation complete - it is
harmful to call weston_shell_utils_curtain_destroy() in mid animation. It
results in immediately completing the animation, which attempts to destroy
the curtain a second time.
Fixes a crash when (on a multi-output system) the display is disconnected
during the fade out, then reconnected before the fade-in starts.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Instead of trying to cover the desktop with an arbitrarily larger
rectangle, actually calculate the appropriate size.
Fixes the old (but recently reintroduced) bug where the curtain isn't
always large enough.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This essentially reverts 9ad4de1f7a, though much has changed in the
interim to make a simple 'git revert' impossible.
Per-output fade animations were a precursor to implementing support for
zwp_idle_inhibit_v1. Nobody ever followed up on that. Now that we have
the ability to create overlapping outputs, per output curtains don't
make sense - the curtains can overlap and look weird.
This re-introduces the bug where a desktop larger than 8192 pixels in any
direction isn't properly covered by the fade.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We've already validated this, so if we can't get here with an invalid
type. Just assert() instead.
This lets us remove the very strange tear down of curtains that presumably
couldn't have been created in the first place??
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
weston_view_move_to_layer() recalculates the output, so this can do no
good.
This output is only ever used to test against NULL anyway, so we don't
need to try to set it "properly".
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If the compositor is disabling a weston_output,
weston_head_from_resource can return NULL, so the return code must be
checked where used.
Fixes#638
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
An output resize may occur while a shell surface is in the process of
being destroyed, e.g., while the destruction fade-out animation is in
progress. In such cases although the shell surface exists, it's missing
the backing weston_desktop_surface, so ensure to check for that.
Fixes: #805
Fixes: eefd8ae2e0
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Now that we're not allocating surfaces on demand, animate_focus_change()
becomes a lot more straightforward and common, and using some local
variables sure does cut out a lot of typing.
Knowing that both from and to cannot both be NULL (because we check if
from == to), we can change the juggling to be extremely simple:
calculate where we need the curtains to be in the view list, put them
there, and set up the fade.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Rather than creating them the first time we need to switch focus, just
create them at startup if we're going to be needing them at some point.
Signed-off-by: Daniel Stone <daniels@collabora.com>
We don't need to be setting this because it isn't (yet) used anywhere.
It will get set when it is used.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Rather than juggling our layers manually, just use
weston_view_move_to_layer. This obviates the need for manually marking
the view as mapped.
Signed-off-by: Daniel Stone <daniels@collabora.com>
We must have (from || to), because if (!from && !to), we would've caught
the if (from == to) early-return case.
Signed-off-by: Daniel Stone <daniels@collabora.com>
However many times you thought this might reasonably be called when
setting up for fullscreen, there were more.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The only place we ever set shsurf->fullscreen.black_view is when we're
going into fullscreen, and we destroy it when we're going out of
fullscreen. Hence if we do ever have a fullscreen black view, we should
move it out of the way.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Merge shell_configure_fullscreen() and
shell_ensure_fullscreen_black_view() into shell_set_view_fullscreen().
Signed-off-by: Daniel Stone <daniels@collabora.com>
If we're asked to set a view as fullscreen, assume we're not doing so
with the surface not being mapped.
Signed-off-by: Daniel Stone <daniels@collabora.com>
weston_shell_utils_center_on_output() already handles the case where we
don't have an output to aim at.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Remove any attempt to reposition windows when handling an output resize.
This had some side-effects on x11 and wayland backends that keep moving
windows at random positions when manually the output.
A more smarter approach would be to move them only if they're actually
affected by a resize -- like no longer in the output's viewing area, but
that remains for another day.
Fixes: #793
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Philipp Zabel <p.zabel@pengutronix.de>
The output resize handler we only accounts for the background and panel
surfaces, so this handles all other regular shsurfs.
This patch would reuse any previously saved position, or reposition the
surfaces to avoid placing them outside of the output area. For maximized
or fullscreen type of surfaces, issue a new configure event to let
clients react to the new output dimensions.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
We'd need to go over them when handling output resize so use
desktop_shell to hang of the list of shsurfs.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This introduces two helpers, shsurf_is_max_or_fullscreen() and
set_shsurf_size_maximized_or_fullscreen() to handle
maximized/unmaximized fullscreen/unfullscreen transitions.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>