Commit Graph

237 Commits

Author SHA1 Message Date
Simon Ser
3ab56ef8fa protocol: allow to send a zero output refresh rate
Fixed refresh rate doesn't always make sense for all outputs. In case
it's not available or not relevant, allow compositors to send zero.

For instance the can be the case for virtual outputs.

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-04-27 21:44:04 +00:00
Harish Krupo
ea11878d00 wayland.xml: document invalid_finish error in wl_data_offer.finish
Explicitly state that the invalid_finish protocol error would be raised
when wl_data_offer.finish request is sent for non drag-and-drop
operations.

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2019-04-19 22:02:08 +05:30
Simon Ser
8c121e1017 protocol: warn clients about some wl_output properties
All wl_output properties don't always make sense for all
compositors.

Some compositors might not implement a "global compositor space",
(e.g. 3D compositors) in which case properties like x and y don't
make sense.

Some compositors might expose virtual outputs, in which case modes,
make and model are not relevant.

In a lot of these situations, information from xdg_output is better
suited.

Compositors also expose output refresh rate, which shouldn't be used
for synchronization purposes.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derek.foreman.wayland@gmail.com>
2019-02-20 10:07:05 -06:00
Christopher James Halse Rogers
d325140289 proto, server: Add internal server error message. (v2)
Many languages such as C++ or Rust have an unwinding error-reporting
mechanism. Code in these languages can (and must!) wrap request handling
callbacks in unwind guards to avoid undefined behaviour.

As a consequence such code will detect internal server errors, but have
no way to communicate such failures to the client.

This adds a WL_DISPLAY_ERROR_IMPLEMENTATION error to wl_display so that
such code can notify (and disconnect) clients which hit internal bugs.
While servers can currently abuse other wl_display errors for the same
effect, adding an explicit error code allows clients to tell the
difference between errors which are their fault and errors which are the
server's fault. This is particularly interesting for automated bug
reporting.

v2: Rename error from "internal" to "implementation", in sympathy with
    X11's BadImplementation error.
    Add more justification in the commit message.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-01-29 15:58:19 +02:00
Simon Ser
921d054803 protocol: prefer wl_surface.damage_buffer
This commit makes wl_surface.damage_buffer preferred over wl_surface.damage.
wl_surface.damage can be implemented in a non-optimal way by the compositor
(e.g. by always damaging the whole buffer).

Having two requests makes it complicated for the compositor to handle damage,
making it necessary to transform one into the other's coordinates.

Moreover, integration with wp_viewporter is tricky.

Signed-off-by: Simon Ser <contact@emersion.fr>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-11-30 09:25:14 -06:00
Derek Foreman
905c0a341d protocol: Bump seat to version 7 and require keymaps be private
Weston commit 76829fc4eaea329d2a525c3978271e13bd76c078 (and similar
commits for other compositors) protects the compositor's keyboard
mapping from client damage by duplicating the keymap for every
client.

On some systems there are other potential fixes for this - such as
using sealed memfds on linux - but we can't use them since
essentially all client code anywhere has mapped the keyboard map
with a MAP_SHARED mmap() call.

While we can't break years worth of code, we can require any future
clients to use MAP_PRIVATE if they use a seat version above 6.

If a compositor can't use sealing or a similar facility, it should
still protect itself with copied keymaps, but clients must always
assume shared mapping of a keymap will fail.

Signed-off-by: Derek Foreman <derek.foreman.samsung@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Philipp Kerling <pkerling@casix.org>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-11-30 09:17:57 -06:00
Simon Ser
504db9d8e5 protocol: allow to send a zero physical output size
Physical size doesn't always make sense for all outputs. In case
it's not available or not relevant, allow compositors to send zero.

Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
2018-07-24 11:26:17 +01:00
Derek Foreman
ff992951a7 tests: Check for wrong fd delivery with zombie objects
Until recently, if an event attempting to deliver an fd to a zombie
object was demarshalled after the object was made into a zombie, we
leaked the fd and left it in the buffer.

If another event attempting to deliver an fd to a live object was in that
same buffer, the zombie's fd would be delivered instead.

This test recreates that situation.

