Commit Graph

485 Commits

Author SHA1 Message Date
Bryce Harrington e9b8a2b853 compositor: Drop unneeded create_output callback
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-18 12:03:53 +03:00
Pekka Paalanen 87953b7e62 compositor: remove input_loop
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>
2016-03-24 16:51:20 +02:00
Giulio Camuffo 90a6fc659f input: use doubles in the interfaces to notify of input events
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>
2016-03-23 14:05:09 +02:00
Pekka Paalanen b00c79b587 protocol: migrate to stable presentation-time.xml
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]
2016-03-07 13:29:27 +02:00
Carlos Garnacho b288988e83 data-device: Implement compositor-chosen actions
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>
2016-01-19 12:34:36 +08:00
Carlos Garnacho 9c93179023 data-device: Implement DnD actions
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>
2016-01-19 12:34:35 +08:00
Carlos Garnacho 78d4bf9a3e data-device: Implement DnD progress notification
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=91943
https://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>
2016-01-19 12:34:35 +08:00
Peter Hutterer 87743e9303 Support axis source, axis discrete, frame and axis stop events
[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>
2016-01-19 12:33:26 +08:00
Peter Hutterer 89b6a4931e Add a weston_pointer_axis_event
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>
2016-01-19 10:53:16 +08:00
Bob Ham 91880f1e9e compositor-{drm, fbdev, rpi}: Make VT switching configurable
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.)
2016-01-12 09:21:28 -06:00
Bryce Harrington c2be85777e compositor: Fix a couple comment typos
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-12-22 14:36:48 +02:00
Giulio Camuffo f05d18f3ee xwm: let the shells decide the position of X windows
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>
2015-12-18 11:48:25 -06:00
Derek Foreman 3cc004a650 input: Add notify_touch_cancel()
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>
2015-12-08 13:04:46 -06:00
Derek Foreman 152254be0d compositor: Add damage_buffer
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>
2015-12-03 09:45:32 -06:00
Chris Michael 6207b6af09 compositor: Remove unused weston_surface_to_buffer function
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>
2015-12-01 16:19:07 -06:00
Chris Michael 6172c38ef4 compositor.h: Remove unused variable from weston_seat structure
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>
2015-11-23 23:47:04 -08:00
Derek Foreman bc9a61cc23 compositor: Move weston_matrix_transform_region to compositor.c and export it
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>
2015-11-20 15:27:55 +02:00
Derek Foreman 060cf11f23 compositor: Change "touched" to bool
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-20 15:27:55 +02:00
Jonas Ådahl 2cbf293b05 input: Keep per client pointer resources in their own structs
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>
2015-11-20 11:52:19 +08:00
Jonas Ådahl d2510105a6 input: Make pointer grab motion callbacks take an event struct
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>
2015-11-20 11:44:56 +08:00
Jonas Ådahl 0336ca0cc5 input: Pass axis events through pointer grab interfaces
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>
2015-11-02 14:30:16 +08:00
Bryce Harrington 32c3211e38 compositor: Disallow negative geometries in backend output configs
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2015-10-29 13:52:22 -07:00
Giulio Camuffo 93daabbc71 compositor: pass the backend config struct to the backends init function
Add new configuration argument to the backend_init() function, which
will replace the current argc, argv, and config arguments.
After each backend is converted individually the unused parameters
will be removed.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-23 15:23:37 -07:00
Giulio Camuffo e3c0d8af43 compositor: introduce structs to handle backends configuration
This commit introduces the structs weston_backend_config and
weston_backend_output_config, to prepare for the new config
system for the backends.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-23 15:23:32 -07:00
Giulio Camuffo 6850e7b9e1 zoom: Remove unneeded usage of wl_fixed_ts in favour of doubles
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-09 11:13:44 -05:00
Pekka Paalanen 230f3b1bf8 dmabuf: implement linux_dmabuf extension
v2 changes:
- implement the revised protocol
- add basic sanity checks when creating buffer and check for support
- add way to attach user data to the dmabuf for renderer use
- bump max number of planes to 4 to follow DRM AddFb2 ioctl
- improve errors handling
- use separate linux_dmabuf_buffer fields for the different wl_resource
  types
- as SERVER_ERROR code is no more, use a wl_display "generic" error for
  emergency-disconneting a client we fail to process
- more documentation
- change y-invert from per-plane boolean to per-buffer flag

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-08-14 15:53:25 +03:00
Derek Foreman f9318d1452 input: add a weston_pointer_clear_focus() helper function
Valgrind has shown that in at least one place (default_grab_pointer_focus)
we're testing uninitialized values coming out of weston_compositor_pick_view.

