Commit Graph

405 Commits

Author SHA1 Message Date
Pekka Paalanen b5eedade36 compositor: set and use the presentation clock everywhere
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>
2014-09-30 11:37:02 +03:00
Derek Foreman d1be3128d0 cosmetic: Move WL_EXPORT out of header files
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.
2014-09-22 10:16:38 +03:00
Giulio Camuffo 041a981a4e compositor: remove unused signal
The move_signal in weston_output isn't used, and not even initialized,
so anything trying to listen to it will crash on wl_signal_add().
Instead of it, the 'output_moved_signal' in weston_compositor is
used, so remove it.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-09 11:55:34 +03:00
Giulio Camuffo 6ef444d094 compositor: add a way to change the keyboard locks
This adds a function weston_keyboard_set_locks() which can be used to
change the state of the num lock and the caps locks, changing the leds too.
Only the evdev and libinput backends supports this, since it doesn't make
sense for embedded sessions.

Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-03 15:31:04 +03:00
Pekka Paalanen 9c1ac7b220 compositor: add weston_client_start()
weston_client_start() is a new wrapper around weston_client_launch(),
that does the process tracking on its own, and logs the process exit
status.

When users of weston_client_start() want to know when the process exits,
they should hook into the wl_client destroy signal. This works for cases
where the client is not expected to disconnect without exiting.

As wl_client destructor and the sigchld handler run in arbitary order,
it is usually difficult for users to maintain both struct weston_process
and a struct wl_client pointer. You would need to wait for both
destructor and handler to have run, before attempting to respawn the
client.

This new function relieves the caller from the burden of maintaining the
struct weston_process, assuming the caller is only interested in client
disconnects.

Cc: Boyan Ding <stu_dby@126.com>
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>
2014-08-28 10:15:10 +03:00
Jonny Lamb 66a41a06e7 compositor: fetch repeat info from weston.ini 2014-08-15 15:39:47 +03:00
Giulio Camuffo 95ec0f95aa compositor: add a masking mechanism to weston_layer
this adds a mechanism to mask the views belonging to a layer
to an arbitrary rect, in the global space. The parts that don't fit
in that rect will be clipped away.
Supported by the gl and pixman renderer only for now.
2014-07-23 12:34:33 -07:00
Giulio Camuffo 412e6a59eb compositor: keep track of the weston_layer a weston_view is in
This introduces a new struct, weston_layer_entry, which is now used
in place of wl_list to keep the link for the layer list in weston_view
and the head of the list in weston_layer.
weston_layer_entry also has a weston_layer*, which points to the layer
the view is in or, in the case the entry it's the head of the list, to
the layer itself.
2014-07-23 12:34:33 -07:00
Jasper St. Pierre ccf48fb4f9 shell: Replace set_margin with set_window_geometry
Currently, there is a fun flicker when toggling maximization or
fullscreen on a window in mutter or more sophisicated compositors
and WMs.

What happens is that the client want so go maximized, so we
calculate the size that we want the window to resize to (640x480),
and then add on its margins to find the buffer size (+10 = 660x500),
and then send out a configure event for that size. The client
renders to that size, realizes that it's maximized, and then
says "oh hey, my margins are actually 0 now!", and so the compositor
has to send out another configure event.

In order to fix this, make the the configure request correspond to
the window geometry we'd like the window to be at. At the same time,
replace set_margin with set_window_geometry, where we specify a rect
rather than a border around the window.
2014-07-17 13:59:01 -07:00
Jason Ekstrand 7b98207667 Create a weston_surface_state structure for storing pending surface state and move the surface commit logic into weston_surface_commit_state
This new structure is used for both weston_surface.pending and
weston_subsurface.cached.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2014-07-07 09:12:57 -07:00
Jason Ekstrand e9d40e3ff5 Move weston_subsurface to after weston_surface
It makes more sense there.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2014-07-07 09:11:54 -07:00
George Kiagiadakis 8f9e87ff47 compositor: update the surface size when there is a size change without a buffer attach
This fixes at least the case where you want to do wl_viewport.set_destination
to resize the surface but without attaching new content in it.
2014-06-19 10:04:18 -07:00
Jasper St. Pierre ac985be8ce compositor: Remove the edges parameter from send_configure
send_configure was originally modelled after
wl_shell_surface::send_configure, which takes these arguments. However,
the X WM and xdg_surface::configure variants don't use these arguments.

