When running a key binding we don't send the key press to the client
via the wl_keyboard.key event. Instead, send a wl_keyboard.leave/enter
pair so that the client knows the actual state of the keyboard.
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
We don't care which box contained the point, so don't pass one in.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
calloc (and zalloc) set the allocated memory to 0, so there's really no
need to do it manually.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
[Pekka: dropped the src/evdev.c hunk.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
While the test is actually correct (for non-negative numbers), it's not
at all clear and seems to be an accidental order of operations mistake.
Also, add an assert() to make sure this number is never negative.
Closes bug 86346 - https://bugs.freedesktop.org/show_bug.cgi?id=86346
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
When getting the focus we get the list of pressed keys, but we are
not supposed to run the key binding on them.
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
We now allow --transform with the headless compositor, however it still
doesn't parse anything out of weston.ini
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Allow the headless backend to render into an off screen buffer with pixman.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Weston's idle timeout can already be set via the '-i' command-line
option, but this patch lets users specify it also via weston.ini.
Note that the command-line option takes precedence over the .ini,
should the option be set by both.
This patch also Updates weston.ini man page with idle-timeout bits
https://bugs.freedesktop.org/show_bug.cgi?id=83921
Signed-off-by: Frederic Plourde <frederic.plourde@collabora.co.uk>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Pixman uses y-x banded rectangles to represent regions. We use these
y-x banded rectangles to generate triangle fans, resulting in more
geometry than strictly necessary to draw the screen.
This patch combines the bands to reduce geometry for complex scenes.
Acked-by: "Jasper St. Pierre" <jstpierre@mecheye.net>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Most of the backends do their own parsing of transform strings, so let's
put that all in the same place (compositor.c/h)
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This reverts commit 5c11fc6fb7.
According to two input specialists, this was the wrong way:
http://lists.freedesktop.org/archives/wayland-devel/2014-November/018287.html
Cc: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Giulio Camuffo <giuliocamuffo@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
If there are several things that cause an exit, keep the error code from
the first one, not the last one. The latter ones could be just fallout
from the first.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Currently, once we've reached our main's wl_display_run(), we always
return ret=EXIT_SUCCESS when weston terminates through wl_display_terminate.
This patch makes it possible to specify another return value by setting
prior to terminating Weston. This is useful for automated tests that want
to report test failures to the overlying testing infrastructure.
Signed-off-by: Frederic Plourde <frederic.plourde@collabora.co.uk>
[Pekka: fixed some tabs.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
weston key bindings are supposed to eat the key events, and not pass it
on to clients, and indeed the wl_keyboard.key event is not sent. But
we must also not put the key in the keys array to pass to client with
the wl_keyboard.enter event, or else we may send the 'eaten' one too.
In the case of a key binding hiding a surface having the keyboard focus,
the shell may decide to give the focus to another surface, but that will
happen before the key is released, so the new focus surface will receive
the code of the bound key in the wl_keyboard.enter array.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
the keyboard focus surface may not have a valid resource (server side
surface or a surface surviving its client), so check if it is valid
before using it.
Acked-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The comments already call it bool, so let's just make it one
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
commit 6ae7bc982f accidentally made weston_output_mode_switch_temporary
send done events when it shouldn't.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
use wl_list_for_each_safe to iterate on the bindings list when
firing them, this way a binding can safely be destroyed in its
function handler.
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This breaks weston_output_mode_switch() into 3 functions:
weston_output_mode_set_native()
weston_output_mode_switch_to_temporary()
weston_output_mode_switch_to_native()
Differences from previous behaviour:
SET_NATIVE didn't set current_scale (now it does)
SET_TEMPORARY could set mode and scale independently - now it can't.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Commit 280e7dd918 introduced a bug in the
return value of weston_subsurface_is_synchronized().
Signed-off-by: Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
For functions that test if something is true/valid and return a 1
or 0, it makes sense to switch to bool.
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
output_rotate_damage shifted an array of pixman regions with a loop. Now
it uses an index into that array.
This currently only saves 1 pixman_region32_copy, but we can now raise
BUFFER_DAMAGE_COUNT without a performance impact if we run into a
configuration where this is useful.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
With the more accurate definition of wl_surface roles in Wayland,
enforce the restriction: a role is always set permanently, and
attempting to change it is a protocol error.
This patch is based on Jasper's patch:
http://lists.freedesktop.org/archives/wayland-devel/2014-August/016811.html
The difference in this patch compared to his are:
- send role errors on the interface whose request triggers it, not on
wl_surface
- an interface could have several requests assigning different roles,
cannot use wl_interface as the unique key; use an arbitary string
instead
- ensure in window-manager.c that create_shell_surface() ->
create_common_surface() is never called with surface->configure set,
to avoid compositor abort
- use wl_resource_post_no_memory() where appropriate instead of
hand-rolling it with wl_resource_post_error()
Ideally we would not add weston_surface::role_name field, but use
weston_surface::configure. At the moment this is not possible though,
because at least shell.c uses several different roles with the same
configure function. Drag'n'drop uses two configure functions for the
same role. The configure hook is also reset in several places,
which is not good for role tracking.
This patch overlooks the wl_surface roles assigned in privileged
extensions: screensaver, panel, background, lock, input panel.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Add 'msc' field to weston_output to maintain the refresh counter, and
use it in presentation_feedback.presented.
Make compositor-drm update the per-output refresh counter with the
values reported by DRM. If the DRM reported value jumps backwards,
assume it wrapped around once.
Other backends do not update weston_output::msc, and there
presentation_feedback will always deliver refresh counter as zero.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v3 Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Implement the presentation.feedback request, and the
presentation_feedback protocol interface. Feedback information is
delivered to clients as the backend reports it, except the refresh
counter (MSC) which is always reported as zero.
Changes in v4:
* add 'flags' argument to 'presented' event without implementation
Changes in v5:
* remove the 'destroy' method implementation for feedback objects
[Pekka Paalanen: do not leak struct feedback.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v3 Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Add presentation clock setters that verify the given clock actually
works. Offer an automatic choice of a software fallback clock, when a
backend has to always use clock_gettime() to approximate the
presentation time.
The DRM backend already queried the DRM about the clock id, just let the
DRM backend set the presentation clock from that.
For all other backends which do not get a timestamp from the driver,
call the software clock setter to choose a suitable clock.
Report the chosen clock via presentation.clock_id event to clients.
In finish_frame(), upgrade the argument from uint32_t milliseconds to
struct timespec which can accurately hold the presentation clock values.
This will be needed when weston_output_finish_frame() starts to send out
presentation_feedback.presented events.
While at it, replace gettimeofday() calls with clock_gettime() using the
chosen presentation clock, so we manufacture presentation timestamps
from the presentation clock when the gfx drivers cannot give us a proper
timestamp.
Rpi patch is more verbose due to not having the compositor pointer
available in rpi_flippipe_update_complete(). Explicitly carry the clock
id with flippipe so it is available in the thread.
Changes in v4:
* rpi debug build fix
v4 Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v3 Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
You can bind to the global interface, and it delivers a fake clock id.
All requests on it raise an error.
Changes in v4:
* queuing methods were extractracted for a later series
[Louis-Francis Ratté-Boulianne: split queuing feature]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Most of the code only puts WL_EXPORT in .c files. Remove the few
instances in header files.
If it's missing form the associated .c, put it there instead.
Set the default logging level from libinput to INFO. This matches better
the behaviour of the old input backend, and prints the found input
devices into Weston's log.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
Initial key state is no pressed keys, and the libinput_device_get_keys
function was deprecated in libinput 0.6.0.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
WL_CALIBRATION, introduced in weston-1.1, requires the translation component
of the calibration matrix to be in screen coordinates. libinput does not have
access to this and it's not a very generic way to do this anyway. So with
the libinput backend, WL_CALIBRATION support is currently broken (#82742).
This cannot be fixed in libinput without changing its API for this specific
use-case.
This patch lets weston take care of WL_CALIBRATION. It takes the original
format and normalizes it before passing it to libinput. This way libinput
still does the coordinate transformation, weston just needs to provide the
initial configuration.
Note that this needs an updated libinput, otherwise libinput will try to
transform coordinates as well.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82742
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When backend_init returns NULL, we goto out_signals, which wants to
free(modules), but in this particular code path, modules hasn't been
initialised leading to a "Double-free or corruption" error message.
Initialising modules to NULL makes the free a no-op in this scenario.
Signed-off-by: Ondřej Majerech <majerech.o@gmail.com>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
weston_surface_update_transform() no longer exists, except in comments.
Fix that.
[Pekka Paalanen: don't lose the full comment in compositor-drm.c.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
If a cursor was set with wl_pointer.set_cursor but not in combination
with an action that has the side effect of damaging the region where the
cursor is positioned, it would not be drawn. This patch explicitly
schedules a repaint of the pointer sprite when it is set.
clickdot is updated to illustrate the bug; when moving the pointer over
clickdot, the pointer is hidden. When not having moved the pointer for
500 ms it is made visible using wl_pointer.set_pointer.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>