profile/ivi/wayland.git
11 years agoclient: Fix double locking bug
Ander Conselvan de Oliveira [Thu, 11 Oct 2012 11:55:59 +0000 (14:55 +0300)]
client: Fix double locking bug

The function wl_proxy_create_for_id() would try to acquire the display
lock, but the only call path leading to it would call it with the lock
already acquired.

This patch removes the attempt to acquire the lock and makes the
function static. It was exported before because client had to create
proxy's manually when the server sent a new object id, but since commit
9de9e39f [1] this is no longer necessary.

[1] commit 9de9e39f87adfce1ea9755e394928756254c0ba2
    Author: Kristian Høgsberg <krh@bitplanet.net>
    Date:   Thu Jun 28 22:01:58 2012 -0400

        Allocate client proxy automatically for new objects

v2: Change the right function. Previous patch changed wl_proxy_create()
    instead of wl_proxy_create_for_id().

11 years agoprotocol: clarify multiple wl_surface.attach
Pekka Paalanen [Thu, 11 Oct 2012 11:31:11 +0000 (14:31 +0300)]
protocol: clarify multiple wl_surface.attach

Explicitly say what happens with the wl_buffer.release event, if you
attach several wl_buffers without a commit in between.

Reported-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agodata-device: Don't fake an attach event on drag icon surface
Ander Conselvan de Oliveira [Thu, 11 Oct 2012 11:05:37 +0000 (14:05 +0300)]
data-device: Don't fake an attach event on drag icon surface

Emit a new drag icon signal instead and let the compositor handle the
unmapping of the icon surface.

11 years agoprotocol: fix clarification of input region on drags and pointers
Pekka Paalanen [Thu, 11 Oct 2012 10:58:45 +0000 (13:58 +0300)]
protocol: fix clarification of input region on drags and pointers

The previous clarification did not follow the current implementation in
Weston, where when a surface stops being a cursor or an icon, it becomes
a plain unmapped surface again.

Rewrite the related paragraphs, and fix some typos while at it.

For start drag, make it explicit of which surface argument we are
talking about.

v2:

Make the input region undefined when the use ends. Most likely no-one
will re-use these surfaces for anything else than the same use case, so
leave some slack for the implementations to avoid useless work on
resetting the regions.

Reported-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoprotocol: elaborate on wl_buffer
Pekka Paalanen [Wed, 10 Oct 2012 09:47:50 +0000 (12:47 +0300)]
protocol: elaborate on wl_buffer

Spell out exactly when a client may re-use a wl_buffer or its backing
storage. Mention the optimization for GL-compositor with wl_shm-clients.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoprotocol: wl_surface.frame needs wl_surface.commit
Pekka Paalanen [Wed, 10 Oct 2012 09:47:49 +0000 (12:47 +0300)]
protocol: wl_surface.frame needs wl_surface.commit

Clarify, when frame request takes effect.
Explain when to send/receive the callback.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoprotocol: clarify input region on drags and pointers
Pekka Paalanen [Wed, 10 Oct 2012 09:47:48 +0000 (12:47 +0300)]
protocol: clarify input region on drags and pointers

Drag icon and cursor surfaces must never receive input, so their input
region is always empty.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoprotocol: double-buffered state for wl_surface
Pekka Paalanen [Wed, 10 Oct 2012 09:47:47 +0000 (12:47 +0300)]
protocol: double-buffered state for wl_surface

This change breaks the protocol.

The current protocol is racy in that updates to surface content and
surface state (e.g. damage, input and opaque regions) are not guaranteed
to happen at the same time. Due to protocol buffering and handling
practices, the issues are very hard to trigger.

Committing damage to a surface at arbitrary times makes it hard to
track when the wl_buffer is being read by the server, and when it is
safe to overwrite (the case of wl_shm with a single buffer reused
constantly).

This protocol change introduces the concept of double-buffered state.
Such state is accumulated and cached in the server, unused, until the
final commit request. The surface will receive its new content and apply
its new state atomically.

A wl_surface.commit request is added to the protocol. This is thought to
be more clear, than having wl_surface.attach committing implicitly, and
then having another request to commit without attaching, as would be
required for a GL app that wants to change e.g. input region without
redrawing.

When these changes are implemented, clients do not have to worry about
ordering damage vs. input region vs. attach vs. ... anymore. Clients set
the state in any order they want, and kick it all in with a commit.

The interactions between wl_surface.attach, (wl_surface.commit,)
wl_buffer.release, and wl_buffer.destroy have been undocumented. Only
careful inspection of the compositor code has told when a wl_buffer is
free for re-use, especially for wl_shm and wrt. wl_surface.damage.
Try to clarify how it all should work, and what happens if the wl_buffer
gets destroyed.