While this is a ridiculously contrived way to force this race - delivering
an event from a destruction handler - I do have reports of this race
being hit in real world code.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2018-01-09 15:20:00 +00:00
Derek Foreman
f74c9b98db tests: Add a test for fd leaks on zombie objects
Until recently, if a client destroying a resource raced with the
server generating an event on that resource that delivered a file
descriptor, we would leak the fd.

This tests for a leaked fd from that race condition.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2018-01-09 15:20:00 +00:00
Pekka Paalanen
de24f4dd76 protocol: make get_subsurface double-buffered
The existing specification was not explicitly clear on when
wl_subcompositor.get_subsurface request actually adds the sub-surface to
the parent in the compositor's scenegraph. The implicit assumption was
that this happens immediately, but it was not written anywhere.

If it happens immediately, the client doing things in a wrong order may
cause a glitch on screen. Particularly, if the wl_surface B that is
going to be a sub-surface for wl_surface A (the parent) already has a
buffer committed, and the parent surface is mapped, then get_subsurface
will (may?) cause wl_surface B to become mapped immediately. That leaves
no time to set up the sub-surface z-order or position before mapping,
hence there can be a visible glitch.

The way to avoid that, given that the parent surface is mapped, is to
not commit a buffer to wl_surface B until all the sub-surface setup is
done.

However, doing the sub-surface setup always requires a wl_surface.commit
on the parent surface unless the defaults happen to be correct.

To make setting up a subsurface slightly easier by removing one
possibility for a glitch, this patch amends the specification to require
a wl_surface.commit on the parent surface for get_subsurface to
complete. The sub-surface cannot become mapped before a parent commit.

This change may break existing clients that relied on the glitchy
sequence to not need a parent surface commit to map the sub-surface.
However, presumably all uses would at least issue a
wl_subsurface.set_position, which requires a parent surface commit to
apply. That would guarantee that there is a parent surface commit after
get_subsurface, and so reduces the chances of breaking anything.

In other cases, this change may simply remove a possibility for the
glitch.

This patch also adds a note about changing wl_surface.commit behaviour
on wl_subcompositor.get_subsurface. (That could be a separate patch.)

The behaviour of wl_subsurface.destroy remains as specified, even though
it is now slightly asymmetrical to get_subsurface. This is emphasized by
adding the word "immediately". The effects of destruction were already
explicitly documented, as is the way to achieve synchronized unmapping,
so changing destruction behaviour would likely be more disruptive, and
also open up more corner cases (what would happen between destroy and
unmapping?).

Bug: https://phabricator.freedesktop.org/T7358
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Martin Gräßlin <mgraesslin@kde.org>
2017-12-05 10:43:17 +00:00
Jonas Ådahl
698dde1958 protocol: Add deprecation note about wl_shell
Now that xdg_shell is stable and much better defined than wl_shell we
can finally deprecate wl_shell and guide users towards xdg_shell
instead.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-04 19:45:38 +00:00
Derek Foreman
f6bbc975d3 protocol: Suggest get_registry not be called frequently
I've heard some complaints that wl_display.get_registry "leaks"
server memory because wl_registry has no destructor.  While this isn't
strictly true - all those resources are freed when the client
disconnects - it's a bit of a gotcha for neophytes.

Since wl_registry's version is not requested in any way through
wl_display.get_registry, we can't add a destructor request without
breaking ABI.  So let's be a little more clear about the result
of getting too many wl_registry objects.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-10-02 11:45:56 +03:00
Peter Hutterer
2f72d0a8a8 protocol: add axis_source.wheel_tilt
Unlike a wheel rotation, a wheel tilt is a discrete-only axis. Wheel rotations
are mapped to degrees in libinput but that that does not apply to wheel tilt
axes where there is no physical equivalent.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-24 12:00:19 +02:00
Peter Hutterer
a26ed0949e protocol: indentation fixes
8 spaces changed to one tab

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
2016-11-21 11:43:22 +00:00
Peter Hutterer
b4636b5e60 protocol: spell out that we're using linux/input-event-codes.h button codes
Because we already rely on it in the callers anyway. This is a retrofit, which
is not ideal but I'm not sure any compositor out there uses anything else.
Might as well define it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 11:07:12 +00:00
Dennis Kempin
6a18a87727 protocol: Extend wl_touch with touchpoint shape and orientation
This CL updates the wl_touch interface with a shape and
orientation event.
The shape/orientation of a touch point is not relevant for most UI
applications, but allows a better experience in some cases
such as drawing apps.

