data-device: Implement compositor-chosen actions
Set up a keyboard grab during drag-and-drop, so we can translate
modifiers into preferred actions. The compositor chosen action
is stored in the current weston_data_source in order to make it
accessible to the source/offer at the time of calculating the new
action, but would conceptually be part of weston_drag.
The mapping has been made similar to what GTK+/QT usually do, the
shift key defaults to "move" and ctrl defaults to "copy".
Changes since v2:
- Use enum types and values for the compositor action. Fix
code formatting issues.
Changes since v1:
- Handle the keyboard grab being cancelled. Initialize new
wl_data_source fields.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
diff --git a/src/compositor.h b/src/compositor.h
index 8303a5f..58ae94b 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -336,6 +336,7 @@
bool actions_set;
uint32_t dnd_actions;
enum wl_data_device_manager_dnd_action current_dnd_action;
+ enum wl_data_device_manager_dnd_action compositor_action;
void (*accept)(struct weston_data_source *source,
uint32_t serial, const char *mime_type);