Commit Graph

812 Commits

Author SHA1 Message Date
Richard Hughes
4b5871e2b8 Fix 'make dist' as connection.h no longer exists 2012-01-13 12:58:52 -05:00
Neil Roberts
e0b6af03ca server: In default grab, update focus resource after sending release
The default grab implementation in wayland-server was updating the
focus resource before sending the button event. This would cause the
button release to be dropped from the implicit grab if the pointer is
moved away from the focus surface. This patch just swaps the order
around.
2012-01-12 10:59:07 -05:00
Kristian Høgsberg
151ca457b4 shm: Drop non-premul format, use less ambiguous ARGB8888 naming convention
This also matches the new wl_drm format names.
2012-01-11 14:19:54 -05:00
Kristian Høgsberg
b2e619c740 Add new wl_shell popup surface type 2012-01-06 11:40:02 -05:00
Kristian Høgsberg
b6b3d07c83 Move data device implementation into wayland-server 2012-01-06 11:40:02 -05:00
Kristian Høgsberg
dbb3ba7269 Move default grab implementation to wayland-server 2012-01-06 11:40:02 -05:00
Kristian Høgsberg
5ffe9f4708 New grab API
This commit changes the way struct wl_grab works in a couple of ways:

 - The grab itself now decides when it ends instead of hardcoding button
   up as the terminating event.  We remove the end vfunc since a grab now
   always know when it ends and can just clean up at that point.

 - We add a new focus vfunc that is invoked every time the pointer enters
   a new surface, regardless of any grabs.  The callback receives the
   surface and the surface-relative pointer coordinates.  The callback lets
   a grab send enter/leave events and change the grab focus.

 - The grab has a focus surface, wich determines the coordinate space
   for the motion callback coordinates.

 - The input device always tracks the current surface, ie the surface that
   currently contains the pointer, and coordinates relative to that surface.

With these changes, we will be able to pull the core input event delivery
and the drag and drop grab into the core wayland-server library.
2012-01-06 11:30:08 -05:00
Kristian Høgsberg
44b529f2e4 server: Allocate server ID for when resource->object.id is 0 2012-01-04 09:13:27 -05:00
Pekka Paalanen
c7473897fc server: remove wl_display::callback_list as unused
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-03 11:23:17 -05:00
Pekka Paalanen
2755847fce server: add wl_input_device_release()
Add a clean-up function for destroying all objects created in
wl_input_device_init(). Can be used to fix memory leaks reported by
Valgrind in the demos.

The init function was also missing an explicit initialisation of the
'keys' array. Add the explicit array init, although it is redundant with
the zeroing of the whole struct.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>

krh: Edited to rename function to *_release()
2012-01-03 11:22:58 -05:00
Kristian Høgsberg
d6465c5b40 Fix WL_EVENT_WRITEABLE typo 2011-12-28 22:51:34 -05:00
Kristian Høgsberg
c1b9203e5a Drop unused hash table
We now just use a table for looking up object IDs so we should drop the
hash table.
2011-12-27 13:58:56 -05:00
Kristian Høgsberg
bc79f1f820 Rename all instances of typeof 2011-12-22 15:32:37 -05:00
Kristian Høgsberg
5e078bfa5a Use __typeof__ instead of typeof
Thiago Macieira compiles with -std=c++11.
2011-12-22 15:24:20 -05:00
Pekka Paalanen
aad1e19058 server: destroy the socket event source on display destroy
On wl_display_add_socket(), the listening socket fd is added to the
event loop. However, wl_event_source object is not stored and hence
cannot be freed, resulting in a minor leak.

Store wl_event_source pointer in struct wl_socket so we can track it,
and destroy it on wl_display_destroy(). The event loop itself must be
destroyed after destroying the event sources linked to it.

