summaryrefslogtreecommitdiff
path: root/clients/dnd.c
Commit message (Collapse)AuthorAgeFilesLines
* clients & tests: Unify multiple definitions of x*alloc and related functionsBryce Harrington2016-03-171-0/+1
| | | | | | | | | | | | | Direct fail_on_null calls now produce output like: [weston-info] clients/weston-info.c:714: out of memory xmalloc, et al produce output on failure like: [weston-info] out of memory (-1) Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* dnd: Turn into a full blown exampleCarlos Garnacho2016-01-191-22/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to keep things simple, weston-dnd made a few choices that turn out to be unrealistic, a few tweaks have been done to make it less of a playground demo: - It now caters for copy/move operations, instead of just move, which still remains the default nonetheless. - As "move" operations are no longer assumed, the item isn't removed on start_drag, instead it is made translucent until the drag operation finishes (and we know whether the item is to be removed after transfer or left as is) - For the same reasons, "Drop nowhere to delete item" no longer happens. Drag-and-drop is a failable operation and must not result in data loss. - As multiple actions are now allowed, we set the pointer icon surface accordingly to the current operation. This makes weston-dnd a better example of what applications usually want to do here. Changes since v2: - Updated to behave alright-ish with version < 3. Changes since v1: - Remove unneeded include. Remove extra newlines. Other minor code fixes. Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
* data-device: Implement DnD actionsCarlos Garnacho2016-01-191-5/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The policy in weston in order to determine the chosen DnD action is deliberately simple, and is probably the minimals that any compositor should be doing here. Besides honoring the set_actions requests on both wl_data_source and wl_data_offer, weston now will emit the newly added "action" events notifying both source and dest of the chosen action. The "dnd" client has been updated too (although minimally), so it notifies the compositor of a "move" action on both sides. Changes since v8: - Add back wl_data_offer.source_actions emission, gone during last code shuffling. Fix nits found in review. Changes since v7: - Fixes spotted during review. Add client-side version checks. Implement .action emission as specified in protocol patch v11. Changes since v6: - Emit errors as defined in DnD actions patch v10. Changes since v5: - Use enum types and values for not-a-bitfield stored values. handle errors when finding unexpected dnd_actions values. Changes since v4: - Added compositor-side version checks. Spaces vs tabs fixes. Fixed resource versioning. Initialized new weston_data_source/offer fields. Changes since v3: - Put data_source.action to use in the dnd client, now updates the dnd surface like data_source.target events do. Changes since v2: - Split from DnD progress notification changes. Changes since v1: - Updated to v2 of DnD actions protocol changes, implement wl_data_offer.source_actions. - Fixed coding style issues. Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
* data-device: Implement DnD progress notificationCarlos Garnacho2016-01-191-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Weston now sends wl_data_source.dnd_drop_performed and .dnd_finished in order to notify about the different phases of DnD. wl_data_source.cancelled is also used as mentioned in the docs, being emitted also on DnD when the operation is meant to fail (eg. source and dest didn't agree on a mimetype). The dnd demo is also fixed so the struct dnd_drag isn't leaked. https://bugs.freedesktop.org/show_bug.cgi?id=91943 https://bugs.freedesktop.org/show_bug.cgi?id=91944 Changes since v6: - Add client-side version checks. Minor code shuffling. Changes since v5: - Dissociate source and offer after cancel. Updated to apply on top of c9f8f8a7f. Changes since v4: - Make wl_data_offer.finish with the wrong state an error. Changes since v3: - Fixed wl_data_source.dnd_finished vs cancelled emission on when interoperating with version < 3 drag destinations. Changes since v2: - Handle wl_data_offer.finish. Fixed commit log inconsistencies. Added version checks. Spaces vs tabs fixes. Fixed resource versioning. Changes since v1: - Updated to protocol v2. Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* Moved helper macro to a discrete include file.Jon Cruz2015-06-151-0/+1
| | | | | | | | | | | To help reduce code duplication and also 'kitchen-sink' includes the ARRAY_LENGTH macro was moved to a stand-alone file and referenced from the sources consuming it. Other macros will be added in subsequent passes. Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* Remove redundant #include path component.Jon Cruz2015-06-151-1/+1
| | | | | | | | | Using the parent '../' path component in #include statements makes the codebase more rigid and is redundant due to proper -I use. Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* clients: Update boilerplate from MIT X11 license to MIT Expat licensesBryce Harrington2015-06-151-16/+17
|
* remove trailing whitespacesMichael Vetter2015-05-151-6/+6
| | | | | Remove trailing whitespaces because they are not needed and jumping to the end of al ine should do just that and not jump to the whitespace.
* dnd: Fix some mouse cursor issuesDerek Foreman2014-11-281-13/+80
| | | | | | | | | | | | | | | | | | | When ending a drag in the window the cursor will be wrong until the mouse is moved again. This is because the item being dragged isn't added until after the enter event. Also, when picking up an item while moving the mouse the cursor can switch back to a non-drag cursor before the drag begins. This is because of a slight delay between button click and drag start. Finally picking up or dropping an item under a second pointer could cause that pointer to have the wrong cursor. Closes one of the issues in bug 56298 https://bugs.freedesktop.org/show_bug.cgi?id=56298 Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* weston-dnd --help worksBill Spitzak2014-08-191-5/+10
|
* Clients: Fix memleak issues in various clients of westonvivek2014-06-241-0/+11
| | | | | | | | | In many clients of weston, Display was not being destroyed so added it. Also destroy windows, widgets which were not being destroyed. Signed-off-by: vivek <vivek.ellur@samsung.com> Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com> Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
* Make sure config.h is included before any system headersAndrew Wedgbury2014-04-071-0/+2
| | | | | | | | | | | | | | | There was an issue recently in screen-share.c where config.h was not being included, resulting in the wrong definition for off_t being used on 32 bit systems. I checked and I don't think this problem is happening elsewhere, but to help avoid this sort of problem in the future, I went through and made sure that config.h is included first whenever system headers are included. The config.h header should be included before any system headers, failing to do this can result in the wrong type sizes being defined on certain systems, e.g. off_t from sys/types.h Signed-off-by: Andrew Wedgbury <andrew.wedgbury@realvnc.com>
* distinguish touch screen and pointer dnd in clientXiong Zhang2013-11-251-1/+2
| | | | | | | | | | | | | | | | | | Data device interface in client just handle with pointer's dnd. If a touch screen trigger dnd, it will use pointer struct like i nput->sx, input->sy, input->pointer_focus. So if pointer is moving when touch screen trigeer a dnd, wrong behaviore will occur. Before touch screen start dnd, system call touch_grab() to mark the following drag and drop operation is generated by touch screen. Defined some common variables in struct input to track dnd. Note, touch screen and pointer can't generate drag and drop at the same time, becuae data device protocol can't identify the drag and drop event is generated by touch screen or pointer. Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com> Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
* client/dnd.c: add dnd support for touch screen in clientXiong Zhang2013-11-251-13/+43
| | | | | | | | | Adding the interface for touch screen event in clients/dnd.c, once user touch down on this app, it will trigger a touch and drag operation. Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com> Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
* dnd: Simplify drag icon creationKristian Høgsberg2013-11-221-25/+8
| | | | | | We used to have to composite the pointer on top of the drag icon, but the final protocol allows us to specify both a drag icon and a cursor. Remove the complexity that dealt with that.
* Rename frame_create and frame_set_child_size with a window_ prefixJason Ekstrand2013-10-131-2/+2
| | | | | | This is to avoid a collision with an actual frame structure. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* dnd: Support dropping as text/plain;charset=utf-8Kristian Høgsberg2013-09-091-9/+23
|
* dnd: Only accept dnd with the application/x-wayland-dnd-flower mime-typeKristian Høgsberg2013-09-041-3/+9
| | | | | | Currently, the dnd sample client accepts all mime-types and assumes they are the custom flower mime-type. Only accept if the offer has the right mime-type.
* malloc + memset -> zallocPeter Hutterer2013-08-081-3/+1
| | | | | | And for clients using the xmalloc helper, use xzalloc. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* clients: use xmalloc in more placesBrian Lovin2013-08-071-4/+2
| | | | | | For the clients continue to use xmalloc() to simplify OOM-handling. Signed-off-by: Brian Lovin <brian.j.lovin@intel.com>
* Pass argc pointer to parse_options()Kristian Høgsberg2013-02-201-1/+1
| | | | | This lets us keep argc up to date as the backend picks out arguments from the argv array.
* dnd: Use %zd in the format string for size_t typesDamien Lespiau2012-10-291-1/+1
| | | | len i size_t, so is the result of the sizeof operator.
* clients: use wl_surface_commitPekka Paalanen2012-10-101-0/+2
| | | | | | | | | | | | | Use wl_surface_commit() to commit the buffer attach, as Weston now requires. NOTE: GL-applications are broken until you upgrade to a version of Mesa which does wl_surface_commit() on eglSwapBuffers(). If you have Cairo-gl, this means all toytoolkit apps, too. simple-shm and simple-touch OTOH will work now. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
* dnd: fix segfault on grabbingPhilipp Brüschweiler2012-08-131-0/+7
| | | | | | | Some cursor themes don't include a "grabbing" icon, causing a segfault. This patch fixes this by just reverting to the stardard cursor instead. https://bugs.freedesktop.org/show_bug.cgi?id=50487
* dnd: Clip flowers to window content areaKristian Høgsberg2012-07-231-0/+3
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=52420
* window: Compute initial window size correctlyKristian Høgsberg2012-06-201-1/+1
| | | | We didn't take decoration size into account before.
* window.c: Drop timestamp argument to input_set_pointer_image()Kristian Høgsberg2012-06-041-1/+1
| | | | We need the serial to set a pointer image and we track that internally.
* Use enum wl_pointer_button_state instead of integerDaniel Stone2012-05-311-2/+3
| | | | | | | | Instead of using a uint32_t for state everywhere (except on the wire, where that's still the call signature), use the new wl_pointer_button_state enum, and explicit comparisons. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* dnd: implement option for not offering data to other clientsAnder Conselvan de Oliveira2012-05-291-18/+58
| | | | | | Add option --self-only to dnd client. If this options is passed, the drag will be started with no data source so that no drag and drop events are sent to other clients.
* dnd: work around cairo-gl brokennessAnder Conselvan de Oliveira2012-05-251-2/+4
| | | | | | | | | | If cairo-gl is used, display_create_surface() will create an wl_egl_window for each surface and this will result in errors if this surface is used as a source. Also, one can't get a wl_buffer for such a surface wich led to crashes when trying to do so for the drag icon. This patch works around both problems by forcing the item and drag icon surfaces to use shm.
* window: rename enum pointer_type to cursor_typeAnder Conselvan de Oliveira2012-05-251-4/+4
| | | | This avoids confusion with the pointer devices (struct wl_pointer).
* window: track changes in libwayland-cursor apiAnder Conselvan de Oliveira2012-05-251-4/+4
| | | | | | | libwayland-cursor does not provide enum wl_cursor_type anymore so this brings back enum pointer_type. This partially revers commit 1042dc15e0ca69a4d8d4d23b862f1e3d3c8e054f.
* window: use libwayland-cursor instead of libXcursorAnder Conselvan de Oliveira2012-05-221-21/+12
|
* Move cairo-util to shared/Kristian Høgsberg2012-05-151-1/+1
|
* window.c: Just use float instead of GLfloat, remove GLES2.h includeKristian Høgsberg2012-05-101-3/+3
|
* Convert internal input co-ordinates to GLfloatDaniel Stone2012-05-081-3/+3
| | | | | | | Change all client motion handlers to take GLfloat for co-ordinates, rather than int32_t. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Change button from int to uint32_tDaniel Stone2012-05-071-1/+1
| | | | | | Since you can't really have a negative button number. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Change key/button grab bindings to take unsigned stateDaniel Stone2012-05-071-1/+1
| | | | | | 'state' here meaning 'is it up or down?', obviously. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* window.c: Drop the toolkit grab when we start a compositor grabKristian Høgsberg2012-04-131-0/+2
| | | | | We do this right for move and resize, but dnd and popups need the same treatment.
* Follow wayland change to serial numbersKristian Høgsberg2012-04-111-6/+7
|
* Fix `unused-result' warnings.Jonas Ådahl2012-04-031-1/+3
| | | | Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* Add signedness warning flag and fix falloutKristian Høgsberg2012-03-301-5/+6
|
* dnd: Damage surface after attaching new bufferKristian Høgsberg2012-03-271-0/+7
|
* clients: Fix a couple of warningsKristian Høgsberg2012-03-271-2/+0
|
* Add an option parserKristian Høgsberg2012-03-121-1/+1
| | | | | | | On one hand, getopt (in particular the -o suboption syntax) sucks on the server side, and on the client side we would like to avoid the glib dependency. We can roll out own option parser and solve both problems and save a few lines of code total.
* clients/dnd: adapt to new data_device icon protocolAnder Conselvan de Oliveira2012-02-161-3/+18
| | | | Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
* window: Dont take width and height in window constructorKristian Høgsberg2012-01-311-1/+1
| | | | Always set this by scheduling an initial resize.
* window: Make decorations just a widgetKristian Høgsberg2012-01-101-1/+1
| | | | Woohoo, only took 25 commits of refactoring to get to this point.
* window: Get rid of the window child allocation conceptKristian Høgsberg2012-01-101-6/+5
|
* window: Make resize and redraw handlers widget vfuncsKristian Høgsberg2012-01-101-11/+4
|