We already store the resize edges for a surface while it's being
resized, so just use the saved state in the wl_shell_surface variant.
2014-04-30 20:53:15 -07:00
Jasper St. Pierre d67b52a501 compositor: Fix the documentation for surface->configure
It's called on commit, not on attach. Additionally, correct the
interface name to be wl_surface, not surface.
2014-04-30 20:48:55 -07:00
Kristian Høgsberg e5c1ae9368 xwayland: Set decoration margin for xwayland windows 2014-04-30 16:28:41 -07:00
Jonas Ådahl 1679f232e5 libinput: Forward frame events to clients
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77353

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-04-21 16:03:28 -07:00
Kristian Høgsberg f03a04afac compositor: Add create_surface_signal
This signal is emitted when a client creates a surface, not for internal
surfaces.
2014-04-06 22:22:04 -07:00
Jason Ekstrand 9fc7151991 Add possible capabilities CURSOR_PLANE and ARBITRARY_MODE
The CURSOR_PLANE capability indicates that the backend has a concept of a
cursor plane and can handle a cursor without compositing.  This is currently
only advertised by the DRM backend.

The ARBITRARY_MODE flag specifies that the backend is capable of switching to
virtually any resolution.  This is currently only advertised in the RDP
backend.  While it's a bit buggy right now, it should be capable of this.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:25:27 -07:00
Jason Ekstrand a4ab5422e9 Add a signal for when a seat updates its capabilities
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:24:42 -07:00
Giulio Camuffo e9022e79c8 compositor: add an exported function to take a screenshot of an output
This allows other screenshooter protocols to use the same code to copy
the screen to a buffer.
2014-04-02 11:27:42 -07:00
Pekka Paalanen 0b4c535d73 protocol,compositor: split wl_viewport setters
Bump wl_scaler and wl_viewport versions to 2. Add new requests
wl_viewport.set_source and .set_destination, which are meant to replace
wl_viewport.set request.

Now a client can set and unset just one of source rectangle and
destination size. Define the semantics when one of these is unset.

Implement these semantics changes in compositor and pixman renderer.
GL-renderer does not need changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-04-01 16:46:40 -07:00
Pekka Paalanen f0cad4844c compositor: replace weston_buffer_viewport::viewport_set
Remove the explicit boolean variable, and use illegal width to denote
"not set".

Split the boolean into two, so we can later start having buffer.src_*
and surface.* set or not set independently. This may become useful when
the wl_viewport interface is changed to allow modifying them separately.

At the moment, both buffer.src_width and surface.width conditions are
always in sync.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-04-01 16:46:40 -07:00
Pekka Paalanen 952b6c8004 compositor: reorganize struct weston_buffer_viewport
Queueing in the Presentation extension requires splitting the viewport
state into buffer state and surface state. To conveniently allow
assigning only one, the other, or both, reorganize the
weston_buffer_viewport structure.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-04-01 16:46:40 -07:00
Kristian Høgsberg db1fccb3d8 input: Send leave and enter pair when the surface moves under the cursor
The client needs to know that the pointer is at a different position in
its surface.  We can't send motion as that corresponds to the pointer
actually moving.  Leaving the surface and entering at the new position
is a better semantic match and doesn't correspond to pointer motion
or user input.