Fixes a Valgrind reported memory leak.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 10:40:39 -05:00
Tiago Vignatti
1f58d155da protocol: update touch_down with focus surface
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-21 13:57:27 -05:00
Kristian Høgsberg
e68529b52f protocol: Add a bit of documentation 2011-12-19 13:15:06 -05:00
Kristian Høgsberg
1b31149f92 connection: Fix printf format warnings 2011-12-17 16:05:44 -05:00
Laszlo Agocs
34901868b8 Increase closure buffer size and fail gracefully for too big closures.
Buffer size changed from 256 to 1024 bytes. Marshalling will now stop
if the buffer is not big enough.
2011-12-17 16:02:05 -05:00
Andy Nichols
f598691831 Removed superfluous call to wl_copy_connection
The only purpose those code seems to serve is to introduce a buffer
overflow when events contain more than 128 bytes of data.
2011-12-14 12:44:12 -05:00
Jørgen Lind
187eace613 Make wl_list_for_each* work for c++ 2011-12-14 09:16:20 -05:00
Pekka Paalanen
e631ab6cde client: fix a strdup memory leak
Memory leak found by valgrinding simple-shm client.
struct wl_global::interface is a strdup()'d string that was never freed.

Make a function for freeing a wl_global, and use it.

krh: Edit to name wl_global destructor wl_global_destroy.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-13 10:01:37 -05:00
Pekka Paalanen
58bb064afa client: unset WAYLAND_SOCKET env variable
WAYLAND_SOCKET contains a file descriptor that is an open connection to
a Wayland server. It is private to us, and makes no sense to relay the
same value (or any value) to our child processes.

Unset the environment variable to prevent it from being accidentally
relayed to other processes.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-05 09:52:09 -05:00
Pekka Paalanen
cf89b40c4c server: do not send delete_id to a dead client
During client tear-down, all objects are destroyed in id order.
Therefore the display object is destroyed first.

If the destroy listeners of any object destroy another object by calling
wl_resoruce_destroy(), we try to send a delete_id event to the client.
This leads to a segmentation fault without a display object.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-29 14:46:49 +02:00
Pekka Paalanen
42eed3235a protocol: introduce wl_shell_surface
Requests like 'move' and 'set_toplevel' are really methods of a surface,
not methods of a global shell object. Move all these methods to a new
interface, wl_shell_surface.

The global object wl_shell will contain only 'get_shell_surface'
request, which creates and associates a wl_shell_surface object to a
given wl_surface object.

This will also give the shell plugin (if you look at the demo
compositor) means to store per-surface private data in a natural way.

Due to a limitation in delete_id event handling on client side, the
client must destroy its wl_shell_surface object before destroying the
wl_surface object. Otherwise it may just leak an id.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-29 14:46:49 +02:00
Pekka Paalanen
e04c137e86 server: document wl_resource_post_event() arguments
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-29 14:46:49 +02:00
Pekka Paalanen
804d5dd348 util: clear pointers on wl_list_remove()
Set the next and prev pointers of the removed list element to NULL. This
will catch programming errors that would use invalid list pointers,
double-remove for instance.

It also helps debugging, making it easy to see in gdb if an object is
not in a list.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-29 14:46:49 +02:00
Pekka Paalanen
ab6b0738c6 server: no errors to a dead client
Do not try to send errors to an already dead client, while in the
middle of cleanup.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-29 14:46:26 +02:00
Kristian Høgsberg
eae3bcb4cc New drag and drop / selection protocol
This commit brings a big change to the DND and copy/paste interfaces.
Most importantly the functionality is now independent of wl_shell.
The wl_shell interface is intended for desktop style UI interaction and
an optional and experimental interface.