This is happening when default_grab_pointer_focus is called when there is
nothing on the view list, and during the first repaint when only the black
surface with no input region exists.

This patch adds a function to clear pointer focus and also set the sx,sy
co-ordinates to a sentinel value we shouldn't compute with.

Assertions are added to make sure any time pointer focus is set to NULL
these values are used.

weston_compositor_pick_view() now returns these values too.

Now the values are always initialized, even when no view exists, and
they're initialized in such a way that actually doing computation
with them should fail in an obvious way, but we can compare them
safely for equality.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-08-06 16:28:30 +01:00
Derek Foreman e4d6c83986 desktop-shell: Make resize and move functions take a pointer instead of a seat
An earlier patch made surface_resize() and surface_move() take pointers
instead of seats, this updates the weston_shell_interface resize and move to
match.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-08-06 16:16:14 +01:00
Derek Foreman 1281a36e3b input: Don't test keyboard/pointer/touch pointers
Keyboards and pointers aren't freed when devices are removed, so we should
really be testing keyboard_device_count and pointer_device_count in most
cases, not the actual pointers. Otherwise we end up with different
behaviour after removing a device than we had before it was inserted.

This commit renames the touch/keyboard/pointer pointers and adds helper
functions to get them that hide this complexity and return NULL when
*_device_count is 0.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-07-31 15:16:09 -07:00
Derek Foreman 22276a596a zoom: Store the seat that initiated a zoom
Track the seat that initiated a seat instead of picking the first one.

Previously, if there are multiple seats then any seat can adjust the zoom
level but the zoom tracks the first seat's pointer.

Now the zoom will follow the pointer of the seat that initiated the zoom.

Additionally, if there's no pointer in the first seat, starting a zoom
with the second seat will no longer crash weston.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-29 19:54:17 -07:00
Derek Foreman a36eb50973 zoom: Change zoom->active to a bool
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-29 19:44:02 -07:00
Derek Foreman 99a6a2db4c bindings: Make run binding functions take apropriate device instead of a seat
Going from seat to input device requires that we test the device
before relying on the pointer.  In all of these binding functions
we can trust exactly one input device type directly.  If we pass
that in instead of a seat it's more obvious that we can trust
the one pointer we have.

When a seat is required, we can access through the device we have
and use that to get to other device types for the seat, provided
we validate them appropriately.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:04:40 -07:00
Derek Foreman 8ae2db5b0c input: Pass the appropriate pointer type to bindings instead of a seat
Normally we need to check if a seat's [device_type]_count is > 0 before
we can use the associated pointer.  However, in a binding you're
guaranteed that the seat has a device of that type.  If we pass in
that type instead of the seat, it's obvious we don't have to test it.

The bindings can still get the seat pointer via whatever->seat if they
need it.

This is preparation for a follow up patch that prevents direct access
to seat->device_type pointers, and this will save us a few tests at
that point.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:03:43 -07:00
Giulio Camuffo 459137bfe6 compositor: add API to manage compositor instances
This commit adds three new exported functions:
- weston_compositor_create() returns a new weston_compositor instance,
initializing it as the now removed weston_compositor_init() did.
- weston_compositor_exit(compositor) asks the compositor to tear
down by calling the compositor's exit vfunc which is set by the
libweston application.
- weston_compositor_destroy(compositor) is called by the libweston
application when tearing down the compositor. The compositor is destroyed
and the memory freed.

Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-07-10 11:59:08 +03:00
Giulio Camuffo 954f183e2f compositor: introduce struct weston_backend
This is a preliminary change for libweston, with no functional modifications.
Separate the backends and the core weston_compositor struct, by creating
the weston_compositor in the main(), and having the various backends extend
the weston_backend struct, an instance of which is returned by the backend
entry point.
This enable us to logically separate the compositor core from the backend,
allowing the core to be extended without messing with the backends.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-07-09 16:17:52 +03:00
Pekka Paalanen aa9536a992 text_backend: make destructor call explicit
We used to rely on the order in which the
weston_compositor::destroy_signal callbacks happened, to not access
freed memory. Don't know when, but this broke at least with ivi-shell,
which caused crashes in random places on compositor shutdown.

