Fixes missing prototypes compilation warnings emitted when a function
is defined before its prototype is declared.
These warnings were introduced over time since the switch to meson
because the -Wmissing-protoypes was not included in the compilation
arguments.
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
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>
Change code related to animations 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>
This bumps the libweston major version due to breakage in the animation
ABI. The commits following this one break more ABI in other parts.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This fixes a crash in animation related code where weston
would crash in weston_view_animation_create when the
view had no output assigned.
This makes sure that animation gets created and released
immediately, so done and reset callbacks still get called
properly.
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
[Pekka: put a '{' on the right line.]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This clarifies what is supposed to be the libweston code.
v2: screen-share.c is already in compositor/ instead.
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]
Free move before return if animation is null.
Signed-off-by: Lucas Tanure <tanure@linux.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Removed duplicate definitions of the container_of() macro and
refactored sources to use the single implementation.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
If we're fading a view with weston_fade_run() and half way through we
want to unfade it we can use weston_fade_update() to set a new alpha
target. When the animation finishes, reset_alpha() is called which
ensures the alpha value of the view is exactly as requested.
Although weston_fade_update() was updating the spring target so the
animation would look fine, it would then reset to the alpha target
given in the first call to weston_fade_run().
Animations are run off the repaint cycle so if there's nothing to
repaint, an animation will stop running. This is usually not a problem
as each frame function of an animation causes something to change and
therefore a repaint to happen. This patch helps detect when the
animation isn't in said case and triggers a repaint to keep the
animation running.
This problem was found by using weston_move_scale_run() to move a view
onscreen from completely off. The very first time the animation frame
function was called the progress wasn't enough to move it into
view. The compositor saw there was nothing to repaint and stopped
doing anything else. When something else (like a pointer move) forced
a redraw, the view's position was very much onscreen and jumped into
view in an ugly way.
Both weston_move_scale_run() and weston_slide_run() were broken in
commit 3a869019. Commit a4a6f161 fixed and explained the problem for
weston_slide_run() but weston_move_scale_run() remained broken.
To fix weston_move_scale_run(), weston_view_animation_run() is also
required. It was removed when _run() was split into two functions
_create() and _run() in commit f5cc2b56, but _run() was not added in
this commit.
The position for the slide animation was calculated assuming the value
of the spring was always between 0.0 and 1.0. Commit 3a869019 broke
that assumption, and the result was that the panel would be positioned
at an invisible part of screen. Since there would be no output repaints
scheduled, the result of the animation would only be seen if something
else triggered a repaint (such as a mouse cursor movement).
This patch changes the values for the slide animation's spring to range
between 0.0 and 1.0, thus fixing the position of the panel and the lack
of scheduled repaints problem.
https://bugs.freedesktop.org/show_bug.cgi?id=77347
All the animations override at least one parameter of the spring that
is set during the creation of the animation. Some need to do the whole
setup again.
This patch changes the initialization of a view animation to a three
step process. First, the animation is created. Then the caller sets up
the spring and calls weston_view_animation_run() to apply the effect of
the animation for the first animation frame.
This has a couple of additional implications for the internal weston API:
1) weston_view_configure no longer exists. Use weston_view_set_position
instead.
2) The weston_surface.configure callback no longer takes a width and
height. If you need these, surface.width/height are set before
configure is called. If you need to know when the width/height
changes, you must track that yourself.
Add an animation which moves a surface to a new location, at the same
time as also rescaling it to a different size from the origin, rather
than the existing scale animation which resizes from the centre.
[pochu: rebased, ported to weston_view]
When enabled, this will make all but the keyboard-focused window dim.
Also the background gets dimmed, if there are any windows open. The
panel is not dimmed.
When the keyboard focus changes, the change in dimming is animated.
The dimming is implemented with transparent solid-color surfaces, two at
most. The net effect of two overlapping dim surfaces is kept constant
during animations (stable fade animation).
There is a new weston.ini option "focus-animation", that defaults to
none, and can be set to "dim-layer" to enable the focus change
animation.
[pq: Sliced, squashed, and rebased the patch series. Fixed surface alpha
interaction with the switcher. Wrote the commit message.]
[pochu: rebased, ported to weston_view]
Otherwise we don't repaint with the final state of the surface and
we're stuck with the second-to-last frame of the animation until
something else (moving the mouse or such) triggers a redraw.
https://bugs.freedesktop.org/show_bug.cgi?id=70930
The weston_surface structure is split into two structures:
* The weston_surface structure storres everything required for a
client-side or server-side surface. This includes buffers; callbacks;
backend private data; input, damage, and opaque regions; and a few other
bookkeeping bits.
* The weston_view structure represents an entity in the scenegraph and
storres all of the geometry information. This includes clip region,
alpha, position, and the transformation list as well as all of the
temporary information derived from the geometry state. Because a view,
and not a surface, is a scenegraph element, the view is what is placed
in layers and planes.
There are a few things worth noting about the surface/view split:
1. This is *not* a modification to the protocol. It is, instead, a
modification to Weston's internal scenegraph to allow a single surface
to exist in multiple places at a time. Clients are completely unaware
of how many views to a particular surface exist.
2. A view is considered a direct child of a surface and is destroyed when
the surface is destroyed. Because of this, the view.surface pointer is
always valid and non-null.
3. The compositor's surface_list is replaced with a view_list. Due to
subsurfaces, building the view list is a little more complicated than
it used to be and involves building a tree of views on the fly whenever
subsurfaces are used. However, this means that backends can remain
completely subsurface-agnostic.
4. Surfaces and views both keep track of which outputs they are on.
5. The weston_surface structure now has width and height fields. These
are populated when a new buffer is attached before surface.configure
is called. This is because there are many surface-based operations
that really require the width and height and digging through the views
didn't work well.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
After the fade or zoom effects, alpha could not have been 1.0, preventing
not redrawing behind opaque windows.
This patch add a reset function in weston_surface_animation to reset
some variables the effects affect.
Signed-off-by: Axel Davy <axel.davy@ens.fr>
When the spring goes outside the envelope, we have a few options for
bringing it back: either just let it overshoot, bounce off the limit or
just clamp it. Instead of controlling that with #ifdef, let's make it
a part of the spring state.
This is the first in what will be a series of weston patches to convert
instances of wl_resource to pointers so we can make wl_resource opaque.
This patch handles weston_surface and should be the most invasive of the
entire series. I am sending this one out ahead of the rest for review.
Specifically, my machine is not set up to build XWayland so I have no
ability to test it fully. Could someone please test with XWayland and let
me know if this causes problems?
Because a surface may be created from XWayland, the resource may not always
exist. Therefore, a destroy signal was added to weston_surface and
everything used to listen to surface->resource.destroy_signal now listens
to surface->destroy_signal.
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system. This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.
Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries. This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
[pq: rebased and converted more files]
struct weston_surface is now the only surface type we have (in core, shell.c
has shell_surface, of course). A lot of code gets simpler and we never
have to try to guess whether an API takes a wl_surface or a weston_surface.
Instead of directly setting the dirty flag on weston_surface geometry,
use a function for that.
This allows us to hook into geometry dirtying in a following patch.
Also add comments to weston_surface fields, whose modification causes
transform state to become outdated.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
The function weston_surface_animation_frame() would schedule a repaint
on all outputs, as weston_surface_schedule_repaint() didn't exist when
it was implemented.
The spring code stops when the current value is withing 0.0002 of the
target. In that case, round the value to 0.0 or 1.0 to enable the use
of fast paths, such as disabling blending in the GL renderer when an
opaque region is set.
Add parameters to weston_fade_run() for setting the initial and target
values for the fade, as well as a parameter to set the spring constant
used for the animation.
Also add the weston_fade_update() function, that allows the animation
to be changed while it is still running.
This will be used to move the fade animation from core Weston into the
shell. These changes are needed to be able to fade out as well as in,
and to be able to reverse the fade in case of user input.