Commit Graph

1283 Commits

Author SHA1 Message Date
Kristian Høgsberg
7ba218c9f8 shm: Add shm_buffer getters for width and height 2012-07-20 12:04:42 -04:00
Robert Ancell
0a9cd16f6a wayland-client: Add missing newline from an error message 2012-07-20 12:04:05 -04:00
Dmitry Guryanov
2e79c4877f 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.
2012-07-17 16:54:07 -04:00
Pekka Paalanen
52e6dc71be 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>
2012-07-10 14:11:00 -04:00
Pekka Paalanen
a88a4386cb 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>
2012-07-10 14:08:59 -04:00
Pekka Paalanen
9326498d03 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>
2012-07-10 14:08:01 -04:00
Pekka Paalanen
23bf48063f 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>
2012-07-10 13:57:33 -04:00
Robert Ancell
e7e1296682 scanner: Include weston-client.h as the inline functions require it 2012-07-09 22:01:25 -04:00
Kristian Høgsberg
b4aff6b79f wayland-shm: Add return before we hit the error clean-up path
Regression in c94c0946db
2012-07-09 21:50:39 -04:00
Martin Olsson
dba322c1c0 Fixup source comment in wayland-util.h and fix typo in TODO 2012-07-09 18:11:06 -04:00
Martin Olsson
fc0c2e04c5 doc: fix some typos in documentation 2012-07-09 18:03:56 -04:00
Ander Conselvan de Oliveira
84bac043e1 protocol: Add missing allow-null to data_device.enter data_offer field
Fixes bug 51889.
2012-07-09 18:00:31 -04:00
Martin Olsson
c94c0946db shm: Plug leak in shm_create_pool() 2012-07-09 17:59:45 -04:00
Martin Olsson
53bb401704 server: Don't crash for wl_seat_set_touch(seat, NULL) 2012-07-09 17:59:36 -04:00
Martin Olsson
e760ec9fa9 scanner: Plug memory leak in end_element() 2012-07-09 17:59:23 -04:00
Martin Olsson
00902b3815 wayland-cursor: Add error handling for shm_pool_create() 2012-07-09 17:59:08 -04:00
Kristian Høgsberg
8a023688c0 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.
2012-07-02 14:34:48 -04:00
Christopher James Halse Rogers
11db60fe72 protocol: Explicitly mark requests which allow null arguments
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-07-02 13:53:06 -04:00
Christopher James Halse Rogers
161c690b55 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>
2012-07-02 13:53:02 -04:00
Dylan Noblesmith
d2bcffc470 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.
2012-06-30 20:01:20 +00:00
Dylan Noblesmith
b486e3aba5 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
2012-06-30 19:58:37 +00:00
Dylan Noblesmith
c394b75958 tests: sort list of tests 2012-06-30 19:58:37 +00:00
Dylan Noblesmith
af5f8cc200 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.
2012-06-30 19:58:36 +00:00
Dylan Noblesmith
00c25a0565 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.
2012-06-30 19:58:05 +00:00
Dylan Noblesmith
4522467268 wayland-server: add more logging of errors 2012-06-30 19:57:22 +00:00
Dylan Noblesmith
30ff420ca9 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.
2012-06-30 19:50:09 +00:00
Dylan Noblesmith
9475257459 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.
2012-06-30 19:37:42 +00:00
Dylan Noblesmith
cadd999292 drop use of strerror()
It isn't thread-safe. Use the %m conversion specifier instead,
like the rest of the code already does.
2012-06-30 19:37:04 +00:00
Dylan Noblesmith
bb6e48b1b0 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.
2012-06-30 19:37:04 +00:00
Kristian Høgsberg
9de9e39f87 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.
2012-06-28 22:01:58 -04:00
Ander Conselvan de Oliveira
c30ad0d9da 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.
2012-06-28 14:13:41 -04:00
Kristian Høgsberg
ae6f3001a5 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.
2012-06-27 10:30:08 -04:00
Kristian Høgsberg
7e71c38b98 configure.ac: Bump version to 0.94.90 2012-06-25 18:09:00 -04:00
Kristian Høgsberg
9afb5f61f8 Send modifier event to pointer focus when it changes too 2012-06-22 14:38:12 -04:00
Kristian Høgsberg
67e16be8aa Send keyboard modifier event using the keyboard resource 2012-06-22 12:20:00 -04:00
Daniel Stone
bcefacb89d 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>
2012-06-22 11:06:44 -04:00
Ander Conselvan de Oliveira
2261007953 wayland-cursor: Plug leak of filename on load_all_cursors_from_dir() 2012-06-19 11:36:31 -04:00
Daniel Stone
61260854ec 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>
2012-06-18 15:15:11 -04:00
Kristian Høgsberg
c806dde7e6 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.
2012-06-18 12:09:47 -04:00
Kristian Høgsberg
b576443a0e tests: Update test cases to new closure allocate convention 2012-06-15 16:09:39 -04:00
Kristian Høgsberg
c622350fb2 TODO: Remove cursor-as-regular-surface item 2012-06-15 11:09:36 -04:00
Ander Conselvan de Oliveira
6b861f7b4d cursor: Add function for calculating current frame in cursor animation
Given a pointer to struct wl_cursor and an elapsed time in ms.,
wl_cursor_frame() will return the index of the cursor image the should
be displayed.
2012-06-15 10:53:58 -04:00
Ander Conselvan de Oliveira
b6aa49455e protocol: replace pointer.attach with pointer.set_cursor 2012-06-15 10:52:50 -04:00
Kristian Høgsberg
6e94028c31 TODO: Update to account for changes from Daniel 2012-06-13 13:33:01 -04:00
Kristian Høgsberg
8dc57f4dda connection: Set closure->start in demarshal too 2012-06-13 10:45:38 -04:00
Kristian Høgsberg
46f9745c10 connection: Always malloc closure
This lets us allocate the closure just big enough and is a first step towards
a message queue.
2012-06-13 10:45:34 -04:00
Jonas Ådahl
1432bd62df wayland-server: Add destroy signal to wl_seat
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-06-12 20:18:42 -04:00
Jonas Ådahl
f36f32a0e0 wayland-util: wl_list_insert_list() should accept empty lists
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-06-12 20:18:38 -04:00
Ander Conselvan de Oliveira
dd8891be36 wayland-cursor: add an option that changes the cursor theme directory
Some distros (e.g. gentoo) install cursor themes in non-standard
directories. Add option --with-icondir to configure.sh that sets the
directory in which to look for cursors.
2012-06-08 12:50:42 -04:00
Pekka Paalanen
c29020332a server: require XDG_RUNTIME_DIR
An arbitrary fallback to the current directory is only confusing.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-06-06 13:07:33 -04:00