The events are used by the compositor to inform the client
about changes in the shape and orientation of a touchpoint, which is
approximated by an ellipse and it's angle to the y-axis.

The event is optional and only sent when compositor and the
touch device support this type of information. The client is
responsible for making a reasonable assumption about the
touch shape if no shape is reported.

Signed-off-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-16 16:35:19 +00:00
Yong Bakos
66a26aeb2a protocol: Remove inconsistent line breaks
Enum entries and message arguments are sometimes preceded by a blank line, but
often aren't.

Standardize the format of the protocol specification by removing blank lines
preceding a list of message arguments and enum entries.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-10 16:41:40 +02:00
Yong Bakos
b802108f6e protocol: Use singleton global consistently
The protocol describes wl_shm as a "global singleton" rather than
"singleton global," which is the order used throughout other protocol
object descriptions.

Re-order the terms for consistency.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-10 13:11:17 +02:00
Yong Bakos
9e2e3bcaa7 protocol: Describe wl_registry as singleton
Other singleton objects in the protocol are described as such.

Add a singleton adjective to the wl_registry description, making it
similar to other descriptions.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-10 13:10:40 +02:00
Yong Bakos
2c8fc3eae2 protocol: Replace '#defines' with 'macros'
The use of # within a description causes the documentation generator
to mistake C syntax with a documentation link.

Remove the # from the documentation, suppressing the warning.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-09-13 15:31:41 +03:00
Yong Bakos
a285fa939c protocol: Specify upper left corner of damage rectangle
Specify x and y args as the upper left corner of the surface / buffer
damage rectangle.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:46:02 -07:00
Yong Bakos
8e7e52f335 protocol: Describe serial as serial number
Change "serial" to "serial number" in arg summaries, for consistency
and clarity.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:55 -07:00
Yong Bakos
7aa1f6cb2f protocol: Remove wl_ prefix from summary descriptions
Summary attributes sometime describe objects using their wl-prefixed type,
but more often don't.

Remove the wl_ prefix from summary descriptions, since they tend to describe
concepts.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:48 -07:00
Yong Bakos
40feca914b protocol: Correct description indentation
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:41 -07:00
Yong Bakos
3f1104d64c protocol: Add missing line break
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:34 -07:00
Yong Bakos
83ec381bf8 protocol: Capitalize ID for consistency
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:26 -07:00
Yong Bakos
aaf2c91873 protocol: Hyphenate subsurface
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:19 -07:00
Yong Bakos
d7cb6c3570 protocol: Add summary attributes to request params and enum entries
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:09 -07:00
Quentin Glidic
bad9dc5186 protocol: Add release (destructor) request to wl_output
Outputs come and go, and this is needed to clean up wl_resources on the
server side. All protocol objects need a way to be destroyed.

Cc: Neil Roberts <neil@linux.intel.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
[Pekka: added commit message]
2016-08-08 16:22:52 +03:00
Yong Bakos
c6d204fdbc protocol: Remove double line break
All vertical whitespace should manifest as a single blank line, never two.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-05-10 12:06:05 +08:00
Auke Booij
7ccf35d432 protocol: add support for cross-interface enum attributes
The enum attribute, for which scanner support was introduced in
1771299, can be used to link message arguments to <enum>s. However,
some arguments refer to <enum>s in a different <interface>.

This adds scanner support for referring to an <enum> in a different
<interface> using dot notation. It also sets the attributes in this
style in the wayland XML protocol (wl_shm_pool::create_buffer::format
to wl_shm::format, and wl_surface::set_buffer_transform::transform to
wl_output::transform), and updates the documentation XSL so that this
new style is supported.

Changes since v2:
 - add object:: prefix for all enumerations in the documentation
 - fix whitespace in scanner.c
 - minor code fixup to return early and avoid casts in scanner.c