The new interface also allows receiving the DND data multiple times or
multiple times during the drag, and the mechanism for offering and receiving
data is now shared between DND and selections.
2011-11-23 16:05:58 -05:00
Kristian Høgsberg
0b7d1e86af server: Stop special casing the compositor
wl_compositor_init() was just adding the global and providing a helper
bind function.  Not useful enough to warrent API.
2011-11-23 10:34:50 -05:00
Kristian Høgsberg
bdbd6ef80b Add support for server allocated object IDs
We set aside a range of the object ID space for use by the server.  This
allows the server to bind an object to an ID for a client and pass that
object to the client.  The client can use the object immediately and the
server can emit events to the object immdiately.
2011-11-22 14:04:11 -05:00
Kristian Høgsberg
190492b97c debug: Use unsigned for object IDs 2011-11-22 14:04:10 -05:00
Kristian Høgsberg
44186b522f scanner: Only strdup interface_name after making sure it's not NULL 2011-11-18 21:23:33 -05:00
Kristian Høgsberg
cf04b0a18f Move private definitions and prototypes to new wayland-private.h 2011-11-18 13:46:56 -05:00
Kristian Høgsberg
68d13212f2 Fix unused variable warning 2011-11-18 13:12:18 -05:00
Kristian Høgsberg
4abc56bd6d Introduce wl_resource_queue_event() for sending events later
Some events, such as the display.delete_id, aren't very urgent and we
would like to not always send them immdiately and cause an unnecessary
context switch.  The wl_resource_queue_event() function will place the
event in the connection output buffer but not request the main loop to
poll for writable.  The effect is that the event will just sit in the
output buffer until a more important event comes around and requires
flushing.
2011-11-17 17:52:01 -05:00
Kristian Høgsberg
3a1e6df39a Add display event to acknowledge ID deletion
We need to make sure the client doesn't reuse an object ID until the
server has seen the destroy request.  When a client destroys an ID
the server will now respond with the display.delete_id event, which lets
the client block reuse until it receives the event.
2011-11-17 17:37:52 -05:00
Kristian Høgsberg
51f50b8c64 util: Add wl_list_insert_list() 2011-11-15 13:48:41 -05:00
Andrea Canciani
3175e91efa hash: Improve double hashing
Instead of artificially introducing collisions in the step value by
replacing 0 with 1 (which causes the value 1 to have twice the
frequency of any other value), the step value can simply be computed
as an uniformly distributed value in the range [1, rehash], extremes
included.

This is safe because any step value smaller than the hash modulus is
co-prime with it, hence induces an orbit which includes every integer
in [0, size - 1].
2011-11-15 10:15:48 -05:00
Kristian Høgsberg
e742dcc9ed scanner: Check name == NULL for enum entries
From a clang static analysis warning.
2011-10-31 11:21:38 -04:00
Benjamin Franzke
3f1063f92a connection: Check object types in message parameters 2011-10-31 11:13:13 -04:00
Kristian Høgsberg
f86338d611 event-loop: Fix idle handler dispatch corner case
When the last idle handler queues another idle handler, we fail to
dispatch that last handler.  The wl_list_for_each_safe loop looks up
the next pointer before running the handler, and at that point it points
to the head of the list and the loop terminates.

Instead, just loop until the list is empty.
2011-10-29 14:27:33 -04:00
Kristian Høgsberg
7e57dc143e scanner: Fix typo in error message 2011-10-24 17:05:39 -04:00
Kristian Høgsberg
bfe54cbe37 protocol: Change global_remove arg to be 'name' insteadl of 'id'
Consistent with global args.
2011-10-24 16:05:04 -04:00
Kristian Høgsberg
d63884b0c7 scanner: Catch more invalid attribute combinations for arg
Spotted by Jakob Bornecrantz.
2011-10-24 16:04:09 -04:00
Kristian Høgsberg
1ac009473b debug: Print debug message when client wakes up
This helps spot and remove extraneous round trips and context switches.
2011-10-20 15:05:11 -04:00
Kristian Høgsberg
65fe6fc418 Silence a valgrind warning 2011-10-12 16:30:08 -04:00
Kristian Høgsberg
8bc1abd1f5 wayland-server: Track input_device resource for focused surface
We no long track the focused surface, but expect the compositor to set
focus when the focus changes.  We do track the resource for the input
device that corresponds to the current surface, in case that goes away.
2011-10-11 22:19:34 -04:00
Kristian Høgsberg
ffe8ee8d60 wayland-server: Always use the display_resource for posting wl_display errors 2011-10-11 14:37:45 -04:00
Mathias Fiedler
a05546376c wayland-server: fix resource destroy
Object ID was read from freed memory.
2011-10-11 14:23:45 -04:00