Most backends relies on gettimeofday(2) for output repaint timestamps
but this is not a requirement. Before this patch repaints coming from
idle_repaint() always used gettimeofday(2) for timestamps. For backends
not using that time source this could cause large jumps between
timestamps.
To fix this, timestamps needs to always come from the backend. This
means that the backend needs to always be responsible of starting the
repaint loop in case that the repaint cannot start immediately.
The drm backend implementation is from the patch by Ander Conselvan de
Oliveira found here:
http://lists.freedesktop.org/archives/wayland-devel/2013-February/007393.html
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
This API call handles setting the current surface on the wl_pointer and also
maintaining a destroy notification to monitor that surface for destruction.
This is part of the fix for: https://bugzilla.gnome.org/show_bug.cgi?id=696946
This state is used when the user switches the vt. It turns of rendering
and frame events, but doesn't set the DPMS state to off.
As a part of this change, also turn off the idle timer when entering
the SLEEPING or OFFSCREEN states, which fixes
https://bugs.freedesktop.org/show_bug.cgi?id=61910 (rpi backend
untested).
This patch implements a popup stack. When the first popup is opened
the grab is started, and it is added to a list. Further popups will
be added to this list but the grab won't change. When a popup is
closed it is removed from the list and, if it is now empty, the grab
is ended.
A click outside the client area will send the popup_done event to
all the popups in the list, and the grab will end.
Implements surface transform inheritance. A 'parent' pointer is added to
weston_surface::geometry, and is automatically used by
weston_surface_update_transform(). When updating the transform, the
parent transform is updated as needed, too.
shell_map_popup() is converted to use the new
weston_surface_set_transform_parent() function. Now, if we moved the
popup's parent surface while the popup is open, the popup surface will
stick to the parent properly.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
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>
Remove redundant geometry dirtying from surface_commit() to simplify
further changes.
This code was added in commit 5df8ecac5d
"compositor: Fix partial repaints"
as the fix to:
https://bugs.freedesktop.org/show_bug.cgi?id=56538
The issue fixed by that commit was making the geometry dirty on every
attach, which caused full-surface repaints every time. The bug was
probably introduced by the opaque region changes during implementing
wl_surface.commit. The mentioned commit fixes the opaque handling by
comparing the new and old regions.
However, the commit also introduces additional checks that set
geometry.dirty. In the current code base, this should be unnecessary.
If the pending.sx or pending.sy are not zero, or if the surface size
changes, the configure() hook is responsible for applying the new
values, and so also marking the geometry dirty.
The configure() hook is only called, if there has been a new
wl_surface.attach. Nothing else can change these variables, so this
should be enough.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
When an axis (scroll) event results in a key binding function
being executed, eat the scroll event so the underlying window
doesn't receive it.
Thanks to Scott Moreau for helping me solve this.
Before this change, surface->clip would contain the region of this the
surface that is obscured by opaque containing of other surfaces in any
plane. If a surface was obscured only by a surface in another plane and
the renderer was told to draw that region, the rendering would be
clipped because of that.
This patch changes the clip to be plane specific, so that it contains
only the region of the surface obscured by other surfaces in the same
plane. We also calculate a per plane clip, so that we don't tell the
renderer to draw regions of the primary plane that are obscured by
other planes. This damage remains on the primary plane until the its
clip changes so that they are not obscured anymore.
The current semantics would implicitly attach the most recently attached
buffer at commit time and send a release event when the buffer enventually
was released. The implicit attach is a little too subtle though and this
patch changes the semantics to always only send release events in response
to an attach event. As a consequence, once a compositor releases a buffer,
it no longer has a reference to it and wl_surfcea.damage is undefined.
Thus, the client side visible change is that damage request must always
be preceeded by a wl_surface.attach request, to ensure there's a valid buffer,
even if that means attaching the same buffer again.
Nothing else calls weston_buffer_post_release and the ref-counting and
sending the release event is essentially what weston_buffer_reference is
all about.
We never init this, so we need to copy over the position matrix and then
overwrite the translation entries to make sure we have a valid matrix.
Thanks to Pekka for spotting this (twice).
This way the shell can know when a surface has been unmapped by
checking the value returned by weston_surface_is_mapped(surface).
The configure handlers have now width and height parameters, so
they do not need anymore to check manually the buffer size.
If a surface's buffer is NULL the width and height passed to the
configure are both 0.
Configure is now only called after an attach. The variable
weston_surface.pending.newly_attached is set to 1 on attach, and
after the configure call is reset to 0.
Previously, when coming back from idle the compositor would try to
track if the unlock signal needed to be sent, and the shell would
change the compositor state in order to track when to display or
hide the screensaver.
This patch finishes moving this out of the compositor. With this, the
compositor state should be changed only using the exported functions
weston_compositor_wake() and weston_compositor_sleep(). The unlock
signal will be sent if the compositor wasn't in the ACTIVE state
previously. The lock signal is sent when the compositor becomes idle.
The calls to weston_compositor_wake() in the shell where there to allow
it to trigger the fade in only after the lock surface was configured.
Now the shell has full control of the fade and does not needed to
change the compositor state to do that, so those calls were replaced
with shell_fade() calls.
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
Because seat_get_keyboard is called after initial
weston_surface_activate, wl_data_device_set_keyboard_focus
fails to send data offer for newly connected client due to
wl_seat.focus_resource being NULL.
This patch calls wl_data_device_set_keyboard_focus
in seat_get_keyboard, so it can send data offer for
newly created client (when wl_keyboard.resource_list
and wl_seat.focus_resource are properly set up).
https://bugs.freedesktop.org/show_bug.cgi?id=60617
This patch installs the three header files that define the compositor
plugin interface as well as a pkg-config file. This allows
building weston plugins outside the weston tree. We currently don't make
any guarantees about the plugin API/ABI except that within a stable
branch we won't break it.
libunwind has a dwarf parser and automatically queries the dlinfo
for location of dlopened modules. The resulting backtrace is much
better and includes stack frames in dynamically loaded modules.
krh: Originally submitted for Xorg, adapted for weston:
http://lists.x.org/archives/xorg-devel/2013-February/035493.html
Note this require libunwind at least 1.1 to get the pkg-config files.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
When fading in, if a repaint was triggered after a call to
weston_compositor_fade() but before the first call to fade_frame(),
the fade surface wouldn't be drawn because its alpha channel wasn't
initialized properly.
Introduce several matrix transform types and track type for matrix.
Could be usefull for activating some fastpath that depends on some
transform type.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
When an output suffers a mode switch, it is possible that a pointer
was inside the old output area but falls outside of it with the new
size. In that case, move the cursor to the output's bottom-right
corner. Otherwise, there's a crash in clip_pointer_motion().
After a mode switch, the output region and transformation matrix need
to be updated. The call to weston_output_move() would do the former but
not the latter, but calling that when the output remains in the same
coordinate doesn't make much sense. Instead, update this state and the
transformation matrix in weston_output_mode_switch().
Make overlays work when the client uses a buffer with the same
transformation as the output.
In order to calculate the destination rectangle, the same logic in
weston_surface_to_buffer_float() is needed, but with the output
dimensions instead. For that reason, this patch generalizes this
function into weston_transformed_{coord,rect} and moves it to util.c.
The surface functions are then implemented using those.
A client can reliably avoid allocating a second buffer per surface, if
the compositor sends the wl_buffer.release event before the frame
callback. To enable clients' single-buffering, release the wl_buffer
early if possible. Otherwise clients will double-buffer.
Releasing early is not possible, if the backend needs the buffer for
migrating a surface to or from a non-primary weston_plane. In that case,
a new buffer must arrive, before the old can be released. Backends will
indicate this by setting weston_surface:keep_buffer to 1 in
assign_planes().
A proper buffer reference in the backends would be better than the
keep_buffer flag, but that would require a per-surface backend private.
The rpi and DRM backends are updated to set keep_buffer, other backends
do not support planes, so do not have to set it.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>