Changes since v1:
 - several implementation bugs fixed

Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Nils Christopher Brause <nilschrbrause@googlemail.com>
Reviewed-by: Bill Spitzak <spitzak@gmail.com>
[Pekka: rebased across cde251a124]
[Pekka: wrap lines and space fixes in scanner.c]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-05-03 14:54:11 +03:00
Yong Bakos
e21aeb5d12 protocol: Add summaries to event parameters
All event arg elements now have an appropriate summary attribute.
This was conducted mostly in response to the undocumented parameter
warnings generated during 'make check'.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-02 18:14:43 -07:00
Yong Bakos
4db76023f8 protocol: Hyphenate compound adjective surface-local
Remove superfluous 'local' from 'buffer local'.
In addition, simplify the phrasing of local x/y coordinates in parameter
summaries.

See https://lists.freedesktop.org/archives/wayland-devel/2016-April/028249.html.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-04-29 16:38:05 -07:00
Yong Bakos
70850643f3 protocol: Correct grammar and spelling
Fix grammar, spelling, tense, and other inconsistencies, based on
correctness, consistency, and precedence both here and influenced
by wayland-protocols.

- Standardize lower case for summary attribute values.
- Minor vertical whitespace removal consistency.
- Standarize references to coordinates, preferring 'surface local'
- Fix spelling, grammar, tense, and punctuation.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
2016-04-21 15:12:01 -07:00
Eric Engestrom
e40a46ca21 protocol: fix spelling mistake
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
2016-04-05 16:03:11 -07:00
Jonas Ådahl
ed680954c8 protocol: Add note about per version requirements to wl_data_device_manager
Add a note to the wl_data_device_manager global interface about the
different requirements for operating the objects created from the bound
global.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-02-01 16:59:55 -08:00
Carlos Garnacho
da7b248904 protocol: Add DnD actions
These 2 requests have been added:

- wl_data_source.set_actions: Notifies the compositor of the available
  actions on the data source.
- wl_data_offer.set_actions: Notifies the compositor of the available
  actions on the destination side, plus the preferred action.

Out of the data from these requests, the compositor can determine the action
both parts agree on (and let the user play a role through eg. keyboard
modifiers). The chosen option will be notified to both parties
through the following two requests:

- wl_data_source.action
- wl_data_offer.action

In addition, the destination side can peek the source side actions through
wl_data_offer.source_actions.

Compared to the XDND protocol, there's two notable changes:

- XDND lets the source suggest an action, whereas wl_data_device lets
  the destination prefer a given action. The difference is subtle here,
  it comes off as convenience because it is the drag destination which
  receives the motion events (unlike in X) and can perform action updates.

  The drag destination seems also in a better position to update the
  preferred action based on things like the data being transferred, the
  place being dropped, and whether the drag is client-local.

- That same source-side preferred action is used in XDND to convey the
  modifier-induced action to the drag destination, which would then ack
  it, or reply with another action that's accepted (or none), this makes
  the XdndPosition/XdndStatus messaging very verbose, and synchronous
  because the drag source always needs to know the latest status/action
  for every position+action sent.

  Here it's the compositor which takes care of modifiers and matching
  available/accepted actions, this allows for the signaling to happen
  only whenever the actions/modifiers change for real.

Roughly based on previous work by Giulio Camuffo <giuliocamuffo@gmail.com>

Changes since v10:
- Narrow down the situations where wl_data_source/offer.accept requests
  are supposed to happen.

Changes since v9:
- Deferred the protocol errors to .finish after some IRC chat with Jonas,
  added further errors if actions API is used on selection sources/offers.

Changes since v8:
- Defined further the expected behavior on "ask", described the protocol
  errors that may happen. Fix more spaces vs tabs issues.

Changes since v7:
- Misc changes after updating the progress notification patch.

Changes since v6:
- Further explanations on wl_data_source/offer.set_actions, including a
  description of "ask" actions. Added protocol errors for unknown action
  values.

Changes since v5:
- Applied rewording suggestions from Jonas Ådahl. Dropped slot reservation
  scheme for actions. Fixed indentation and other minor formatting issues.

Changes since v4:
- Minor rewording.

Changes since v3:
- Splitted from DnD progress notification changes.
- Further rationales in commit log.

Changes since v2:
- Renamed notify_actions to set_actions on both sides, seems more consistent
  with the rest of the protocol.
- Spelled out better which events may be triggered on the compositor side
  by the requests, the circumstances in which events are emitted, and
  what are events useful for in clients.