An additional minor fix: allow NULL argument to
wl_surface.set_opaque_region. The wording in the documentation already
implied that a nil region is allowed.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoFix typecheck in case of multiple instances of type meta data
Kristian Høgsberg [Wed, 10 Oct 2012 23:25:48 +0000 (19:25 -0400)]
Fix typecheck in case of multiple instances of type meta data

In most cases the pointer equality test is sufficient.  However, in
some cases, depending on how things are split across shared objects,
we can end up with multiple instances of the interface metadata
constants.  So if the pointers match, the interfaces are equal, if
they don't match we have to compare the interface names.

11 years agodoc: Update drag and drop section and add info about selections
Ander Conselvan de Oliveira [Wed, 10 Oct 2012 20:29:13 +0000 (23:29 +0300)]
doc: Update drag and drop section and add info about selections

Replace the outdated section about drag and drop support with a
rewritten section covering the data source/offer mechanism and
wl_data_device, explaining how selection and drag ang drop works.

11 years agoconnection: Move object lookup out of wl_connection_demarshal()
Kristian Høgsberg [Tue, 9 Oct 2012 16:14:34 +0000 (12:14 -0400)]
connection: Move object lookup out of wl_connection_demarshal()

On the client side where we queue up multiple events before dispatching, we
need to look up the receiving proxy and argument proxies immediately before
calling the handler.  Between queueing up multiple events and eventually
invoking the handler, previous handlers may have destroyed some of the
proxies.

11 years agoSplit the global registry into its own wl_registry object
Kristian Høgsberg [Mon, 8 Oct 2012 17:53:47 +0000 (13:53 -0400)]
Split the global registry into its own wl_registry object

The only way to make the global object listener interface thread safe is to
make it its own interface and make different listeners different wl_proxies.
The core of the problem is the callback we do when a global show up or
disappears, which we can't do with a lock held.  On the other hand we can't
iterate the global list or the listener list without a lock held as new
globals or listeners may come and go during the iteration.

Making a copy of the list under the lock and then iterating after dropping
the lock wont work either.  In case of the listener list, once we drop the
lock another thread may unregister a listener and destroy the callbackk
data, which means that when we eventually call that listener we'll pass it
free memory and break everything.

We did already solve the thread-safe callback problem, however.  It's what
we do for all protocol events.  So we can just make the global registry
functionality its own new interface and give each thread its own proxy.
That way, the thread will do its own callbacks (with no locks held) and
destroy the proxy when it's no longer interested in wl_registry events.

11 years agoscanner: Generate client stubs for wl_display requests
Kristian Høgsberg [Mon, 8 Oct 2012 17:25:52 +0000 (13:25 -0400)]
scanner: Generate client stubs for wl_display requests

We used to special case this because of the untyped new-id argument in
the bind request.  Now that the scanner can handle that, we can
remove the special case.

Switching to the generated stubs does bring an API change since we now
also take the interface version that the client expects as an argument.
Previously we would take this from the interface struct, but the
application may implement a lower version than what the interface struct
provides.  To make sure we don't try to dispatch event the client
doesn't implement handlers for, we have to use a client supplied version
number.

11 years agoscanner: Send interface name and version for types new_id args
Kristian Høgsberg [Mon, 8 Oct 2012 17:21:55 +0000 (13:21 -0400)]
scanner: Send interface name and version for types new_id args

This makes the scanner generate the code and meta data to send the
interface name and version when we pass a typeless new_id.  This way, the
generic factory mechanism provided by wl_display.bind can be provided by
any interface.

11 years agoclient: Add wl_event_queue for multi-thread dispatching
Kristian Høgsberg [Fri, 5 Oct 2012 17:49:48 +0000 (13:49 -0400)]
client: Add wl_event_queue for multi-thread dispatching

This introduces wl_event_queue, which is what will make multi-threaded
wayland clients possible and useful.  The driving use case is that of a
GL rendering thread that renders and calls eglSwapBuffer independently of
a "main thread" that owns the wl_display and handles input events and
everything else.  In general, the EGL and GL APIs have a threading model
that requires the wayland client library to be usable from several threads.
Finally, the current callback model gets into trouble even in a single
threaded scenario: if we have to block in eglSwapBuffers, we may end up
doing unrelated callbacks from within EGL.

The wl_event_queue mechanism lets the application (or middleware such as
EGL or toolkits) assign a proxy to an event queue.  Only events from objects
associated with the queue will be put in the queue, and conversely,
events from objects associated with the queue will not be queue up anywhere
else.  The wl_display struct has a built-in event queue, which is considered
the main and default event queue.  New proxies are associated with the
same queue as the object that created them (either the object that a
request with a new-id argument was sent to or the object that sent an
event with a new-id argument).  A proxy can be moved to a different event
queue by calling wl_proxy_set_queue().

