platform/upstream/wayland.git
8 years agobuild: build distcheck with --enable-fatal-warnings
Derek Foreman [Fri, 15 Jan 2016 19:33:53 +0000 (13:33 -0600)]
build: build distcheck with --enable-fatal-warnings

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agobuild: Add an --enable-fatal-warnings configure option
Derek Foreman [Fri, 15 Jan 2016 19:33:52 +0000 (13:33 -0600)]
build: Add an --enable-fatal-warnings configure option

New --enable-fatal-warnings ./configure option that just adds -Werror
to GCC_CFLAGS

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoserver: validate resource versions at creation time
Derek Foreman [Fri, 15 Jan 2016 16:06:48 +0000 (10:06 -0600)]
server: validate resource versions at creation time

We shouldn't ever create a resource with version less than 1 or
greater than the interface version.

Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoresource-test: Use wl_seat instead of wl_display for testing
Derek Foreman [Thu, 14 Jan 2016 20:32:38 +0000 (14:32 -0600)]
resource-test: Use wl_seat instead of wl_display for testing

We're creating resources with versions up to 4.  wl_display isn't version 4,
so this is technically verifying that we can do something we shouldn't.

wl_seat already has versions this high, so switch to that.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoconfigure.ac: bump to version 1.10.90 for open development
Bryce Harrington [Wed, 17 Feb 2016 01:15:26 +0000 (17:15 -0800)]
configure.ac: bump to version 1.10.90 for open development

Master is open for new feature development again.

8 years agoconfigure.ac: bump to version 1.10.0 for the official release 1.10.0
Bryce Harrington [Tue, 16 Feb 2016 20:03:40 +0000 (12:03 -0800)]
configure.ac: bump to version 1.10.0 for the official release

8 years agoconnection: Don't add uninitialized memory as 4 byte alignment padding
Jonas Ådahl [Wed, 10 Feb 2016 15:35:44 +0000 (23:35 +0800)]
connection: Don't add uninitialized memory as 4 byte alignment padding

When we are adding padding bytes making our wl_buffer buffer content 4
byte aligned, we are just moving the pointer. Since the buffer is
allocated using plain malloc(), this means our padding bytes are
effectively uninitialized data, which could be anything previously
allocated in the server process. As we'll be sharing this buffer
content with arbitrary clients, we are effectively sharing private
memory with every client, and even though a well behaving client will
discard any such memory, a malicious client may not.

Therefor, to avoid any potential missuse of the uninitialized padding
memory shared between the server and client, initialize the buffer
content to 0, making the padding bytes always 0.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoconfigure.ac: bump to version 1.9.93 for the RC1 release 1.9.93
Bryce Harrington [Tue, 9 Feb 2016 21:26:21 +0000 (13:26 -0800)]
configure.ac: bump to version 1.9.93 for the RC1 release

8 years agocosmetic: add an space after if
Sergi Granell [Thu, 4 Feb 2016 20:48:21 +0000 (21:48 +0100)]
cosmetic: add an space after if

8 years agocosmetic: use tabs instead of spaces
Sergi Granell [Thu, 4 Feb 2016 20:35:07 +0000 (21:35 +0100)]
cosmetic: use tabs instead of spaces

8 years agoscanner: Fix oddities in copyright printing
Derek Foreman [Tue, 2 Feb 2016 20:56:57 +0000 (14:56 -0600)]
scanner: Fix oddities in copyright printing

Some copyright strings could result in broken generated header files with
unmatched */

This change:
Runs the loop long enough so the copyright[i] == 0 test can actually
happen. (if there was no \n no copyright text was printed, */ still was)