Valgrind found the following:

 Invalid write of size 8
    at 0xC2EDC69: unbind_input_panel (input-panel-ivi.c:340)
    by 0x4E3B6BB: destroy_resource (wayland-server.c:537)
    by 0x4E3E085: for_each_helper.isra.0 (wayland-util.c:359)
    by 0x4E3E60D: wl_map_for_each (wayland-util.c:365)
    by 0x4E3BEC7: wl_client_destroy (wayland-server.c:675)
    by 0x4182F2: text_backend_notifier_destroy (text-backend.c:1047)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)
  Address 0x67ea360 is 208 bytes inside a block of size 232 free'd
    at 0x4C2A6BC: free (vg_replace_malloc.c:473)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)

 Invalid write of size 8
    at 0x4E3E0D7: wl_list_remove (wayland-util.c:57)
    by 0xC2EDEE9: destroy_input_panel_surface (input-panel-ivi.c:191)
    by 0x4E3B6BB: destroy_resource (wayland-server.c:537)
    by 0x4E3BC7B: wl_resource_destroy (wayland-server.c:550)
    by 0x40DB8B: wl_signal_emit (wayland-server-core.h:264)
    by 0x40DB8B: weston_surface_destroy (compositor.c:1883)
    by 0x40DB8B: weston_surface_destroy (compositor.c:1873)
    by 0x4E3B6BB: destroy_resource (wayland-server.c:537)
    by 0x4E3E085: for_each_helper.isra.0 (wayland-util.c:359)
    by 0x4E3E60D: wl_map_for_each (wayland-util.c:365)
    by 0x4E3BEC7: wl_client_destroy (wayland-server.c:675)
    by 0x4182F2: text_backend_notifier_destroy (text-backend.c:1047)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)
  Address 0x67ea370 is 224 bytes inside a block of size 232 free'd
    at 0x4C2A6BC: free (vg_replace_malloc.c:473)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)

 Invalid write of size 8
    at 0x4E3E0E7: wl_list_remove (wayland-util.c:58)
    by 0xC2EDEE9: destroy_input_panel_surface (input-panel-ivi.c:191)
    by 0x4E3B6BB: destroy_resource (wayland-server.c:537)
    by 0x4E3BC7B: wl_resource_destroy (wayland-server.c:550)
    by 0x40DB8B: wl_signal_emit (wayland-server-core.h:264)
    by 0x40DB8B: weston_surface_destroy (compositor.c:1883)
    by 0x40DB8B: weston_surface_destroy (compositor.c:1873)
    by 0x4E3B6BB: destroy_resource (wayland-server.c:537)
    by 0x4E3E085: for_each_helper.isra.0 (wayland-util.c:359)
    by 0x4E3E60D: wl_map_for_each (wayland-util.c:365)
    by 0x4E3BEC7: wl_client_destroy (wayland-server.c:675)
    by 0x4182F2: text_backend_notifier_destroy (text-backend.c:1047)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)
  Address 0x67ea368 is 216 bytes inside a block of size 232 free'd
    at 0x4C2A6BC: free (vg_replace_malloc.c:473)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)

Looking at the first of these, unbind_input_panel() gets called when the
text-backend destroys its helper client which has bound to input_panel
interface. This happens after the shell's destroy_signal callback has
been called, so the shell has already been freed.

The other two errors come from
  wl_list_remove(&input_panel_surface->link);
which has gone stale when the shell was destroyed
(shell->input_panel.surfaces list).

Rather than creating even more destroy listeners and hooking them up in
spaghetti, modify text-backend to not hook up to the compositor destroy
signal. Instead, make it the text_backend_init() callers' responsibility
to also call text_backend_destroy() appropriately, before the shell goes
away.

This fixed all the above Valgrind errors, and avoid a crash with
ivi-shell when exiting Weston.