A subsystem, such as EGL, will then create its own event queue and associate
the objects it expects to receive events from with that queue.  If EGL
needs to block and wait for a certain event, it can keep dispatching event
from its queue until that events comes in.  This wont call out to unrelated
code with an EGL lock held.  Similarly, we don't risk the main thread
handling an event from an EGL object and then calling into EGL from a
different thread without the lock held.

11 years agoclient: Make wl_display thread safe
Kristian Høgsberg [Thu, 4 Oct 2012 21:42:49 +0000 (17:42 -0400)]
client: Make wl_display thread safe

Not all entry points are thread safe: global listeners and global lookup
is still only main thread.

11 years agoclient: Split event handling into demarshal and dispatch steps
Kristian Høgsberg [Thu, 4 Oct 2012 21:34:18 +0000 (17:34 -0400)]
client: Split event handling into demarshal and dispatch steps

This lets us demarshal with a mutex held and then do dispatching after
releasing the mutex.

11 years agoChange filedescriptor API to be thread safe
Kristian Høgsberg [Thu, 4 Oct 2012 20:54:22 +0000 (16:54 -0400)]
Change filedescriptor API to be thread safe

The update callback for the file descriptors was always a bit awkward and
un-intuitive.  The idea was that whenever the protocol code needed to
write data to the fd it would call the 'update' function.  This function
would adjust the mainloop so that it polls for POLLOUT on the fd so we
can eventually flush the data to the socket.

The problem is that in multi-threaded applications, any thread can issue
a request, which writes data to the output buffer and thus triggers the
update callback.  Thus, we'll be calling out with the display mutex
held and may call from any thread.

The solution is to eliminate the udpate callback and just require that
the application or server flushes all connection buffers before blocking.
This turns out to be a simpler API, although we now require clients to
deal with EAGAIN and non-blocking writes.  It also saves a few syscalls,
since the socket will be writable most of the time and most writes will
complete, so we avoid changing epoll to poll for POLLOUT, then write and
then change it back for each write.

11 years agoEnsure cursor_data.c is included in distribution tarballs
Matt Roper [Thu, 4 Oct 2012 21:27:39 +0000 (14:27 -0700)]
Ensure cursor_data.c is included in distribution tarballs

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
11 years agoconnection: Add missing free from error path
Rob Bradford [Tue, 9 Oct 2012 17:46:22 +0000 (18:46 +0100)]
connection: Add missing free from error path

On the error codepath that errors out on ENOMEM we should free the allocated
closure.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
11 years agoxcursor: Fix allocation based on string length
Rob Bradford [Tue, 9 Oct 2012 17:46:21 +0000 (18:46 +0100)]
xcursor: Fix allocation based on string length

strlen() doesn't include the terminating NUL. Therefore when allocating a
block of memory to hold something equivalent to the length of the string we
must increment to take the NUL byte into consideration.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
11 years agowayland: Fix typos
Tiago Vignatti [Mon, 8 Oct 2012 15:40:00 +0000 (18:40 +0300)]
wayland: Fix typos

My vim spell checker is able to find typos of xml files after adding "syn spell
toplevel" to ~/.vim/after/syntax/xml.vim

aah, and Wayland is capital letter :)

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agodoc: Remove Shared Object Cache section
Tiago Vignatti [Mon, 8 Oct 2012 15:39:59 +0000 (18:39 +0300)]
doc: Remove Shared Object Cache section

We don't support anything like that yet.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agodoc: Auto-generate Protocol/Interfaces section instead
Tiago Vignatti [Mon, 8 Oct 2012 15:39:58 +0000 (18:39 +0300)]
doc: Auto-generate Protocol/Interfaces section instead

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agodoc: Improve Wire Format section
Tiago Vignatti [Mon, 8 Oct 2012 15:39:57 +0000 (18:39 +0300)]
doc: Improve Wire Format section

Fixed the wayland socket name and added documentation for fixed format.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agoconnection: Drop unused static closures
Kristian Høgsberg [Mon, 1 Oct 2012 17:21:29 +0000 (13:21 -0400)]
connection: Drop unused static closures

11 years agoman: fix compilation without xsltproc
David Herrmann [Wed, 26 Sep 2012 14:41:50 +0000 (16:41 +0200)]
man: fix compilation without xsltproc

We really shouldn't add the man-pages when HAVE_XSLTPROC is not true so
move it into the if-clause.
But declare the automake-variables outside of the if-clause to avoid
automake complaints.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoman: add man-page infrastructure
David Herrmann [Mon, 24 Sep 2012 11:18:38 +0000 (13:18 +0200)]
man: add man-page infrastructure

This adds a man-page infrastructure based on Docbook XML files. This
allows us to integrate the man-pages into the publican books later. An
example page for wl_display_connect() (with an alias
wl_display_connect_to_fd()) is also added.

Feel free to add more man-pages. Function calls are put in man3 and
overview pages into man7. All pages (including aliases) have to be added
to the Makefile.

