aboutsummaryrefslogtreecommitdiffstats
path: root/src/data-device.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove input structsKristian Høgsberg2013-05-071-539/+0
| | | | | | | | | | | | | | | | Looking at the functionality in the server library, it's clear (in hindsight) that there are two different "things" in there: 1) The IPC API, that is, everything that concerns wl_display, wl_client, wl_resource and 2) and half-hearted attempt at sharing input code and focus logic that leaves a lot of problematic structs in the API surface, only to share less than 1000 lines of code. We can just move those input structs and helper functions into weston and cut libwayland-server down to just the core server side IPC API. In the short term, compositors can copy those structs and functions into their source, but longer term, they're probably better off reimplementing those objects and logic their native framework (QObject, GObject etc).
* Add wl_resource_init and use it in libwayland implementations of data ↵Jason Ekstrand2013-03-181-12/+4
| | | | | | | | | | | | | | | | | sharing and SHM This commit adds a wl_resource_init function for initializing wl_resource structures similar to wl_client_add_object. From this commit forward, wl_resource structures should not be initialized manually, but should use wl_resource_init. In the event of a change to the wl_resource structure, this allows us to protect against regressions by filling in added fields with reasonable defaults. In this way, while changing wl_object or wl_resource still constitutes an ABI break, compositors following this rule will only need to be recompiled in order to properly link against the new version. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* Move un-namespaced container_of into private headerKristian Høgsberg2012-10-191-0/+1
|
* data-device: Don't fake an attach event on drag icon surfaceAnder Conselvan de Oliveira2012-10-111-10/+2
| | | | | Emit a new drag icon signal instead and let the compositor handle the unmapping of the icon surface.
* remove listener from wl_data_source destroy_signal listener listDmitry Guryanov2012-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* data-device: Fix list corruption when the source goes awayKristian Høgsberg2012-06-181-1/+2
| | | | | | | | | 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.
* data-device: Don't implement data source through data offer objectKristian Høgsberg2012-06-031-21/+35
| | | | | | | | | The wl_data_source object used to specify the implementation for data offers created for it. This means you need a data offer to retrieve the data from the source, which makes it awkward to use in-process in a compositor. Now we instead have three virtual functions that can be connected to a protocol object or in-process data-sources such as an X server proxy or clipboard.
* data-device: Handle setting a NULL selection sourceKristian Høgsberg2012-05-311-5/+9
|
* data-device: Emit selection_signal also when we lose the selectionKristian Høgsberg2012-05-311-0/+2
|
* data-device: Only send out NULL selection if we have a resourceKristian Høgsberg2012-05-311-1/+2
| | | | | If the current keyboard focus client doesn't have a resource for the data_device, don't send out the selection event.
* Add key_state and button_state enumsDaniel Stone2012-05-311-3/+6
| | | | | | Rather than hardcoding 0 and 1 everywhere. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* data-device: implement drags with no data source for self-dndAnder Conselvan de Oliveira2012-05-291-21/+37
| | | | | | Properly handle a drag with no data source, i.e., don't crash and send events only to the client that initiated the drag. This way a client can do self drag and drop without offering anything to other clients.
* data-device: fix crash when a client dies during a drag with an iconAnder Conselvan de Oliveira2012-05-251-1/+1
| | | | | | The commit that split wl_input_device into wl_seat and friends changed erroneously the drag icon destroy listener, causing it to operate into an invalid pointer to a wl_seat.
* Convert wl_input_device to wl_seat (and friends)Daniel Stone2012-05-161-98/+94
| | | | | | | | | | | | | wl_input_device has been both renamed and split. wl_seat is now a virtual object representing a group of logically related input devices with related focus. It now only generates one event: to let clients know that it has new capabilities. It takes requests which hand back objects for the wl_pointer, wl_keyboard and wl_touch interfaces it exposes which all provide the old input interface, just under different names. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Input: Convert pointer co-ordinates to signed_24_8Daniel Stone2012-05-081-4/+7
| | | | | | | This offers more precision when using devices like tablets, and also for transformed surfaces. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Use unsigned for key/button up/down state in grabsDaniel Stone2012-05-071-1/+1
| | | | | | | Since we just use it as a simple boolean flag, might as well convert it to unsigned. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* data-device: Take away pointer focus when we start a dnd dragKristian Høgsberg2012-04-131-0/+2
|
* data-device: Record the serial number for the current selectionKristian Høgsberg2012-04-131-2/+8
| | | | And reject setting a selection that's older than our current selection.
* data-device: Clear drag focus when we end the drag-and-dropKristian Høgsberg2012-04-131-0/+2
| | | | Otherwise we'll see a spurious leave event when we start the next dnd.
* Introduce wl_signalKristian Høgsberg2012-04-121-36/+24
| | | | | This is mostly renaming and consolidating the listener_list pattern into something more concise and reusable.
* Switch protocol to using serial numbers for ordering events and requestsKristian Høgsberg2012-04-111-21/+26
| | | | | | | | | | | | | | | | | | | | | | | The wayland protocol, as X, uses timestamps to match up certain requests with input events. The problem is that sometimes we need to send out an event that doesn't have a corresponding timestamped input event. For example, the pointer focus surface goes away and new surface needs to receive a pointer enter event. These events are normally timestamped with the evdev event timestamp, but in this case, we don't have a evdev timestamp. So we have to go to gettimeofday (or clock_gettime()) and then we don't know if it's coming from the same time source etc. However for all these cases we don't need a real time timestamp, we just need a serial number that encodes the order of events inside the server. So we introduce a serial number mechanism that we can use to order events. We still need real-time timestamps for actual input device events (motion, buttons, keys, touch), to be able to reason about double-click speed and movement speed so events that correspond to user input carry both a serial number and a timestamp. The serial number also give us a mechanism to key together events that are "logically the same" such as a unicode event and a keycode event, or a motion event and a relative event from a raw device.
* server: fix button signedness in wl_grab_interfacePekka Paalanen2012-03-301-1/+1
| | | | | | | | | | | | wl_input_device::grab_button is unsigned but the button parameter to wl_grab_interface::button is signed. This lead to a warning in data-device.c. The button number is unsigned in the protocol, so make it unsigned in the wl_grab_interface API, too. Fixes the compiler warning "comparison between signed and unsigned integer expressions". Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
* data-device: notify the compositor about new drag iconsAnder Conselvan de Oliveira2012-03-271-0/+5
| | | | | Let the compositor use a listener to be notified when a new drag icon is set up.
* Add wl_array_for_eachKristian Høgsberg2012-03-041-6/+4
|
* Terminate drag if data source is destroyedAnder Conselvan de Oliveira2012-03-021-16/+40
|
* server: fix event sending type mismatchesPekka Paalanen2012-03-021-1/+1
| | | | | | | These were not bugs in practice, because the first (and only) field of struct wl_surface is struct wl_resource. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
* server: use the event sending wrappersPekka Paalanen2012-03-021-25/+16
| | | | | | This exposes some type mismatches that are fixed in the next commit. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
* Fix server crash when a client dies during a drag with an iconAnder Conselvan de Oliveira2012-03-011-1/+18
| | | | | | | | If a client dies during a drag that it started using an icon surface, the server could crash because the icon surface is not valid anymore. Fix this by using a destroy listener to reset device->drag_surface to nil when the surface is destroyed.
* Fix wl_data_offer source destroy listenerAnder Conselvan de Oliveira2012-03-011-1/+4
| | | | | | The listener function implementation was getting a wrong pointer to the wl_data_offer object because the resource parameter is actually the data source and not the data offer.
* server: Rename wl_grab_interface.Scott Moreau2012-02-181-6/+6
| | | | | | | | | | | | | In order to separate pointer and keyboard grabs, we need to introduce a keyboard grab interface but first we must rename some generic types to denote which device is holding the grab. Type renames: wl_grab_interface -> wl_pointer_grab_interface wl_grab -> wl_pointer_grab wl_input_device_start_grab -> wl_input_device_start_pointer_grab wl_input_device_end_grab -> wl_input_device_end_pointer_grab
* data_device: get rid of attach requestAnder Conselvan de Oliveira2012-02-161-11/+20
| | | | | | | | | In the effort to make everything a regular surface, remove data_device.attach request. To maintan the functionality, add an icon surface parameter to data_device.start_drag. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
* Move data device implementation into wayland-serverKristian Høgsberg2012-01-061-0/+464