- Defined a minimal common ground wrt compositor-side action picking and
  keybindings.
- Acknowledge the possibility of compositor/toolkit defined actions, even
  though none are used at the moment.
Changes since v1:
- Added wl_data_offer.source_actions to let know of the actions offered
  by a data source.
- Renamed wl_data_source.finished to "drag_finished" for clarity
- Improved wording as suggested by Bryce

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com>
Reviewed-by: Mike Blumenkrantz <zmike@samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-16 16:34:52 +08:00
Carlos Garnacho
5c4272b8e9 protocol: Improve data source notification around DnD progress
Currently, there's no means for the DnD origin to know whether the
destination is actually finished with the DnD transaction, short of
finalizing it after the first transfer finishes, or leaking it forever.

But this poses other interoperation problems, drag destinations might
be requesting several mimetypes at once, might be just poking to find
out the most suitable format, might want to defer the action to a popup,
might be poking contents early before the selection was dropped...

In addition, data_source.cancelled is suitable for the situations where
the DnD operation fails (not on a drop target, no matching mimetypes,
etc..), but seems undocumented for that use (and unused in weston's DnD).

In order to improve the situation, the drag source should be notified
of all stages of DnD. In addition to documenting the "cancelled" event
for DnD purposes, The following 2 events have been added:

- wl_data_source.dnd_drop_performed: Happens when the operation has been
  physically finished (eg. the button is released), it could be the right
  place to reset the pointer cursor back and undo any other state resulting
  from the initial button press.
- wl_data_source.dnd_finished: Happens when the destination side destroys
  the wl_data_offer, at this point the source can just forget all data
  related to the DnD selection as well, plus optionally deleting the data
  on move operations.

Changes since v6:
  - Turned wl_data_offer.finish calls with 0/NULL state/mimetype an
    error, made it explicit that it will only result in
    wl_data_offer.dnd_finished being sent if successful.

Changes since v5:
  - Further rewording of wl_data_offer.finish and wl_data_offer.accept.
    Added error for untimely wl_data_offer.finish requests.

Changes since v4:
  - Applied rewording suggestions from Jonas Ådahl. Added new
    wl_data_offer.finish request to allow explicit finalization on the
    destination side.

Changes since v3:
  - Renamed dnd_performed to a more descriptive dnd_drop_performed,
    documented backwards compatible behavior on wl_data_offer.accept and
    wl_data_source.cancelled.

Changes since v2:
  - Minor rewording.

Changes since v1:
  - Renamed events to have a common "dnd" namespace. Made dnd_performed to
    happen invariably, data_device.cancelled may still happen afterwards.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mike Blumenkrantz <zmike@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-16 16:34:52 +08:00
Peter Hutterer
c5356e9016 protocol: add wl_pointer.frame, axis_source, axis_stop, and axis_discrete
The frame event groups separate pointer events together. The primary use-case
for this at the moment is diagonal scrolling - a vertical/horizontal scroll
event can be grouped together to calculate the correct motion vector.
Frame events group all wl_pointer events. An example sequence of motion events
followed by a diagonal scroll followed by a button event is:
wl_pointer.motion
wl_pointer.frame
wl_pointer.motion
wl_pointer.frame
wl_pointer.axis
wl_pointer.axis
wl_pointer.frame
wl_pointer.button
wl_pointer.frame

In the future, other extensions may insert additional information about an
event into the frame. For example, an extension may add information about the
physical device that generated an event into the frame. For this reason,
enter/leave events are grouped by a frame event too.

The axis_source event determines how an axis event was generated. That enables
clients to judge when to use kinetic scrolling. Only one axis_source event is
allowed per frame and applies to all events in this frame.

The axis_stop event notifies a client about the termination of a scroll
sequence, likewise needed to calculate kinetic scrolling parameters.
Multiple axis_stop events within the same frame indicate that scrolling has
stopped in all these axis at the same time.

The axis_discrete event provides the wheel click count. Previously the axis
value was some hardcoded number (10), with the discrete steps this enables a
client to differ between line-based scrolling on a mouse wheel and smooth
scrolling with a touchpad. The axis_discrete event carries the axis
information and the discrete value and can occur at any time in the frame
provided it is ordered before the matching axis event. Specifically, this
sequence is valid:

wl_pointer.axis_source
wl_pointer.axis_discrete (vert)
wl_pointer.axis_discrete (horiz)
wl_pointer.axis (horiz)
wl_pointer.axis (vert)
wl_pointer.frame

Enter and leave event also trigger wl_pointer.frame events, where possible the
compositor should group leave and subsequent enter into the same frame. This
indicates to the client that the pointer has moved between surfaces and may
allow a client to shortcut code otherwise triggerd by the leave or enter
events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-14 15:29:44 +08:00
Peter Hutterer
87321d0f2f protocol: specify behavior of get_pointer when capabilities change
Also applies to touch/keyboard

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-12-07 14:26:47 -08:00
Derek Foreman
3384f69ecf protocol: Add wl_surface.damage_buffer
wl_surface.damage uses surface local co-ordinates.

Buffer scale and buffer transforms came along, and EGL surfaces
have no understanding of them.

Theoretically, clients pass damage rectangles - in Y-inverted surface
co-ordinates) to EGLSwapBuffersWithDamage, and the EGL implementation
passed them on to wayland.  However, for this to work the EGL
implementation must be able to flip those rectangles into the space
the compositor is expecting, but it's unable to do so because it
doesn't know the height of the transformed buffer.