Docbook does generate aliases automatically from the additional names that
were put in the XML file. However, a small SED script is needed to fixup
the include-paths in the generated troff files. If someone knows how to
avoid that (or even install them gzip'ped), please fix it up.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoprotocol: Fix typo
Tiago Vignatti [Tue, 25 Sep 2012 09:19:57 +0000 (12:19 +0300)]
protocol: Fix typo

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agoFix typo (ratio, not ration)
Diego Viola [Thu, 13 Sep 2012 10:45:06 +0000 (06:45 -0400)]
Fix typo (ratio, not ration)

Signed-off-by: Diego Viola <diego.viola@gmail.com>
11 years agoevent-loop: export wl_event_loop_dispatch_idle()
David Herrmann [Tue, 11 Sep 2012 14:09:34 +0000 (16:09 +0200)]
event-loop: export wl_event_loop_dispatch_idle()

When integrating the wayland event-loop into another event-loop, we
currently have no chance of checking whether there are pending idle
sources that have to be called. This patch exports the
"dispatch_idle_sources()" call so other event loops can call this before
going to sleep. This is what wl_event_loop_dispatch() currently does so we
simply allow external event-loops to do the same now.

To avoid breaking existing applications, we keep the call to
dispatch_idle_sources() in wl_event_loop_dispatch() for now. However, if
we want we can remove this later and require every application to call
this manually. This needs to be discussed, but the overhead is negligible
so we will probably leave it as it is.

This finally allows to fully integrate the wayland-server API into
existing event-loops without any nasty workarounds.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agowayland-server: return new ID in wl_client_add_resource()
David Herrmann [Mon, 10 Sep 2012 09:20:35 +0000 (11:20 +0200)]
wayland-server: return new ID in wl_client_add_resource()

wl_client_add_resource() used to return no error even though the new
resource wasn't added to the client. This currently makes it very easy to
DOS weston by simply posting thousands of "create_surface" requests with
an invalid ID. Weston simply assumes the wl_client_add_resource() request
succeeds but will never destroy the surface again as the "destroy" signal
is never called (because the surface isn't linked into the wl_map).

This change makes wl_client_add_resource() return the new ID of the added
object and 0 on failure. Servers (like weston) can now correctly
immediately destroy the surface when this call fails instead of leaving
the surface around and producing memory-leaks.

Instead of returning -1 on failure and 0 on success, I made it return the
new ID as this seems more appropriate. We can directly use it when calling
it with new_id==0.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoevent-loop: remove dead code
David Herrmann [Sat, 8 Sep 2012 15:47:15 +0000 (17:47 +0200)]
event-loop: remove dead code

There is really no need to increment "n" if we never read the value. The
do-while() loop overwrites the value before it is read the first time.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agocursor: add cursor.pcf and extraction program
Philipp Brüschweiler [Thu, 6 Sep 2012 16:54:02 +0000 (18:54 +0200)]
cursor: add cursor.pcf and extraction program

11 years agocursor: Add a default cursor theme
Philipp Brüschweiler [Thu, 6 Sep 2012 16:54:01 +0000 (18:54 +0200)]
cursor: Add a default cursor theme

This theme is loaded when the specified cursor theme can not be found.

These cursors are extracted from the xorg sources and transformed into
raw ARGB data by a small helper program (commited separately).

11 years agotests: Quiet warning
Kristian Høgsberg [Wed, 29 Aug 2012 18:12:11 +0000 (14:12 -0400)]
tests: Quiet warning

11 years agotests: ensure sanity leak check tests pass when leak checks are disabled.
U. Artie Eoff [Fri, 17 Aug 2012 01:12:05 +0000 (18:12 -0700)]
tests: ensure sanity leak check tests pass when leak checks are disabled.

This finalizes Robert Bradfords patch to allow NO_ASSERT_LEAK_CHECK
environment variable to disable leak checks in unit tests.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agotests: Allow disabling leak checking assertions by env
Rob Bradford [Fri, 17 Aug 2012 01:12:04 +0000 (18:12 -0700)]
tests: Allow disabling leak checking assertions by env

Some code coverage tools trigger these assertions when run against the test
suite since they don't free all their memory.

11 years agoAdd wl_shm_buffer_create()
Kristian Høgsberg [Thu, 16 Aug 2012 03:03:21 +0000 (23:03 -0400)]
Add wl_shm_buffer_create()

11 years agoclient: Add wl_display_connect_to_fd() function
Kristian Høgsberg [Tue, 14 Aug 2012 17:16:10 +0000 (13:16 -0400)]
client: Add wl_display_connect_to_fd() function

This lets us connect a display to an already existing socket fd.

11 years agoprotocol: Fix typo.
Scott Moreau [Thu, 16 Aug 2012 06:04:27 +0000 (00:04 -0600)]
protocol: Fix typo.

11 years agosocket-test: don't try to be clever, fail if no XDG_RUNTIME_DIR is set
Philipp Brüschweiler [Tue, 14 Aug 2012 09:53:08 +0000 (11:53 +0200)]
socket-test: don't try to be clever, fail if no XDG_RUNTIME_DIR is set

Not only setenv(), also putenv() allocates memory on my system
(glibc 2.16.0). Just fail with a clear message if XDG_RUNTIME_DIR is
not set.

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

11 years agoAdd support for X cursor themes.
Christopher Michael [Sat, 11 Aug 2012 14:09:02 +0000 (15:09 +0100)]
Add support for X cursor themes.

This patch adds a few more directories to search for xcursor themes.

Along with the weston patch, this adds the ability to configure weston
to use an X11 cursor theme. Previously, wayland cursor would just look
in the icons and pixmaps directories for cursor images to load. This
adds the ability to also search in the x cursors directory.

11 years agoFix grammar in the rendering section.
Christopher Michael [Sat, 11 Aug 2012 14:35:47 +0000 (15:35 +0100)]
Fix grammar in the rendering section.

Upon reading some docs, I found a small grammar mistake in the
rendering section. This patch fixes that.

11 years agoconnection: zero out string padding
Kristian Høgsberg [Sat, 4 Aug 2012 02:39:51 +0000 (22:39 -0400)]
connection: zero out string padding

We don't want to send random data to the client and this also keeps
valgrind happy.

11 years agoprotocol: Remove "repeat" from "key_state"
Andre Heider [Tue, 31 Jul 2012 16:59:09 +0000 (18:59 +0200)]
protocol: Remove "repeat" from "key_state"

This is unused and apparently was never implemented.

11 years agoDon't skip the first directory entry when reading cursors.
Dima Ryazanov [Thu, 26 Jul 2012 08:39:48 +0000 (01:39 -0700)]
Don't skip the first directory entry when reading cursors.

I end up missing the "bottom_right_corner" cursor.

11 years agoBump version to 0.95.0 0.95.0
Kristian Høgsberg [Tue, 24 Jul 2012 19:45:00 +0000 (15:45 -0400)]
Bump version to 0.95.0

11 years agoMake distcheck work from builddir configured with --disable-documentation
Kristian Høgsberg [Tue, 24 Jul 2012 19:10:12 +0000 (15:10 -0400)]
Make distcheck work from builddir configured  with --disable-documentation

11 years agoMore consistent ID printing
Daniel Stone [Mon, 23 Jul 2012 18:54:42 +0000 (19:54 +0100)]
More consistent ID printing

Use unsigned rather than signed for IDs, so they match up with what we
see in other prints.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
11 years agoMake NEW_IDs nullable
Daniel Stone [Mon, 23 Jul 2012 18:54:41 +0000 (19:54 +0100)]
Make NEW_IDs nullable

The connection-handling code already allows this, so make it legal in
the protocol definition too.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
11 years agoUnstatic arg_count_for_signature and get_next_argument
Daniel Stone [Mon, 23 Jul 2012 18:54:40 +0000 (19:54 +0100)]
Unstatic arg_count_for_signature and get_next_argument

Expose these to other files using wayland-private.h, so wayland-client.c
can walk NULLables properly.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
11 years agotests: Wrap calloc by just returning NULL if we're called too early
Kristian Høgsberg [Tue, 24 Jul 2012 00:14:33 +0000 (20:14 -0400)]
tests: Wrap calloc by just returning NULL if we're called too early

Since glibc dlsym() calls calloc, we get a call to our calloc wrapper as
we try to look up the real calloc implementation.  dlsym() will fall back
to a static buffer in case calloc returns NULL, so that's what we'll do.

This is all highly glibc dependent, of course, but the entire malloc
weak symbol wrapper mechanism is, so there's no loss of generality here.

11 years agotest-runner: Wrap realloc() too
Daniel Stone [Mon, 23 Jul 2012 18:54:39 +0000 (19:54 +0100)]
test-runner: Wrap realloc() too

So all our tests don't start failing just because we had the temerity to
use realloc() rather than malloc().

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
11 years ago.gitignore: Add ctags and cscope files
Daniel Stone [Mon, 23 Jul 2012 18:54:38 +0000 (19:54 +0100)]
.gitignore: Add ctags and cscope files

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoprotocol: Add transform argument to wl_output.geometry event
Kristian Høgsberg [Sun, 22 Jul 2012 19:46:16 +0000 (15:46 -0400)]
protocol: Add transform argument to wl_output.geometry event

12 years agoconnection: reserve id on incoming new object
Mathias Fiedler [Wed, 18 Jul 2012 13:53:23 +0000 (15:53 +0200)]
connection: reserve id on incoming new object

If a new object id arrives ensure that there is an empty array entry
created, otherwise we might get out of sync for new ids if object isn't
created by interface implementation.

12 years agowayland-util: add method for reserving new object id
Mathias Fiedler [Wed, 18 Jul 2012 13:52:51 +0000 (15:52 +0200)]
wayland-util: add method for reserving new object id

wl_map_reserve_new() ensures that new id is valid and will point to an
empty array entry.

12 years agowayland-server: send error on invalid new object id
Mathias Fiedler [Wed, 18 Jul 2012 13:51:45 +0000 (15:51 +0200)]
wayland-server: send error on invalid new object id

Creation of new client resources was silently ignored when
wl_client_add_resource() was used on server side and new object id was out
of range.

An error is now send out to the client in such case.

Also changed error message in wl_client_add_object, since
wl_map_insert_at() returns -1 only at invalid new id.

12 years agowayland-shm: Commit the width/height getters that actually compile
Kristian Høgsberg [Fri, 20 Jul 2012 16:30:07 +0000 (12:30 -0400)]
wayland-shm: Commit the width/height getters that actually compile

12 years agoREADME: Update
Kristian Høgsberg [Fri, 20 Jul 2012 16:20:15 +0000 (12:20 -0400)]
README: Update

The wayland README had outdated build instructions for weston.  Let's just
trim it down to build instructions for wayland and a link to the web site.

12 years agoshm: Add shm_buffer getters for width and height
Kristian Høgsberg [Fri, 20 Jul 2012 16:04:42 +0000 (12:04 -0400)]
shm: Add shm_buffer getters for width and height

12 years agowayland-client: Add missing newline from an error message
Robert Ancell [Tue, 10 Jul 2012 03:52:12 +0000 (15:52 +1200)]
wayland-client: Add missing newline from an error message

12 years agoremove listener from wl_data_source destroy_signal listener list
Dmitry Guryanov [Tue, 17 Jul 2012 14:56:03 +0000 (18:56 +0400)]
remove listener from wl_data_source destroy_signal listener list

I've found a bug during wayland exploration - if you make two
drag'n'drops in weston client example, dnd - weston crashes with
segfault. I've tried to investigate it and found a problem.

In function drag_grab_button we first call data_device_end_drag_grab,
which sets seat->drag_data_source to NULL. Then we remove
listener from list only if drag_data_source is not NULL.

So if client will not free wl_data_source and start another drag'n'drop,
after the first one. Then two wl_data_source structures will be
free'd on client exit (let's name them s1 and s2).

next and prev pointer of
wl_data_source.resource.destroy_signal.listener_list in both
wl_data_source structures will be seat->drag_data_source_listener,
but next and prev in seat->drag_data_source_listener.link point
to listener_list in s2.

So if you try to iterate over listener_list in s1
then you get drag_data_source_listener as first item and
(struct wl_listener *)(&s2.resource.destroy_signal.listener_list)

Iteration over that list occurs in
wl_resource_destroy->destroy_resource->wl_signal_emit->wl_signal_emit
and try to call function at address of wl_resource->client, so
weston segfaults there.

12 years agocursor: fix fd leak and a segfault
Pekka Paalanen [Tue, 10 Jul 2012 10:05:03 +0000 (13:05 +0300)]
cursor: fix fd leak and a segfault

- don't leak fd in shm_pool_destroy()
- return NULL from wl_cursor_theme_load() if pool fails

Tha last one fixes a segfault, when shm_pool_create() has failed.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocursor: use os_create_anonymous_file()
Pekka Paalanen [Tue, 10 Jul 2012 10:05:02 +0000 (13:05 +0300)]
cursor: use os_create_anonymous_file()

Copy the implementation of os_create_anonymous_file() here from weston,
so we can use it instead of hardcoding a path to /tmp.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoserver: fix wl_seat_set_keyboard
Pekka Paalanen [Tue, 10 Jul 2012 10:05:01 +0000 (13:05 +0300)]
server: fix wl_seat_set_keyboard

This makes wl_seat_set_keyboard similar to wl_seat_set_pointer in that
it's a no-op, if you try to set keyboard to NULL when it already is
NULL, instead of refusing to set it to NULL ever.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoserver: add lose_touch_focus()
Pekka Paalanen [Tue, 10 Jul 2012 10:05:00 +0000 (13:05 +0300)]
server: add lose_touch_focus()

Just like wl_keyboard and wl_pointer, add a signal handler for losing
touch focus.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoscanner: Include weston-client.h as the inline functions require it
Robert Ancell [Thu, 5 Jul 2012 04:31:29 +0000 (16:31 +1200)]
scanner: Include weston-client.h as the inline functions require it

12 years agowayland-shm: Add return before we hit the error clean-up path
Kristian Høgsberg [Tue, 10 Jul 2012 01:50:39 +0000 (21:50 -0400)]
wayland-shm: Add return before we hit the error clean-up path

Regression in c94c0946db694ec29b5aebb94a8be0501bacfbc7

12 years agoFixup source comment in wayland-util.h and fix typo in TODO
Martin Olsson [Mon, 9 Jul 2012 16:22:05 +0000 (18:22 +0200)]
Fixup source comment in wayland-util.h and fix typo in TODO

12 years agodoc: fix some typos in documentation
Martin Olsson [Mon, 9 Jul 2012 13:50:39 +0000 (15:50 +0200)]
doc: fix some typos in documentation

12 years agoprotocol: Add missing allow-null to data_device.enter data_offer field
Ander Conselvan de Oliveira [Mon, 9 Jul 2012 10:15:20 +0000 (13:15 +0300)]
protocol: Add missing allow-null to data_device.enter data_offer field

Fixes bug 51889.

12 years agoshm: Plug leak in shm_create_pool()
Martin Olsson [Mon, 9 Jul 2012 09:35:57 +0000 (11:35 +0200)]
shm: Plug leak in shm_create_pool()

12 years agoserver: Don't crash for wl_seat_set_touch(seat, NULL)
Martin Olsson [Mon, 9 Jul 2012 09:35:56 +0000 (11:35 +0200)]
server: Don't crash for wl_seat_set_touch(seat, NULL)

12 years agoscanner: Plug memory leak in end_element()
Martin Olsson [Mon, 9 Jul 2012 09:35:55 +0000 (11:35 +0200)]
scanner: Plug memory leak in end_element()

12 years agowayland-cursor: Add error handling for shm_pool_create()
Martin Olsson [Mon, 9 Jul 2012 09:35:54 +0000 (11:35 +0200)]
wayland-cursor: Add error handling for shm_pool_create()

12 years agoprotocol: Add a couple of missing allow-null annotations
Kristian Høgsberg [Mon, 2 Jul 2012 18:34:48 +0000 (14:34 -0400)]
protocol: Add a couple of missing allow-null annotations

wl_data_device.set_selection() allows NULL to withdraw the previously set
selection and wl_surface.attach() allows a NULL buffer to hide the surface.

12 years agoprotocol: Explicitly mark requests which allow null arguments
Christopher James Halse Rogers [Mon, 2 Jul 2012 10:03:31 +0000 (20:03 +1000)]
protocol: Explicitly mark requests which allow null arguments

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
12 years agoprotocol: Add explicit nullable types
Christopher James Halse Rogers [Mon, 2 Jul 2012 10:03:30 +0000 (20:03 +1000)]
protocol: Add explicit nullable types

Most of the time it does not make sense to pass a NULL object, string, or array
to a protocol request. This commit adds an explicit “allow-null” attribute
to mark the request arguments where NULL makes sense.

Passing a NULL object, string, or array to a protocol request which is not
marked as allow-null is now an error. An implementation will never receive
a NULL value for these arguments from a client.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
12 years agotests: test that path names longer than 108 bytes are rejected
Dylan Noblesmith [Fri, 15 Jun 2012 22:56:37 +0000 (22:56 +0000)]
tests: test that path names longer than 108 bytes are rejected

These would either overflow the struct sockaddr_un, or
be truncated and leave a non-null-terminated string.

12 years agotests: fix make check for out-of-tree builds
Dylan Noblesmith [Fri, 15 Jun 2012 22:44:28 +0000 (22:44 +0000)]
tests: fix make check for out-of-tree builds

It was failing with missing include files.

While here, destroy the ugly "../src/..." include
paths used in the tests that was just hacking around
this problem in the Makefile:

sed -i s/..\\/src\\/// tests/*.c

12 years agotests: sort list of tests
Dylan Noblesmith [Fri, 15 Jun 2012 22:06:58 +0000 (22:06 +0000)]
tests: sort list of tests

12 years agowayland-client: reject socket paths longer than 108 bytes
Dylan Noblesmith [Fri, 15 Jun 2012 21:39:50 +0000 (21:39 +0000)]
wayland-client: reject socket paths longer than 108 bytes

Attempting to write anything longer into the embedded char
array would create a non-null-terminated string, and all
later reads would run off the end into invalid memory.

This is a hard limitation of AF_LOCAL/AF_UNIX sockets.

12 years agowayland-server: reject socket paths longer than 108 bytes
Dylan Noblesmith [Fri, 15 Jun 2012 21:32:19 +0000 (21:32 +0000)]
wayland-server: reject socket paths longer than 108 bytes

Attempting to write anything longer into the embedded char
array would create a non-null-terminated string, and all
later reads would run off the end into invalid memory.

This is a hard limitation of AF_LOCAL/AF_UNIX sockets.

12 years agowayland-server: add more logging of errors
Dylan Noblesmith [Sat, 16 Jun 2012 22:51:35 +0000 (22:51 +0000)]
wayland-server: add more logging of errors

12 years agowayland-server: fix socket ownership race condition
Dylan Noblesmith [Sat, 30 Jun 2012 19:50:09 +0000 (19:50 +0000)]
wayland-server: fix socket ownership race condition

Always unlink() the lock file before closing the file
descriptor for it. Otherwise, there is a race like this:

Process A closes fd, releasing the lock
Process B opens the same file, taking the lock
Process A unlinks the lock file
Process C opens the same file, which now no longer exists,
and takes the lock on the newly created lock file

Process B and C both 'own' the same display socket.

unlink()ing while holding the lock is effectively a better
way to release the lock atomically.

12 years agowayland-server: fix fd leak on error path
Dylan Noblesmith [Sat, 16 Jun 2012 22:47:42 +0000 (22:47 +0000)]
wayland-server: fix fd leak on error path

And restructure get_socket_lock() so it's clearer that it's
allocating a new file descriptor.

Uncovered by an upcoming test.

12 years agodrop use of strerror()
Dylan Noblesmith [Fri, 15 Jun 2012 22:01:06 +0000 (22:01 +0000)]
drop use of strerror()

It isn't thread-safe. Use the %m conversion specifier instead,
like the rest of the code already does.

12 years agowayland-server: reduce use of magic numbers
Dylan Noblesmith [Fri, 15 Jun 2012 21:09:00 +0000 (21:09 +0000)]
wayland-server: reduce use of magic numbers

Make it clear what the significance of '5' and '113' actually is.
Also drop an unneeded function argument.

12 years agoAllocate client proxy automatically for new objects
Kristian Høgsberg [Fri, 29 Jun 2012 02:01:58 +0000 (22:01 -0400)]
Allocate client proxy automatically for new objects

When the server send a new object ID, the client used to have to allocate
the proxy manually and without type-safety.  We now allocate the proxy
in a client-side post-processing step on the incoming closure.

12 years agoprotocol: Change wording of pointer.set_cursor()
Ander Conselvan de Oliveira [Thu, 28 Jun 2012 15:08:03 +0000 (18:08 +0300)]
protocol: Change wording of pointer.set_cursor()

Change the description of pointer.set_cursor() so that a client without
pointer focus but that currently owns the pointer surface can update the
hotspot using it.

12 years agowl_shell: Don't require that parent surfaces are wl_shell_surfaces
Kristian Høgsberg [Wed, 27 Jun 2012 14:30:08 +0000 (10:30 -0400)]
wl_shell: Don't require that parent surfaces are wl_shell_surfaces

The set_transient and set_popup requests take a wl_shell_surface as
the parent surface argument.  We don't need the parent surface to be
a shell surface and this restricts the types of surfaces we can use
the transient and popup surface types on.

12 years agoconfigure.ac: Bump version to 0.94.90 0.94.90
Kristian Høgsberg [Mon, 25 Jun 2012 22:09:00 +0000 (18:09 -0400)]
configure.ac: Bump version to 0.94.90

12 years agoSend modifier event to pointer focus when it changes too
Kristian Høgsberg [Fri, 22 Jun 2012 18:38:12 +0000 (14:38 -0400)]
Send modifier event to pointer focus when it changes too

12 years agoSend keyboard modifier event using the keyboard resource
Kristian Høgsberg [Fri, 22 Jun 2012 16:20:00 +0000 (12:20 -0400)]
Send keyboard modifier event using the keyboard resource

12 years agoMaintain keyboard modifier state in wayland-server
Daniel Stone [Fri, 22 Jun 2012 12:21:26 +0000 (13:21 +0100)]
Maintain keyboard modifier state in wayland-server

Provide a slot for keyboard modifier state inside wl_keyboard for
implementations to update, and use this to send wl_keyboard:;modifier
events whenever the keyboard or pointer focus changes.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agowayland-cursor: Plug leak of filename on load_all_cursors_from_dir()
Ander Conselvan de Oliveira [Tue, 19 Jun 2012 10:45:39 +0000 (13:45 +0300)]
wayland-cursor: Plug leak of filename on load_all_cursors_from_dir()

12 years agoXcursor: Don't ignore unknown file types
Daniel Stone [Mon, 18 Jun 2012 19:01:05 +0000 (20:01 +0100)]
Xcursor: Don't ignore unknown file types

XFS doesn't return the file type with opendir(), and instead only
returns it when you stat() the file itself.  c66f2602 introduced a check
to ensure that only files and symlinks were loaded, while not checking
for DT_UNKNOWN.  Properly handle DT_UNKNOWN by just proceeding anyway.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agodata-device: Fix list corruption when the source goes away
Kristian Høgsberg [Mon, 18 Jun 2012 16:09:47 +0000 (12:09 -0400)]
data-device: Fix list corruption when the source goes away

If the data source is destroyed, the corresponding offers may stay around for
a little longer (until the owning client destroys it).  When the offer is
finally destroyed, we have to be careful to only remove the source
destroy listener if the source hasn't yet been destroyed.

Thanks to Martin Minarik for tracking down where the corruption happened.