Also using desktop-shell exhibited similar Valgrind errors which are
fixed by this patch, but those didn't happen to cause any crashes AFAIK.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-06-26 09:33:54 +03:00
Jon Cruz 867d50eea7 Unified multiple definitions of container_of() macro.
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>
2015-06-15 17:11:58 -07:00
Jon Cruz d618f688d5 Moved the MIN() macro to the helper include.
Removed multiple definitions of the MIN() macro from existing
locations and unified with a single definition. Updated sources
to use the shared version.

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>
2015-06-15 17:11:52 -07:00
Jon Cruz 35b2eaa989 Moved helper macro to a discrete include file.
To help reduce code duplication and also 'kitchen-sink' includes
the ARRAY_LENGTH macro was moved to a stand-alone file and
referenced from the sources consuming it. Other macros will be
added in subsequent passes.

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>
2015-06-15 17:11:45 -07:00
Bryce Harrington a0bbfea64b src: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:18 -07:00
Giulio Camuffo 83285fceaf compositor: remove the authenticate vfunc
It was introduced in 5fcd0aa58e and
then used in code that doesn't exist anymore.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12 11:24:23 +03:00
Giulio Camuffo b114715dae compositor: send the output_created signal after inserting it in the list
The compositor's output_created signal used to be sent in weston_output_init()
which the backend call before putting the output in the output_list.
This caused problems when creating a new view in a listener to that signal,
because weston_view_assign_output() doesn't yet know the new output exists.
To fix this add a new weston_composito_add_output() func which adds the
output in the list and later sends the signal, and make the backends call
that.
2015-05-08 14:09:02 -07:00
Giulio Camuffo dddf9e67b7 data-device: add a function to send the selection to a client
This commit adds a new exported function, weston_seat_send_selection(),
which sends the current selection to a specified client. This is
useful e.g. to implement a clipboard manager as a special client.

Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-05-01 13:02:16 +01:00
Derek Foreman 4c93c08679 touch: Make weston_touch_set_focus() take a touch instead of a seat
The other set_focus() functions take the relevant type instead of a seat
already, so this is consistent.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-05-01 12:42:52 +01:00
Pekka Paalanen ca79076b03 compositor: change weston_surface::destroy_signal argument
Pass 'this' weston_surface as the data argument to
weston_surface::destroy_signal listeners. The old &surface->resource was
really just an offsetted pointer to the weston_surface anyway. And,
because 'resource' happened to be the first member in struct weston_surface,
it was actually 'this' weston_surface.

The argument type was accidentally changed in commit
26ed73cee8 from wl_resource* to
wl_resource**.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-30 14:51:40 +03:00
Giulio Camuffo a8e9b41578 xwm: tell the shell the pid of the X clients
All the surfaces from all the X clients share the same wl_client so
wl_client_get_credentials can't be used to get the pid of the X
clients.
The shell may need to know the pid to be able to associate a surface
with e.g. a DBus service.

[Pekka: fixed trivial merge conflicts.]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-30 16:04:57 +03:00
Derek Foreman c002321cd6 compositor: Create the inverse of the output matrix
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-27 09:16:41 +02:00
Pekka Paalanen 0513a95a06 compositor: add repaint delay timer
This timer delays the output_repaint towards the end of the refresh
period, reducing the time from repaint to present.

The length of the repaint window can be set in weston.ini.

The call to weston_output_schedule_repaint_reset() is delayed by one
more period.  If we exit the continuous repaint loop (set
output->repaint_scheduled to false) in finish_frame, we may call
start_repaint_loop() unnecessarily.  The problem case was actually
observed with two outputs on the DRM backend at 60 Hz, and 7 ms
repaint-window. During a window move, one output was constantly falling
off the continuous repaint loop and introducing additional one frame
latency, leading to jerky window motion. This code now avoids the
problem.

Changes in v2:

- Rename repaint_delay_timer to repaint_timer and
output_repaint_delay_handler to output_repaint_timer_handler.

- When computing the delay, take the current time into account. The timer
uses a relative timeout, so we have to subtract any time already gone.

Note, that 'gone' may also be negative. DRM has a habit of predicting
the page flip timestamp so it may be still in the future when we get the
completion event.

- Do also a sanity check 'msec > 1000'. In the unlikely case that
something fails to provide a good timestamp, never delay for more than
one second.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-20 12:19:29 +02:00
Pekka Paalanen 662f384e6a compositor, backends: weston_compositor_read_presentation_clock
Create a new function weston_compositor_read_presentation_clock() to
wrap the clock_gettime() call for the Presentation clock.

Reading the presentation clock is never supposed to fail, but if it
does, this will notify about it. I have not seen it fail yet, though.

This prepares for new testing features in the future that might allow
controlling the presentation clock. Right now it is just a convenience
function for clock_gettime().

All presentation clock readers are converted to call this new function
except rpi-backend's rpi_flippipe_update_complete(), because it gets its
clock id via a thread-safe mechanism. There shouldn't be anything really
thread-unsafe in weston_compositor_read_presentation_clock() at the
moment, but might be in the future, and weston core is not expected to
need to be thread-safe.

This is based on the original patch by
Cc: Derek Foreman <derekf@osg.samsung.com>

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-20 12:19:29 +02:00
Bryce Harrington a86c3ee697 Spellcheck fixes
./ivi-shell/README:19: protocal  ==> protocol
./src/compositor.h:596: seperate  ==> separate
./src/version.h.in:33: actualy  ==> actually
./src/cms-helper.h:44: embeded  ==> embedded
./protocol/fullscreen-shell.xml:65: seperate  ==> separate
./protocol/xdg-shell.xml:150: auxilliary  ==> auxiliary
./clients/window.c:1035: preferrably  ==> preferably

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-19 17:02:08 +02:00