Prints the opening /* even if there was whitespace at the start of
the very first line.

Only emits a */ if a /* was printed.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoconfigure.ac: bump to version 1.9.92 for the beta release 1.9.92
Bryce Harrington [Tue, 2 Feb 2016 23:30:36 +0000 (15:30 -0800)]
configure.ac: bump to version 1.9.92 for the beta release

8 years agoscanner: Print filename on DTD validation error
Jonas Ådahl [Mon, 25 Jan 2016 09:28:06 +0000 (17:28 +0800)]
scanner: Print filename on DTD validation error

Don't just print prefix the errors with "protocol", but the actual file
name, if wayland-scanner was passed with the filename of the protocol
file. If wayland-scanner is reading from stdin, errors will be prefixed
with "<stdin>" instead of "protocol".

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoserver: Fail to bind object when requested version is 0
Derek Foreman [Thu, 14 Jan 2016 19:33:52 +0000 (13:33 -0600)]
server: Fail to bind object when requested version is 0

0 is not a valid version number for registry bind requests, so
let's check for it in registry_bind.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agocosmetic: return NULL instead of 0
Marek Chalupa [Wed, 27 Jan 2016 09:06:28 +0000 (10:06 +0100)]
cosmetic: return NULL instead of 0

we're returning a pointer

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoprotocol: Add note about per version requirements to wl_data_device_manager
Jonas Ådahl [Mon, 18 Jan 2016 10:18:16 +0000 (18:18 +0800)]
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>
8 years agoserver: Fix possible wl_display_add_socket_fd memleak
Sergi Granell [Mon, 1 Feb 2016 18:35:51 +0000 (19:35 +0100)]
server: Fix possible wl_display_add_socket_fd memleak

If wl_event_loop_add_fd failed, the fail path didn't free the
newly allocated struct wl_socket.
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoconfigure.ac: re-bump to version 1.9.91 for the alpha release 1.9.91
Bryce Harrington [Tue, 19 Jan 2016 22:54:32 +0000 (14:54 -0800)]
configure.ac: re-bump to version 1.9.91 for the alpha release

8 years agoserver: Add an API to get the file descriptor for a client
Sung-Jin Park [Thu, 14 Jan 2016 07:03:43 +0000 (16:03 +0900)]
server: Add an API to get the file descriptor for a client

This adds an API to get the file descriptor for a client.
The client file descriptor can be used for a wayland compositor to validate
a request from a client if there are any additional information provided from
the client's file descriptor.

For instance, this will be helpful in some linux distributions, in which SELinux
or SMACK is enabled. In those environments, each file (including socket) will have
each security contexts in its inode as xattr member variable. A wayland compositor
can validate a client request by getting the file descriptor of the client and
by checking the security contexts associated with the file descriptor.

Signed-off-by: Sung-Jin Park <input.hacker@gmail.com>
8 years agoconfigure.ac: bump to version 1.9.91 for the alpha release
Bryce Harrington [Tue, 19 Jan 2016 22:30:33 +0000 (14:30 -0800)]
configure.ac: bump to version 1.9.91 for the alpha release

8 years agotests: Test proxy versions
Derek Foreman [Tue, 12 Jan 2016 22:15:04 +0000 (16:15 -0600)]
tests: Test proxy versions

Add a test that confirms that proxy versions are always 0 for display
and correct otherwise.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agoTrack protocol object versions inside wl_proxy.
Jason Ekstrand [Thu, 12 Nov 2015 19:53:15 +0000 (13:53 -0600)]
Track protocol object versions inside wl_proxy.

This provides a standardized mechanism for tracking protocol object
versions in client code.  The wl_display object is created with version 1.
Every time an object is created from within wl_registry_bind, it gets the
bound version.  Every other time an object is created, it simply inherits
it's version from the parent object that created it.

(comments and minor reformatting added
by Derek Foreman <derekf@osg.samsung.com>)

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Second trivial commit squashed into this one:
Authored by Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
(it's literally one of code and a lot of comments)

This sets wl_display's version (for proxy version query purposes)
to 0.  Any proxy created with unversioned API (this happens when
a client compiled with old headers links against new wayland)
will inherit this 0.

This gives us a way for new libraries linked by old clients to
realize they can't know a proxy's version.

wl_display's version being unqueryable (always returning 0) is
an acceptable side effect, since it's a special object you can't
bind specific versions of anyway.

Second half:
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agotests: Test that one can fetch the protocol error after EPIPE
Jonas Ådahl [Mon, 28 Dec 2015 06:33:36 +0000 (14:33 +0800)]
tests: Test that one can fetch the protocol error after EPIPE

If a client is terminated due to some reason, it should always be
possible to retrieve protocol error associated with the termination.
Test that, while either using the dispatch helpers
(wl_display_dispatch(_queue)() or the prepare read API, it should be
possible to retrieve the error after EPIPE.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: Pass argument to client main
Jonas Ådahl [Mon, 28 Dec 2015 03:25:00 +0000 (11:25 +0800)]
tests: Pass argument to client main

Change the API to pass an "void *" argument to the client main
function, allowing the caller to call the same main function with
different input.

A helper (client_create_noarg) is added for when no argument is passed,
and the existing test cases are changed to use this function instead.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: Synchronize client termination in idle callback
Jonas Ådahl [Thu, 24 Dec 2015 04:41:46 +0000 (12:41 +0800)]
tests: Synchronize client termination in idle callback

We currently wait for clients in the wl_client destroy signal, which is
called before the client is destructed and the socket is closed. If test
clients rely on being closed due to the socket being closed we'd dead
lock. Avoid this by synchronizing in an idle task that is called after
the client is fully destroyed.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agoclient: Fully flush during blocking dispatch
Jonas Ådahl [Mon, 28 Dec 2015 06:50:12 +0000 (14:50 +0800)]
client: Fully flush during blocking dispatch

wl_display_flush() may fail with EAGAIN which means that not all data
waiting in the buffer has been flushed. We later block until there is
data to read, which could mean that we block on input from the
compositor without having sent out all data from the client. Avoid this
by fully flushing the socket before starting to wait.

This commit also changes the array length of the struct pollfd array
from 2 to 1, as only one element was ever used.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agoclient: Use read preparation API in wl_display_dispatch_queue()
Jonas Ådahl [Fri, 2 Oct 2015 09:11:13 +0000 (17:11 +0800)]
client: Use read preparation API in wl_display_dispatch_queue()

Instead of doing things that do the equivalent of using
wl_display_prepare_read() and friends, just use the public API. The
only semantical difference is that we will now unlock and lock the mutex
more times compared to before.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agoclient: Don't make EPIPE fatal if triggered when flushing
Jonas Ådahl [Mon, 28 Dec 2015 06:35:50 +0000 (14:35 +0800)]
client: Don't make EPIPE fatal if triggered when flushing

If flushing hits EPIPE it should not make it a fatal error since it
would make it impossible to process the rest of the data available in
the buffer. Instead, let reading the socket make EPIPE fatal, letting
the client have the possibility to process the last messages including
any error causing the termination.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agoclient: Remove misplaced documentation about main loop intergration
Jonas Ådahl [Fri, 2 Oct 2015 03:18:12 +0000 (11:18 +0800)]
client: Remove misplaced documentation about main loop intergration

There was documentation about how to integrate the display server file
descriptor in the documentation about wl_display_dispatch_pending().
This is not the right place to put it, and it also had incorrect usage
of the API (calling wl_display_dispatch_queue() on input on an unrelated
fd) as an example.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agoclient: Correct documentation regarding thread safeness
Jonas Ådahl [Fri, 2 Oct 2015 03:12:02 +0000 (11:12 +0800)]
client: Correct documentation regarding thread safeness

The current documentation about wl_display_dispatch() states one may not
mix wl_display_dispatch(_queue)() with wl_display_prepare_read() and
friends, but this is a misconception about how
wl_display_dispatch(_queue)() works. The fact is that the dispatch
functions does the equivalent of what the preparation API does
internally, and it is safe to use together.

What is not safe is to dispatch using the wl_display_dispatch(_queue)()
functions while being prepared to read using wl_display_read_events().

This patch rewrites the documentation to correctly state when the
various API's are thread safe and how they may not be used.

https://bugs.freedesktop.org/show_bug.cgi?id=91767

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agoprotocol: Add DnD actions
Carlos Garnacho [Fri, 15 Jan 2016 20:11:40 +0000 (21:11 +0100)]
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>
8 years agoprotocol: Improve data source notification around DnD progress
Carlos Garnacho [Fri, 15 Jan 2016 20:11:39 +0000 (21:11 +0100)]
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>
8 years agoserver: Test for illegally low interface versions in wl_global_create()
Derek Foreman [Thu, 14 Jan 2016 17:02:18 +0000 (11:02 -0600)]
server: Test for illegally low interface versions in wl_global_create()

Any version lower than 1 is unreasonable.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agoserver: improve failure log message for wl_global_create()
Derek Foreman [Thu, 14 Jan 2016 17:02:17 +0000 (11:02 -0600)]
server: improve failure log message for wl_global_create()

The gratuitous %m jammed onto the end of the string prints errno
concatenated with the word "version".

I've removed the %m, and printed some additional information about the
failure.

Also, reversed the order of the expressions in the conditional to
make it match the english in the log message.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agoprotocol: add wl_pointer.frame, axis_source, axis_stop, and axis_discrete
Peter Hutterer [Tue, 8 Dec 2015 01:11:07 +0000 (11:11 +1000)]
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>
8 years agosocket-test: Refactor if check into the assert
Bryce Harrington [Tue, 8 Dec 2015 06:49:14 +0000 (22:49 -0800)]
socket-test: Refactor if check into the assert

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agosocket-test: Fix some comment typos
Bryce Harrington [Tue, 8 Dec 2015 06:49:13 +0000 (22:49 -0800)]
socket-test: Fix some comment typos

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoserver: don't send an error to NULL display_resource
Marek Chalupa [Mon, 11 Jan 2016 10:45:12 +0000 (11:45 +0100)]
server: don't send an error to NULL display_resource

if display_resource = wl_resource_create() fails in bind_display(),
we call wl_client_post_no_memory() which is wrong, since this function
uses display_resource (which is NULL at this point).
said simply: don't send an error to resource that you've just failed to create)

https://bugs.freedesktop.org/show_bug.cgi?id=91356

Reported-by: Ashim <ashim.shah@samsung.com>
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoclient: Add missing arg in a wl_log invocation
Victor Berger [Mon, 4 Jan 2016 10:09:01 +0000 (11:09 +0100)]
client: Add missing arg in a wl_log invocation

Without this 'proxy' argument, the '%p' formatter prints a constant
garbage value.

Signed-off-by: Victor Berger <victor.berger@m4x.org>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
8 years agoserver: Calculate remaining data size after a closure is processed
Jaeyoon Jung [Tue, 12 Jan 2016 04:12:34 +0000 (13:12 +0900)]
server: Calculate remaining data size after a closure is processed

When processing a closure, data in the connection can be consumed again
if the closure itself invokes extra event dispatch. In that case the
remaining data size is also altered, so the variable len should be
updated after the closure is processed.

Signed-off-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agodoc: Fix incorrect parameter name
Jonas Ådahl [Tue, 29 Dec 2015 01:47:20 +0000 (09:47 +0800)]
doc: Fix incorrect parameter name

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agodoc: Fix function membership
Jonas Ådahl [Tue, 29 Dec 2015 01:46:11 +0000 (09:46 +0800)]
doc: Fix function membership

Put the various misplaced functions in the right class; partly because
its where they belong, and partly to make intra-class \ref(erences)
happy.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoUse zalloc instead of malloc + memset
Jonas Ådahl [Wed, 26 Aug 2015 04:00:06 +0000 (12:00 +0800)]
Use zalloc instead of malloc + memset

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoscanner: Fail if 'since' is higher than the interface version
Jonas Ådahl [Wed, 4 Nov 2015 06:21:52 +0000 (14:21 +0800)]
scanner: Fail if 'since' is higher than the interface version

If an event or request have a "since" attribute that is larger than
the version of the interface it is in, fail with an explaining error
message.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoscanner: Add missing brackets
Jonas Ådahl [Wed, 4 Nov 2015 04:40:54 +0000 (12:40 +0800)]
scanner: Add missing brackets

A statement was added at the same indentation level as the true branch
of the if statement, but since there were no brackets, it would be
executed independently of the result of the if condition.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoserver: Add a socket with an existing fd
Bryce Harrington [Fri, 18 Dec 2015 00:49:59 +0000 (16:49 -0800)]
server: Add a socket with an existing fd

This adds functionality to allow system-level control over handing out
file descriptors for sockets, to allow tighter security when running a
Wayland compositor under a Wayland session server.  Allows writing
socket activated Wayland servers.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Sung-Jin Park <sj76.park@samsung.com>
Cc: Sangjin Lee <lsj119@samsung.com>
8 years agoprotocol: specify behavior of get_pointer when capabilities change
Peter Hutterer [Mon, 7 Dec 2015 05:43:35 +0000 (15:43 +1000)]
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>
8 years agoprotocol: Add wl_surface.damage_buffer
Derek Foreman [Mon, 30 Nov 2015 16:55:04 +0000 (10:55 -0600)]
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>
8 years agoserver: remove redundant include
Marek Chalupa [Fri, 27 Nov 2015 14:39:45 +0000 (15:39 +0100)]
server: remove redundant include

we don't use ffi in wayland-server.c

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoprotocol: fix a couple of whitespace issues
Peter Hutterer [Mon, 23 Nov 2015 04:28:28 +0000 (14:28 +1000)]
protocol: fix a couple of whitespace issues

8 spaces is one tab

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
8 years agoprotocol: Remove incorrect statement that attach must precede damage
Derek Foreman [Wed, 18 Nov 2015 15:44:11 +0000 (09:44 -0600)]
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>
8 years agoscanner: drop altmacro from dtddata.S
Pekka Paalanen [Wed, 18 Nov 2015 11:00:00 +0000 (13:00 +0200)]
scanner: drop altmacro from dtddata.S

Stop using .altmacro in dtddata.S, because clang does not yet implement
it. Turns out that we do not actually seem to need it, and we can modify
the syntax to work without it.

Moving the double quotes from the binfile line to the .incbin line is
required to avoid the assembler error "missing string". Instead of & we
now use \() to mark the end of macro argument name.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92988

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Víctor Jáquez <vjaquez@igalia.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
8 years agoMakefile: use automake rule for compiling .S
Pekka Paalanen [Wed, 18 Nov 2015 10:54:10 +0000 (12:54 +0200)]
Makefile: use automake rule for compiling .S

Automake seems to have its own rules for compiling an .o from an .S.
Essentially it does the same as our hand-crafted rule, but adds some
things like dependency file generation.

Remove our hand-crafted rule to use the automake rule, it is less
surprising.

http://www.gnu.org/software/automake/manual/html_node/Assembly-Support.html

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Víctor Jáquez <vjaquez@igalia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
8 years agoValidate the protocol xml during scanning
Peter Hutterer [Mon, 9 Nov 2015 23:53:08 +0000 (09:53 +1000)]
Validate the protocol xml during scanning

Embed the wayland.dtd protocol data into the scanner binary so we can validate
external protocol files without requiring makefile changes. Hat-tip to Pekka
Paalanen for the embedding trick.
The embedding trick doesn't work well if the to-be-embedded file is in a
different location than the source file, so copy/link it during configure and
then build it in from the local directory.

The current expat parser is not a validating parser, moving scanner.c to
another parser has the risk of breaking compatibility. This patch adds libxml2
as extra (optional) dependency, but that also requires parsing the input
twice.

If the protocol fails validation a warning is printed but no error is returned
otherwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoprotocol: add the new bitfields to the dtd
Peter Hutterer [Mon, 9 Nov 2015 23:34:32 +0000 (09:34 +1000)]
protocol: add the new bitfields to the dtd

See 851614fa78862499e016c5718e730fefbb8e3b73

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>
8 years agoprotocol: allow for a <description> element below <protocol>
Peter Hutterer [Mon, 9 Nov 2015 04:15:00 +0000 (14:15 +1000)]
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>
8 years agoRevert "Remove protocol/wayland.dtd"
Peter Hutterer [Mon, 9 Nov 2015 04:14:59 +0000 (14:14 +1000)]
Revert "Remove protocol/wayland.dtd"

This reverts commit 06fb8bd371403d43bc192577abd6b0a0c8b29c59.

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>
8 years agoadd wl_abort private function
Marek Chalupa [Mon, 16 Nov 2015 10:49:02 +0000 (11:49 +0100)]
add wl_abort private function

On many places in the code we use wl_log + abort or wl_log + assert(0).
Replace these with one call to wl_abort, so that we don't mix abort(),
assert(0) and we'll save few lines

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agodoc: make the doxygen output dependent on scanner.c
Peter Hutterer [Thu, 5 Nov 2015 22:02:00 +0000 (08:02 +1000)]
doc: make the doxygen output dependent on scanner.c

When the scanner changes, we need to rebuild

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoevent-loop: remove extra header
Marek Chalupa [Mon, 16 Nov 2015 10:53:36 +0000 (11:53 +0100)]
event-loop: remove extra header

we don't use assert() anywhere in this file, so remove #include <assert.h>

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoshm: wl_shm_buffer_get_data() requires a valid pool.
Derek Foreman [Thu, 5 Nov 2015 19:57:47 +0000 (13:57 -0600)]
shm: wl_shm_buffer_get_data() requires a valid pool.

There's no situation where a shm buffer without a pool makes sense,
so we enforce the pool's existence a little more rigidly.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agoshm: Move deprecated function to the bottom of the file
Derek Foreman [Thu, 5 Nov 2015 19:57:46 +0000 (13:57 -0600)]
shm: Move deprecated function to the bottom of the file

In wayland-server.c we group the deprecated functions and
disable doxygen for them.  Do that here too.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agoshm: Deprecate wl_shm_buffer_create()
Derek Foreman [Thu, 5 Nov 2015 19:57:45 +0000 (13:57 -0600)]
shm: Deprecate wl_shm_buffer_create()

From irc:
<pq> it creates a wl_buffer object in a way that no client can ever
     access the storage.

So, let's replace it with return NULL; and mark it with attribute
deprecated in the header.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agodoc: output enum and bitfield attributes in the documentation
Auke Booij [Sat, 24 Oct 2015 11:07:50 +0000 (12:07 +0100)]
doc: output enum and bitfield attributes in the documentation

Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@googlemail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoscanner: enforce correct argument type for enums
Auke Booij [Mon, 26 Oct 2015 19:39:52 +0000 (19:39 +0000)]
scanner: enforce correct argument type for enums

The scanner now checks whether arguments that have an associated
<enum> have the right type.
An argument with an enum attribute must be of type int or uint,
and if the <enum> with that name has the bitfield attribute
set to true, then the argument must be of type uint.

Changes since v3:
 - Remove useless allow_null check
 - Switch to using bool
 - Clearer message on errorous input
 - Minor formatting fix

Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@googlemail.com>
8 years agoprotocol: specify enum and bitfield attributes
Auke Booij [Sat, 24 Oct 2015 11:07:48 +0000 (12:07 +0100)]
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>
8 years agodoc: document the enum and bitfield attributes
Auke Booij [Mon, 26 Oct 2015 12:16:31 +0000 (12:16 +0000)]
doc: document the enum and bitfield attributes

Introduce the enum and bitfield attributes, which allow you to refer to the enum
you are expecting in an argument, and specify which enums are to be thought of
as bitfields.

Changes since v3:
 - Fix typo ("description" -> "descriptive")

Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@googlemail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agocosmetic: fix incorrect whitespace.
Jon Cruz [Wed, 28 Oct 2015 03:03:37 +0000 (12:03 +0900)]
cosmetic: fix incorrect whitespace.

Fixed instance where spaces were used instead of tabs.

Changes since v1:
* rebased

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
8 years agoscanner: stop adding trailing whitespace to copyright
Jon Cruz [Mon, 26 Oct 2015 02:50:32 +0000 (11:50 +0900)]
scanner: stop adding trailing whitespace to copyright

Generated code was unconditionally adding a space to lines
in comments for copyright blocks even if the line was blank.
Updated to not add trailing whitespace for blank lines.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
8 years agocosmetic: fix inconsistent code style with header prototypes.
Jon Cruz [Mon, 26 Oct 2015 05:51:19 +0000 (14:51 +0900)]
cosmetic: fix inconsistent code style with header prototypes.

A few of the header files had function prototypes that were not
following project conventions, sometimes even in the same file.
Corrected these to follow as per wayland-os.h.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
8 years agoshm: Add shm_buffer ref and shm_pool unref functions
Derek Foreman [Tue, 20 Oct 2015 01:54:49 +0000 (20:54 -0500)]
shm: Add shm_buffer ref and shm_pool unref functions

Sometimes the compositor wants to make sure a shm pool doesn't disappear
out from under it.

For example, in Enlightenment, rendering happens in a separate thread
while the main thread can still dispatch events.  If a client is destroyed
during rendering, all its resources are cleaned up and its shm pools are
unmapped.  This causes the rendering thread to segfault.

This patch adds a way for the compositor to increment the refcount of the
shm pool so it can't disappear, and decrement it when it's finished.

The ref/unref are asymmetrical (ref returns the pool) because it's
possible the buffer itself will be gone when you need to unref the pool.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoRemove protocol/wayland.dtd
Auke Booij [Thu, 8 Oct 2015 13:35:34 +0000 (14:35 +0100)]
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>
8 years agoscanner: Generate 'since' macros for requests as well
Jonas Ådahl [Thu, 8 Oct 2015 03:00:54 +0000 (11:00 +0800)]
scanner: Generate 'since' macros for requests as well

We already generate WL_[INTERFACE]_[REQUEST]_SINCE_VERSION macros for
events in the server protocol headers. Lets do the same for requests in
the client protocol headers as well.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agoclient: Move prepare read documentation to .._prepare_read_queue()
Jonas Ådahl [Fri, 25 Sep 2015 03:56:46 +0000 (11:56 +0800)]
client: Move prepare read documentation to .._prepare_read_queue()

In the documentation we refer to "an event queue" in various places and
from the beginning it is unclear what event queue this means. So,
instead of having a paragraph in the end mentioning this, move the
detailed documentation to the function with the queue explicitly passed.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agowayland: add a release request on wl_seat
FORT David [Fri, 2 Oct 2015 12:20:12 +0000 (14:20 +0200)]
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>
8 years agoclient: Improve wl_display_roundtrip(_queue)() documentation
Jonas Ådahl [Fri, 2 Oct 2015 09:32:56 +0000 (17:32 +0800)]
client: Improve wl_display_roundtrip(_queue)() documentation

Change the wording a bit to describe how it is done (which explains to
the name of the function) as well as a note about that we actually will
dispatch events that are received.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoclient: Be more clear about when one must call wl_display_flush
Jonas Ådahl [Fri, 2 Oct 2015 09:32:54 +0000 (17:32 +0800)]
client: Be more clear about when one must call wl_display_flush

Blocking in general is not what means it is required to flush, but
blocking on input from the wl_display file descriptor.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoclient: Reword and add documentation about the marshal functions
Jonas Ådahl [Fri, 2 Oct 2015 09:32:53 +0000 (17:32 +0800)]
client: Reword and add documentation about the marshal functions

Some rewording to improve grammar a bit with some additions about the
type expectations of va_list arguments.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoclient: Fix minor grammar issue
Jonas Ådahl [Fri, 2 Oct 2015 09:32:52 +0000 (17:32 +0800)]
client: Fix minor grammar issue

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoscanner: Close input resource when done to prevent leak
Bryce Harrington [Fri, 2 Oct 2015 01:13:29 +0000 (18:13 -0700)]
scanner: Close input resource when done to prevent leak

Addresses this error reported by Denis Denisov:

  [src/scanner.c:1415]: (error) Resource leak: input

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
v2: Also close input for other exit points in main.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: David FORT <contact@hardening-consulting.com>
8 years agoContributing: explain Patchwork
Pekka Paalanen [Tue, 22 Sep 2015 06:56:24 +0000 (09:56 +0300)]
Contributing: explain Patchwork

Add general guidelines for using Patchwork, as we heavily rely on it
nowadays.

v2:

- mention also Xwayland and libinput patch management
- reword "if not found in Patchwork"
- reword "Not applicable"
- mention pwclient

Cc: Bryce Harrington <bryce@osg.samsung.com>
Cc: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
8 years agoconfigure.ac: bump to version 1.9.90 for open development
Bryce Harrington [Tue, 22 Sep 2015 20:39:36 +0000 (13:39 -0700)]
configure.ac: bump to version 1.9.90 for open development

Master is open for new feature development again.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoconfigure.ac: bump to version 1.9.0 for the official release 1.9.0
Bryce Harrington [Mon, 21 Sep 2015 23:51:16 +0000 (16:51 -0700)]
configure.ac: bump to version 1.9.0 for the official release

8 years agoconfigure.ac: bump to version 1.8.93 for the RC1 release 1.8.93
Bryce Harrington [Wed, 16 Sep 2015 03:16:37 +0000 (20:16 -0700)]
configure.ac: bump to version 1.8.93 for the RC1 release

8 years agoconfigure.ac: bump to version 1.8.92 for the beta release 1.8.92
Bryce Harrington [Tue, 1 Sep 2015 23:51:30 +0000 (16:51 -0700)]
configure.ac: bump to version 1.8.92 for the beta release

8 years agoRevert "client: require WAYLAND_DISPLAY to be set"
Pekka Paalanen [Mon, 17 Aug 2015 12:20:28 +0000 (15:20 +0300)]
Revert "client: require WAYLAND_DISPLAY to be set"

This reverts commit fb7e13021730d0a5516ecbd3712ea4235e05d24d.

Developers have been trying to reduce the number of by default required
environment variables, and the mentioned commit is a step backwards in
that sense. The fundamental assumption is that a user has only one main
(Wayland) display server where all programs should connect to by
default, and do so with an a priori known socket name.

The commit also broke various use cases in the wild, some accidentally
due to other causes, some intentionally. This revert allows those use
cases to continue.

The original problem of running Weston in a window in an existing GNOME
X11 session and getting applications unintentionally launched into
Weston can be circumvented by letting Weston use a non-default socket
name, leaving wayland-0 unused.

Discussion:
http://lists.freedesktop.org/archives/wayland-devel/2015-August/023927.html
http://lists.freedesktop.org/archives/wayland-devel/2015-August/023937.html

Cc: Dima Ryazanov <dima@gmail.com>
Cc: Giulio Camuffo <giuliocamuffo@gmail.com>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Jasper St. Pierre <jstpierre@mecheye.net>
Cc: Ryo Munakata <ryomnktml@gmail.com>
Cc: Ray Strode <halfline@gmail.com>
Cc: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Matthias Clasen <mclasen@redhat.com>
Cc: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Ray Strode <rstrode@redhat.com>
Acked-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-By: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Acked-By: Ryo Munakata <ryomnktml@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
8 years agoconfigure.ac: bump to version 1.8.91 for the alpha release 1.8.91
Bryce Harrington [Sun, 16 Aug 2015 20:54:50 +0000 (13:54 -0700)]
configure.ac: bump to version 1.8.91 for the alpha release

8 years agoclient: require WAYLAND_DISPLAY to be set
Dima Ryazanov [Thu, 13 Aug 2015 02:34:31 +0000 (19:34 -0700)]
client: require WAYLAND_DISPLAY to be set

Although defaulting to wayland-0 seems convenient, it has an undesirable
side effect: clients may unintentionally connect to the wrong compositor.
Generally, it's safer to fail instead. Here's a real example:

In Fedora 22, Gtk+ prefers Wayland over X11, though the default session is still
a normal X11 Gnome session. When you launch a Gtk+ app, it will try Wayland,
fail, then try X11, and succesfully start up. That works fine.

Now suppose you launch Weston while running the Gnome session. Suddenly, all
of the Gtk+ apps launched from Gnome will show up inside Weston instead.
That's unexpected. There's also no good way to prevent that from happening
(other than perhaps setting WAYLAND_DISPLAY to an invalid value when launching
an app).

Not using wayland-0 as the default will solve that problem: an app launched
from the X11 Gnome session will use the X11 backend regardless of whether
there's a wayland compositor running at the same time.

Everything else should work as before. The compositor already sets
the WAYLAND_DISPLAY when starting the session, so the lack of the default value
should not make a difference to the user.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Acked-by: Pekka Paalanen <ppaalanen@gmail.com>
Acked-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
[Pekka: dropped the wayland-server.c hunk, adjusted summary]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agowayland-client : Fix queue_release not to call proxy_destroy
Elvis Lee [Fri, 31 Jul 2015 09:02:54 +0000 (18:02 +0900)]
wayland-client : Fix queue_release not to call proxy_destroy

proxy_destroy could be called twice by wl_proxy_destroy and wl_event_queue_release.
Then, wl_map_remove was called twice for same object id.

Signed-off-by: Elvis Lee <kwangwoong.lee@lge.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agoscanner: check sanity of version
Marek Chalupa [Thu, 30 Jul 2015 14:42:00 +0000 (16:42 +0200)]
scanner: check sanity of version

scanner does not complain if we put into version attribute
things like -1 1x 1:3 etc.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agoscanner: use zxalloc
Marek Chalupa [Thu, 30 Jul 2015 13:07:22 +0000 (15:07 +0200)]
scanner: use zxalloc

Use xzalloc instead of xmalloc. This allows us to get rid
of manual initializing the memory to 0s and the code is
shorter and cleaner

Suggested by Bryce Harrington

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agoscanner: get rid of leaks
Marek Chalupa [Thu, 30 Jul 2015 13:07:21 +0000 (15:07 +0200)]
scanner: get rid of leaks

Free all the memory we have allocated during running.

v2.: split creating objects and getting rid of leaks
     into two patches

     move check for NULL description into free_description

v3.: rebase after previous patch fixes

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agoscanner: refactor creating objects
Marek Chalupa [Thu, 30 Jul 2015 13:07:20 +0000 (15:07 +0200)]
scanner: refactor creating objects

wrap creating and initializing objects (structures)
into functions and use them in the code.

v2. make create_.* functions consistent
    (no func will return NULL)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agogitignore: Ignore some dist generated files
Bryce Harrington [Fri, 31 Jul 2015 01:18:25 +0000 (18:18 -0700)]
gitignore: Ignore some dist generated files

9 years agobuild: Build libwayland-private
Derek Foreman [Thu, 18 Jun 2015 22:47:22 +0000 (17:47 -0500)]
build: Build libwayland-private

This splits the bulk of libwayland-util into libwayland-private.

libwayland-util (which is just wayland-util.c) is for use with the scanner.

libwayland-private is everything else.

Most things will want to link both libs.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agobuild: always build wayland-scanner
Ross Burton [Wed, 1 Jul 2015 21:51:01 +0000 (22:51 +0100)]
build: always build wayland-scanner

The previous idiom for building a cross-compiled Wayland is to build once for
the build host (with --enable-scanner --disable-libraries) to get a
wayland-scanner binary that can then be used in a cross-compile (with
--disable-scanner).  The problem with this is that the cross wayland is missing
a wayland-scanner binary, which means you then can't do any Wayland development
on the target.

Instead, always build wayland-scanner for the target and change
--enable/disable-scanner to --with/without-host-scanner.  Normal builds use the
default of --without-host-scanner and run the wayland-scanner it just built, and
cross-compiled builds pass --with-host-scanner to use a previously built host
scanner but still get a wayland-scanner to install.

(a theoretically neater solution would be to build two scanners if required (one
to run and one to install), but automake makes this overly complicated)

[daniels: Bikeshedded naming with Ross's OK.]

Signed-off-by: Ross Burton <ross.burton@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agofixed-benchmark: remove unused arguments in main
Marek Chalupa [Fri, 3 Jul 2015 07:33:23 +0000 (09:33 +0200)]
fixed-benchmark: remove unused arguments in main

Fixed benchmark uses main(int argc, char *argv[])
but does not use the arguments, so we can replace them with void

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agotests: Don't increment variables inside an assert()
Bryce Harrington [Fri, 19 Jun 2015 22:58:01 +0000 (15:58 -0700)]
tests: Don't increment variables inside an assert()

Addresses this warning found by Denis Denisov:

  [tests/array-test.c:137]: (warning) Assert statement modifies 'i'.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
9 years agocosmetic: gratuitous whitespace changes in event-loop.c
Derek Foreman [Thu, 18 Jun 2015 16:48:30 +0000 (11:48 -0500)]
cosmetic: gratuitous whitespace changes in event-loop.c

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agobuild: Use AM_CFLAGS instead of GCC_CFLAGS everywhere
Derek Foreman [Thu, 18 Jun 2015 16:27:21 +0000 (11:27 -0500)]
build: Use AM_CFLAGS instead of GCC_CFLAGS everywhere

This will make it easier if we ever want to add new flags to everything
in the future.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>