From: Kristian Høgsberg Date: Thu, 5 Sep 2013 02:36:49 +0000 (-0700) Subject: dnd: Only accept dnd with the application/x-wayland-dnd-flower mime-type X-Git-Tag: 1.2.91~63 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=938f102a970ac318cc5d1414321a6de90f0a733d;p=platform%2Fupstream%2Fweston.git dnd: Only accept dnd with the application/x-wayland-dnd-flower mime-type 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. --- diff --git a/clients/dnd.c b/clients/dnd.c index cfdf92f..8171193 100644 --- a/clients/dnd.c +++ b/clients/dnd.c @@ -81,6 +81,8 @@ static const int item_width = 64; static const int item_height = 64; static const int item_padding = 16; +static const char flower_mime_type[] = "application/x-wayland-dnd-flower"; + static struct item * item_create(struct display *display, int x, int y, int seed) { @@ -495,14 +497,18 @@ dnd_data_handler(struct window *window, float x, float y, const char **types, void *data) { struct dnd *dnd = data; + int i, has_flower = 0; if (!types) return; + for (i = 0; types[i]; i++) + if (strcmp(types[i], flower_mime_type) == 0) + has_flower = 1; - if (dnd_get_item(dnd, x, y) || dnd->self_only) { + if (dnd_get_item(dnd, x, y) || dnd->self_only || !has_flower) { input_accept(input, NULL); } else { - input_accept(input, types[0]); + input_accept(input, flower_mime_type); } } @@ -546,7 +552,7 @@ dnd_drop_handler(struct window *window, struct input *input, if (!dnd->self_only) { input_receive_drag_data(input, - "application/x-wayland-dnd-flower", + flower_mime_type, dnd_receive_func, dnd); } else if (dnd->current_drag) { message.seed = dnd->current_drag->item->seed;