https://bugs.freedesktop.org/show_bug.cgi?id=71927
2014-02-18 13:47:41 -08:00
Kristian Høgsberg e11ef64534 compositor: Drop core ping_handler callout
This was always a little iffy.  At least it could have been a signal,
but we now have focus signal, so lets just use that.  We lose
the ability to detect unresponsive clients at key event time, but we
could add that back by adding a key_signal.
2014-02-11 16:35:22 -08:00
Ander Conselvan de Oliveira c94d6229dc compositor: Move view repositioning logic into shell
Remove the listener for output destroy from weston_view and instead
iterate views owned by the shell in its own output destroy listener.

This simplifies the code a bit since keeping the view listening for the
destroy on the right output was a bit complicated. This also removes the
function pointer output_destroyed from weston_view. The only user for it
was desktop shell, but now this is all handled in shell.c.
2014-02-05 17:36:00 -08:00
Ander Conselvan de Oliveira a8a9baf873 compositor: Remove weston_output::move_signal
Since that signal is per output, it is necessary to track in which
output a view is in so that the signal is handled properly.

Instead, add a compositor wide output moved signal, that is handled by
the shell. The shell iterates over the layers it owns to move views
appropriately.
2014-02-05 17:32:35 -08:00
Ander Conselvan de Oliveira f84327aef2 input: Remove exported function weston_pointer_verify()
Instead, add a compositor signal that an output has been destroyed and
handle that case locally in input.c.
2014-02-01 01:36:05 -08:00
Pekka Paalanen b0420aeb3d protocol: rename wl_surface_scaler to wl_viewport
This seems like a better name, and will not conflict if someone later
extends wl_surface with a request scaler_set (yeah, unlikely).

This code was written by Jonny Lamb, I just diffed his branches and made
a patch for Weston.

Cc: Jonny Lamb <jonny.lamb@collabora.co.uk>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-01-08 21:33:19 -08:00
Kristian Høgsberg 2fce4808dd input: Remap touch point IDs from multiple touch screens to not overlap
With multiple touch screens on one seat, the touch points IDs from the
different evdev devices may overlap.  We have to remap the IDs we forward
to core weston so that the touch points all have unique IDs within the seat.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73003
2014-01-08 16:21:24 -08:00
Jonny Lamb 7413076f82 compositor: transform surface coordinates if a surface scaler is used
Implements wl_surface_scaler.set by setting desired
src_{x,y,width,height} and dst_{width,height} values in the
weston_buffer_viewport struct, then altering coordinates in
weston_surface_to_buffer* functions if there is a scaler set for said
surface.
2013-12-16 22:38:07 -08:00
Jason Ekstrand 5c11a3340b Add a weston_surface_set_size function
Surfaces that are created by clients get their size automatically updated
by the attach/commit.  Surfaces created directly by shells (such as black
surfaces) sometimes need to be manually resized.  This function allows you
to do that while being somewhat less messy than messing with the internals
of weston_surface manually.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-12-16 17:23:09 -08:00
Zhang, Xiong Y 31236932a1 desktop-shell: Invalidate saved position when output is destroyed
If the saved position for a fullscreen or maximized output view is in an
output that has been unplugged, the coordinates don't make sense
anymore. In that case, invalidate them and use the initial position
algorithm when changing them back to the basic state.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2013-12-16 17:23:08 -08:00
Ander Conselvan de Oliveira 54e90c7e1e compositor: Make pointers visible when an output is unplugged
Previously, if a pointer was inside an output that was unplugged, it
could potentialy end up outside any valid output forever. With this
patch, the pointer is moved to the "closest" output to the pointer.
2013-12-16 17:23:08 -08:00
Ander Conselvan de Oliveira e1e2352dcc compositor: Don't repaint outputs being destroyed
Set a flag when an output is being destroyed and use that to avoid
repainting. This allows functions that schedule an output repaint to
be called when the output is being destroyed without causing the
compositor to crash.
2013-12-16 17:23:01 -08:00
Zhang, Xiong Y 010d0b1695 compositor: Ensure views are visible if their output was unplugged
Use the output destroy signal to move the views in the event the output
was unplugged.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2013-12-16 16:46:22 -08:00
Zhang, Xiong Y f301241d1a compositor: Move views when outputs are moved
Previously, when an output was moved due to another output being
unplugged, the views on the first output would remain in the same
position.

