This patch implements the wp_pointer_constraints protocol used for
locking or confining a pointer. It consists of a new global object with
two requests; one for locking the surface to a position, one for
confining the pointer to a given region.
In this patch, only the locking part is fully implemented as in
specified in the protocol, while confinement is only implemented for
when the union of the passed region and the input region of the confined
surface is a single rectangle.
Note that the pointer constraints protocol is still unstable and as
such has the unstable protocol naming conventions applied.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniels@collabora.com>
A wp_relative_pointer object is an extension to the wl_pointer interface
only used for emitting relative pointer events. It will only emit events
when the parent pointer has focus.
To get a relative pointer object, use the get_relative_pointer request
of the global wp_relative_pointer_manager object.
The relative pointer protocol is currently an unstable protocol, so
unstable protocol naming conventions has been applied.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Provide timestamps with microsecond granularity if the backend can
provide it. Backends that can't should set it to 0.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Adds a weston_view_activate() that can be passed an additional active
flag WESTON_ACTIVATE_CLICKED, that the shell passes when a view was
activated by clicking.
This allows shell-independent components implement heuristics depending
on how a view was activated.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Although it currently only has one available flag, but that'll change.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Currently, weston assumes a surface/view is mapped if
it has an output assigned. In a zero outputs scenario,
this isn't really desirable.
This patch introduces a new flag to weston_surface and
weston_view, which has to be set manually to indicate
that a surface/view is mapped.
v2:
- Remove usage of new flags from
weston_{view,surface}_is_mapped at this point. They
will be added after all the implicit mappings have
been introduced
- Unmap a surface before unmapping a view so the input
foci is cleaned up properly
- Remove implicit view mapping from view_list_add
- Cosmetic fixes
v3:
- Rebased to apply on git master
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This patch follows a similar approach taken to detach the backends from
weston. But instead of passing a configuration struct when loading the
plugin, we use the plugin API registry to register an API, and to get it
in the compositor side. This API allows to spawn the Xwayland process
in the compositor side, and to deal with signal handling. A new
function is added in compositor.c to load and init the xwayland.so
plugin.
Also make sure to re-arm the SIGUSR1 when the X server quits.
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
[Pekka: moved xwayland/weston-xwayland.c -> compositor/xwayland.c]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Implement a simple register and lookup for function tables. This is
intended for plugins to expose APIs to other plugins.
It has been very hard to arrange a plugin to be able to call into
another plugin without modifying Weston core to explicitly support each
case. This patch fixes that.
The tests all pass.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Place it with the other weston_seat functions.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The name suggests that it activates surfaces, but the code says it
rather just assigns keyboard focus. Rename it for clarity, and so the
original function name could be used for something more appropriate
later. Switch order of parameters since keyboard focus is a property of
the seat. Update all callers as appropriate.
Change was asked for by pq, May 26, 2016:
"This should be called weston_seat_set_keyboard_focus(seat, surface).
Keyboard focus is a property of the seat."
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
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]
Migrate from wl_scaler to wp_viewporter extension. The viewporter.xml
file is provided by wayland-protocols.
This stops Weston from advertising wl_scaler, and advertises
wp_viewporter instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
[Pekka: fix wayland-protocols requirement]
When an output permanently changes its resolution, the output on the right
should be moved accordingly. We also add an event for output resizing so that
plugins can react when an output is resized.
Signed-off-by: David Fort <contact@hardening-consulting.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Change weston_compositor_load_backend() to use an enum to choose the
backend.
The caller no longer needs to know what the backend DSO is called in the
file system. Custom backends cannot be laoded anymore, as the loading
path is now always either LIBWESTON_MODULEDIR, or formed from
$WESTON_BUILD_DIR.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Backends do not have access to command line elements nor weston_config
anymore. They use the backend-specific config APIs now.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Move load_backend_new() from main.c to weston_compositor_load_backend()
in compositor.c.
This makes libweston load its own backends without leaking the details
to the user.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
The config can now be retrieved with a new function defined in weston.h,
wet_get_config(weston_compositor*).
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
They belong in the compositor rather than libweston since they
set signals handlers, and a library should not do that behind its
user's back. Besides, they were using functions in main.c already
so they were not usable by other compositors.
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This patch splits screensooter.c so that the code implementing
the private screenshooter protocol and launching the client is
moved to a weston specific file, leaving only the code that can
be shared between compositors in screenshooter.c.
Two exported functions are added in screenshooter.c to start and
stop the recorder.
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
weston_compositor_xkb_destroy() is called automatically so having only
weston_compositor_xkb_init() to be called by the user was a bit weird.
So rename it so that it makes more sense.
Also export it, since libweston compositors need to call it.
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
weston_surface::output and weston_view::output as used for different
purposes. Only the surface output is used for frame callbacks.
The uses of the view output are much more vague and hard to describe.
Also fix a comment mistake in weston_surface_assign_output().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
[Pekka: more verbose on the compositor.h comments]
a7af70436b converted the surface list into
a view list. There is no weston_compositor::surface_list anymore.
It looks like weston_surface::output's comment about surface list does
not apply to view list. Still, many places assume weston_surface::output
is not NULL when processing "visible" surfaces, e.g. those reachable via
the view list.
The comment on weston_view::output is updated. It seems there is no
longer any requirement for it to be NULL if the view is not in
view_list.
weston_view::link is documented to be in weston_compositor::view_list,
and weston_compositor::view_list is documented to contain weston_views.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
[Pekka: removed also the other "Must be NULL" comment.]
This will allow plugins to be aware of e.g. panels, to avoid covering
them with other surfaces.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
With this struct versioning, it is possible to add new options without
breaking the ABI, as long as all additions are made to the end of a
struct and nothing existing is modified or removed. When things are
added, the structure's size will increase, and we'll use this size as
our minor version number. If existing things need to be changed, then
the major version, struct_version, is incremented to indicate the ABI
break.
From our call sites in main these major and minor version will be
recorded as struct_version and struct_size. Each backend will then
verify these against its own assumptions. So long as the backend's
struct is equal or larger than what was passed in and the major versions
are equal, we're good; but if it is larger, then this is a fatal error.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
v6:
- Document refs for alternatives/assumptions for backend configs
v5:
- Move the header changes to a pre-requisite patch from the drm backend
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
[Pekka: bring back the archive links Bryce looked up.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Remove the input event loop.
After "compositor-x11: stop using input_loop", the input event loop is
completely unused.
The code was also broken because it did not account for multiple outputs
with independent repaint cycles.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
This patch is a further step in the wl_fixed_t internal sanitization.
It changes the notify_* functions to take doubles instead of wl_fixed_t
but does not change how these are stored in the various input structs
yet, except for weston_pointer_axis_event.
However this already allows to remove all wl_fixed_t usage in places
like the libinput or the x11 backend.
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Remove the unstable presentation_timing.xml file, and use
presentation-time.xml from wayland-protocols instead to generate all the
Presentation extension bindings.
The following renames are done according to the XML changes:
- generated header includes
- enum constants and macros prefixed with WP_
- interface symbol names prefixed with wp_
- protocol API calls prefixed with wp_
Clients use wp_presentation_interface.name rather than hardcoding the
global interface name: presentation-shm, weston-info, presentation-test.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
[Pekka: updated wayland-protocols dependency to 1.2]
Set up a keyboard grab during drag-and-drop, so we can translate
modifiers into preferred actions. The compositor chosen action
is stored in the current weston_data_source in order to make it
accessible to the source/offer at the time of calculating the new
action, but would conceptually be part of weston_drag.
The mapping has been made similar to what GTK+/QT usually do, the
shift key defaults to "move" and ctrl defaults to "copy".
Changes since v2:
- Use enum types and values for the compositor action. Fix
code formatting issues.
Changes since v1:
- Handle the keyboard grab being cancelled. Initialize new
wl_data_source fields.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
The policy in weston in order to determine the chosen DnD action is
deliberately simple, and is probably the minimals that any compositor
should be doing here.
Besides honoring the set_actions requests on both wl_data_source and
wl_data_offer, weston now will emit the newly added "action" events
notifying both source and dest of the chosen action.
The "dnd" client has been updated too (although minimally), so it
notifies the compositor of a "move" action on both sides.
Changes since v8:
- Add back wl_data_offer.source_actions emission, gone during last
code shuffling. Fix nits found in review.
Changes since v7:
- Fixes spotted during review. Add client-side version checks.
Implement .action emission as specified in protocol patch v11.
Changes since v6:
- Emit errors as defined in DnD actions patch v10.
Changes since v5:
- Use enum types and values for not-a-bitfield stored values.
handle errors when finding unexpected dnd_actions values.
Changes since v4:
- Added compositor-side version checks. Spaces vs tabs fixes.
Fixed resource versioning. Initialized new weston_data_source/offer
fields.
Changes since v3:
- Put data_source.action to use in the dnd client, now updates
the dnd surface like data_source.target events do.
Changes since v2:
- Split from DnD progress notification changes.
Changes since v1:
- Updated to v2 of DnD actions protocol changes, implement
wl_data_offer.source_actions.
- Fixed coding style issues.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Weston now sends wl_data_source.dnd_drop_performed and .dnd_finished in
order to notify about the different phases of DnD.
wl_data_source.cancelled is also used as mentioned in the docs, being
emitted also on DnD when the operation is meant to fail (eg. source
and dest didn't agree on a mimetype).
The dnd demo is also fixed so the struct dnd_drag isn't leaked.
https://bugs.freedesktop.org/show_bug.cgi?id=91943https://bugs.freedesktop.org/show_bug.cgi?id=91944
Changes since v6:
- Add client-side version checks. Minor code shuffling.
Changes since v5:
- Dissociate source and offer after cancel. Updated to
apply on top of c9f8f8a7f.
Changes since v4:
- Make wl_data_offer.finish with the wrong state an error.
Changes since v3:
- Fixed wl_data_source.dnd_finished vs cancelled emission on
when interoperating with version < 3 drag destinations.
Changes since v2:
- Handle wl_data_offer.finish. Fixed commit log inconsistencies.
Added version checks. Spaces vs tabs fixes. Fixed resource
versioning.
Changes since v1:
- Updated to protocol v2.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
[jonas: only send focus wl_pointer.frame if resource supports it]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Use an event struct to pass axis events around. This helps dealing with the
upcoming axis discrete changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Add a new boolean weston.ini option, "vt-switching" to enable or
disable Ctrl-Alt-Fn key combinations.
Signed-off-by: Bob Ham <bob.ham@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
(Derek Foreman changed the prototype for switch_vt_binding to
have a weston_keyboard * instead of weston_seat *. The pointer
wasn't used, so this is just a warning fix.)
The xwm used to automatically send to Xwayland the position of X windows
when that changed, using the x,y of the primary view of the surface.
This works fine for the desktop shell but less so for others.
This patch adds a 'send_position' vfunc to the weston_shell_client that
the shell will call when it wants to let Xwayland know what the position
of a window is.
The logic used by the desktop-shell for that is exactly the same the xwm
used to have.
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
We already have notify_touch(), notify_touch_frame(). We need
notify_touch_cancel() to implement touch in the weston wayland backend
properly.
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Add an implementation of wl_surface.damage_buffer, similar to
wl_surface.damage except it uses buffer co-ordinates.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
The function 'weston_surface_to_buffer' is unused by compositor and
clients inside weston, so it should be safe to remove this function
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This variable may have been used previously when evdev.c was used
however that functionality seems to have been consumed by libinput, so
there is no need for this variable in the weston_seat structure anymore.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
We're going to use this to replace much of the other transform code so
it's no longer just relevant to pixman-renderer.c
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
[Pekka: add the warning about matrix restrictions]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Keep all per client wl_pointer resources in a new struct called
'weston_pointer_client'. When focus changes, instead of moving a list
of resources between different lists, just change the focused pointer
client.
The intention with this is to make it easier to add wl_pointer
extensions that share the same focus as the corresponding wl_pointer.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Instead of only passing absolute pointer coordinates, effectively
loosing motion event data, pass a struct that can potentially contain
different types of motion events, currently being absolute and relative.
A helper function to get resulting absolute coordinates was added for
when previous callbacks simply used the (x, y) coordinates.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Don't only send motions and buttons but also axis events through the
pointer grab interface.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>