So, currently, EGLSwapBuffersWithDamage is unusable and EGLSwapBuffers
has to pass (0,0) - (INT32_MAX, INT32_MAX) damage to function.

wl_surface.damage_buffer allows damage to be registered on a surface
in buffer co-ordinates, avoiding this problem.

Credit where it's due, these ideas are not entirely my own:
Over a year ago the idea of changing damage co-ordinates to buffer
co-ordinates was suggested (by Jason Ekstrand), and it was at least
partially rejected and abandoned.  At the time it was also suggested
(by Pekka Paalanen) that adding a new wl_surface.damage_buffer request
was another option.

This will eventually resolve:
https://bugs.freedesktop.org/show_bug.cgi?id=78190
by making the problem irrelevant.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-12-03 09:19:08 -06:00
Peter Hutterer
d5f22d29df protocol: fix a couple of whitespace issues
8 spaces is one tab

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-23 23:48:27 -08:00
Derek Foreman
a5ef9304fe protocol: Remove incorrect statement that attach must precede damage
The documentation for wl_surface.commit makes it clear that the
application of damage follows attach during the commit, so it
doesn't matter what order the app sends the requests.

Many existing apps post damage before attaching a buffer already,
and it's really quite reasonable to do so.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-11-20 10:25:33 -06:00
Peter Hutterer
e65aed4616 protocol: add the new bitfields to the dtd
See 851614fa78

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-17 14:36:21 +02:00
Peter Hutterer
0e86192114 protocol: allow for a <description> element below <protocol>
The scanner parses this already, it doesn't do anything with it though.

The DTD requires the order to be copyright, description, then the interfaces.
That's largely a DTD limitation, the scanner doesn't care.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-17 14:36:21 +02:00
Peter Hutterer
9d794d9f77 Revert "Remove protocol/wayland.dtd"
This reverts commit 06fb8bd371.

Having a DTD hooked up gives an indication of what we expect the protocol to
be, which is a clearer documentation than the current "whatever scanner.c
manages to parse".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-17 14:36:21 +02:00
Auke Booij
851614fa78 protocol: specify enum and bitfield attributes
Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@googlemail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Victor Berger <victor.berger@m4x.org>
2015-11-04 14:50:45 -08:00
Auke Booij
06fb8bd371 Remove protocol/wayland.dtd
The wayland scanner defines the protocol. The DTD specification is not used.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Nils Christopher Brause <nilschrbrause@googlemail.com>
2015-10-09 15:32:34 -05:00
FORT David
b6809e5a80 wayland: add a release request on wl_seat
This is required if we want to correctly remove a wl_seat compositor-side. A
wl_seat is announced as a global object, then it is bound by the client. When
the compositor wants to remove the seat, it shall announce the global removal of
the object. The client can then call the release request on the wl_seat (which
means I won't use that object anymore).

Acked-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-10-07 17:31:57 -07:00
Bryce Harrington
541b0cf24e protocol: Update boilerplate from MIT X11 license to MIT Expat license
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12 15:51:38 -07:00