This patch adds an output_move signal that the views listen too in
order to repostion themselves in the event of an unplug.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2013-12-16 16:23:11 -08:00
Giulio Camuffo 1aaf3e42e2 sdk: make C++11 plugins build again
compositor.h must not define a 'static_assert' macro, since that
conflicts with the new 'static_assert' in the standard and breaks
the build.
2013-12-09 16:20:48 -08:00
Kristian Høgsberg 8d344a0548 shell: Make sure the shell implementation and protocol versions match 2013-12-08 22:27:11 -08:00
Jonas Ådahl 7395ea05c7 input: Move the xkb fields from weston_seat to weston_keyboard
XKB integration is a keyboard feature and should as such be kept track
of in the keyboard struct.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-03 08:38:25 -08:00
Jason Ekstrand 918f2dd4cf Remove the weston_view.geometry.width/height fields
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.
2013-12-02 22:17:58 -08:00
Jonas Ådahl 9484b695b9 input: Keep track of number of touch points inside touch struct
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-02 15:24:05 -08:00
Philip Withnall 83ffd9d17b shell: Remove weston_view_restack()
It’s tied too deeply into the shell’s window stacking and ordering code
to legitimately be split out into compositor.c. Inline it in the shell,
and refactor some code around it a little, tidying up the stacking
behaviour for fullscreen surfaces.
2013-12-02 11:44:51 -08:00
Pekka Paalanen da75ee1de0 compositor: merge surface size from buffer size funcs
Replace the two functions getting the intended surface dimensions from
the surface's buffer and buffer transformation parameters by a single
function that just set the surface size according to all the buffer
state.

The old functions were always called in pairs, and always assigned to
the surface dimension variables.

This function also deals with a NULL buffer by setting the dimensions to
zero, just like the callers used to do.

The new function has no users outside this source file, so do not export
it. This basically unexports the old functions.
2013-11-28 14:14:10 -08:00
Pekka Paalanen 1fd9c0f81a compositor: gather buffer_transform and _scale into a struct
Gather the variables affecting the coordinate transformations between
buffer and local coordinates into a new struct weston_buffer_viewport.

This will be more useful later, when the crop & scale extension is
implemented.
2013-11-28 14:14:05 -08:00
Xiong Zhang fd51e7bb57 src/data_device.c: add dnd support for touch screen
Adding the drag and drop grab interface for touch screen in
src/data-device.c, so the server can handle touch screen
drag and drop operation.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
2013-11-25 16:32:00 -08:00
Giulio Camuffo 576fe2af4b input: set the focus to NULL when the focus's resource is destroyed
with the surface ref-count feature a surface may live on after its
resource was destroyed. so listen for the resource destroy signal
and set the focus to NULL.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-20 16:59:00 -08:00
Emilio Pozuelo Monfort aa7a4761f6 input: Don't send leave events to destroyed views
If a view which has focus is destroyed, we would send a leave
event while changing focus, causing a segfault. Prevent this
by listening to the view's destroy signal and removing it from
the pointer focus.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2013-11-19 11:49:40 -08:00
Daniel Stone a67e6b9818 Add move/scale animation
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]
2013-11-19 11:49:28 -08:00
Daniel Stone 96d47c0ef7 Add modifier-only binding
Add the ability to bind to modifiers; the binding is armed when a key
which sets the requested modifier is pressed, and triggered if the key
is released with no other keys having been pressed in the meantime, as
well as mouse buttons or scroll axes.

This only works for direct modifiers (e.g. Shift and Alt), not modifiers
which latch or lock.

[pochu: rebased]
2013-11-19 11:49:25 -08:00