summaryrefslogtreecommitdiff
path: root/src/bin/e_comp_wl_data.c
blob: 49aa84d0b93b6ea0339aadaa50f7403095f1a8c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
#define E_COMP_WL
#include "e.h"

static struct wl_resource *
_e_comp_wl_data_find_for_client(Eina_List *list, struct wl_client *client)
{
   Eina_List *l;
   struct wl_resource *res;

   EINA_LIST_FOREACH(list, l, res)
     {
        if (wl_resource_get_client(res) == client)
          return res;
     }

   return NULL;
}

static void 
_e_comp_wl_data_offer_cb_accept(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, const char *mime_type)
{
   E_Comp_Wl_Data_Offer *offer;

   if (!(offer = wl_resource_get_user_data(resource)))
     return;

   if (offer->source)
     offer->source->target(offer->source, serial, mime_type);
}

static void
_e_comp_wl_data_offer_cb_receive(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, const char *mime_type, int32_t fd)
{
   E_Comp_Wl_Data_Offer *offer;

   if (!(offer = wl_resource_get_user_data(resource)))
     return;

   if (offer->source)
     offer->source->send(offer->source, mime_type, fd);
   else
     close(fd);
}

/* called by wl_data_offer_destroy */
static void
_e_comp_wl_data_offer_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
{
   wl_resource_destroy(resource);
}

/* called by wl_resource_destroy */
static void
_e_comp_wl_data_offer_cb_resource_destroy(struct wl_resource *resource)
{
   E_Comp_Wl_Data_Offer *offer;

   if (!(offer = wl_resource_get_user_data(resource)))
     return;

   if (offer->source)
     wl_list_remove(&offer->source_destroy_listener.link);

   free(offer);
}

/* called by emission of source->destroy_signal */
static void
_e_comp_wl_data_offer_cb_source_destroy(struct wl_listener *listener, void *data EINA_UNUSED)
{
   E_Comp_Wl_Data_Offer *offer;

   offer = container_of(listener, E_Comp_Wl_Data_Offer, 
                        source_destroy_listener);
   if (!offer) return;

   offer->source = NULL;
}

static const struct wl_data_offer_interface _e_data_offer_interface =
{
   _e_comp_wl_data_offer_cb_accept,
   _e_comp_wl_data_offer_cb_receive,
   _e_comp_wl_data_offer_cb_destroy,
};

static void
_e_comp_wl_data_source_cb_offer(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, const char *mime_type)
{
   E_Comp_Wl_Data_Source *source;

   if (!(source = wl_resource_get_user_data(resource)))
     return;

   source->mime_types = 
     eina_list_append(source->mime_types, eina_stringshare_add(mime_type));
}

/* called by wl_data_source_destroy */
static void
_e_comp_wl_data_source_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
{
   wl_resource_destroy(resource);
}

/* called by wl_resource_destroy */
static void
_e_comp_wl_data_source_cb_resource_destroy(struct wl_resource *resource)
{
   E_Comp_Wl_Data_Source *source;
   char *t;

   if (!(source = wl_resource_get_user_data(resource)))
     return;

   wl_signal_emit(&source->destroy_signal, source);

   EINA_LIST_FREE(source->mime_types, t)
      eina_stringshare_del(t);

   free(source);
}

static void
_e_comp_wl_data_source_target_send(E_Comp_Wl_Data_Source *source, uint32_t serial EINA_UNUSED, const char* mime_type)
{
   wl_data_source_send_target(source->resource, mime_type);
}

static void
_e_comp_wl_data_source_send_send(E_Comp_Wl_Data_Source *source, const char* mime_type, int32_t fd)
{
   wl_data_source_send_send(source->resource, mime_type, fd);
   close(fd);
}

static void
_e_comp_wl_data_source_cancelled_send(E_Comp_Wl_Data_Source *source)
{
   wl_data_source_send_cancelled(source->resource);
}

static const struct wl_data_source_interface _e_data_source_interface =
{
   _e_comp_wl_data_source_cb_offer,
   _e_comp_wl_data_source_cb_destroy,
};

static void
_e_comp_wl_data_device_destroy_selection_data_source(struct wl_listener *listener, void *data)
{
   E_Comp_Data *cdata;
   E_Comp_Wl_Data_Source *source;
   struct wl_resource *data_device_res, *focus = NULL;

   if (!(source = (E_Comp_Wl_Data_Source*)data))
     return;

   if (!(cdata = container_of(listener, E_Comp_Data, 
                              selection.data_source_listener)))
     return;

   cdata->selection.data_source = NULL;

   if (cdata->kbd.enabled)
     focus = cdata->kbd.focus;

   if (focus)
     {
        data_device_res = 
           _e_comp_wl_data_find_for_client(cdata->mgr.data_resources, 
                                           wl_resource_get_client(source->resource));

        if (data_device_res)
          wl_data_device_send_selection(data_device_res, NULL);
     }

   wl_signal_emit(&cdata->selection.signal, cdata);
}

static struct wl_resource*
_e_comp_wl_data_device_data_offer_create(E_Comp_Wl_Data_Source *source, struct wl_resource *data_device_res)
{
   E_Comp_Wl_Data_Offer *offer;
   Eina_List *l;
   char *t;

   offer = E_NEW(E_Comp_Wl_Data_Offer, 1);
   if (!offer) return NULL;

   offer->resource = wl_resource_create(wl_resource_get_client(data_device_res), &wl_data_offer_interface, 1, 0);
   if (!offer->resource)
     {
        free(offer);
        return NULL;
     }

   wl_resource_set_implementation(offer->resource, 
                                  &_e_data_offer_interface, offer, 
                                  _e_comp_wl_data_offer_cb_resource_destroy);
   offer->source = source;
   offer->source_destroy_listener.notify = 
     _e_comp_wl_data_offer_cb_source_destroy;
   wl_signal_add(&source->destroy_signal, &offer->source_destroy_listener);

   wl_data_device_send_data_offer(data_device_res, offer->resource);

   EINA_LIST_FOREACH(source->mime_types, l, t)
      wl_data_offer_send_offer(offer->resource, t);

   return offer->resource;
}

static void
_e_comp_wl_data_device_selection_set(E_Comp_Data *cdata, E_Comp_Wl_Data_Source *source, uint32_t serial)
{
   E_Comp_Wl_Data_Source *sel_source;
   struct wl_resource *offer_res, *data_device_res, *focus = NULL;

   sel_source = (E_Comp_Wl_Data_Source*)cdata->selection.data_source;

   if ((sel_source) &&
       (cdata->selection.serial - serial < UINT32_MAX / 2))
     {
        /* TODO: elm_entry is sending too many request on now,
         * for those requests, selection.signal is being emitted also a lot.
         * when it completes to optimize the entry, it should be checked more.
         */
        if (cdata->clipboard.source)
          wl_signal_emit(&cdata->selection.signal, cdata);

        return;
     }

   if (sel_source)
     {
        if (sel_source->cancelled)
          sel_source->cancelled(sel_source);
        wl_list_remove(&cdata->selection.data_source_listener.link);
        cdata->selection.data_source = NULL;
     }

   cdata->selection.data_source = sel_source = source;
   cdata->selection.serial = serial;

   if (cdata->kbd.enabled)
     focus = cdata->kbd.focus;

   if (focus)
     {
        data_device_res =
           _e_comp_wl_data_find_for_client(cdata->mgr.data_resources,
                                           wl_resource_get_client(focus));
        if ((data_device_res) && (source))
          {
             offer_res =
                _e_comp_wl_data_device_data_offer_create(source,
                                                         data_device_res);
             wl_data_device_send_selection(data_device_res, offer_res);

          }
        else if (data_device_res)
          {
             wl_data_device_send_selection(data_device_res, NULL);
          }
     }

   wl_signal_emit(&cdata->selection.signal, cdata);

   if (source)
     {
        cdata->selection.data_source_listener.notify = 
          _e_comp_wl_data_device_destroy_selection_data_source;
        wl_signal_add(&source->destroy_signal, 
                      &cdata->selection.data_source_listener);
     }
}

static void
_e_comp_wl_data_device_cb_drag_start(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, struct wl_resource *source_resource EINA_UNUSED, struct wl_resource *origin_resource EINA_UNUSED, struct wl_resource *icon_resource EINA_UNUSED, uint32_t serial EINA_UNUSED)
{

}

static void
_e_comp_wl_data_device_cb_selection_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, struct wl_resource *source_resource, uint32_t serial)
{
   E_Comp_Data *cdata;
   E_Comp_Wl_Data_Source *source;

   if (!source_resource) return;
   if (!(cdata = wl_resource_get_user_data(resource))) return;

   source = wl_resource_get_user_data(source_resource);
   _e_comp_wl_data_device_selection_set(cdata, source, serial);
}

static const struct wl_data_device_interface _e_data_device_interface =
{
   _e_comp_wl_data_device_cb_drag_start,
   _e_comp_wl_data_device_cb_selection_set,
};

static void
_e_comp_wl_data_device_cb_unbind(struct wl_resource *resource)
{
   E_Comp_Data *cdata;

   if(!(cdata = wl_resource_get_user_data(resource)))
     return;

   cdata->mgr.data_resources = 
     eina_list_remove(cdata->mgr.data_resources, resource);
}

static void
_e_comp_wl_data_manager_cb_source_create(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t id EINA_UNUSED)
{
   E_Comp_Wl_Data_Source *source;

   source = E_NEW(E_Comp_Wl_Data_Source, 1);
   if (!source)
     {
        wl_resource_post_no_memory(resource);
        return;
     }

   wl_signal_init(&source->destroy_signal);
   source->target = _e_comp_wl_data_source_target_send;
   source->send = _e_comp_wl_data_source_send_send;
   source->cancelled = _e_comp_wl_data_source_cancelled_send;

   source->resource = 
     wl_resource_create(client, &wl_data_source_interface, 1, id);
   if (!source->resource)
     {
        ERR("Could not create data source resource: %m");
        free(source);
        wl_resource_post_no_memory(resource);
        return;
     }

   wl_resource_set_implementation(source->resource, 
                                  &_e_data_source_interface, source, 
                                  _e_comp_wl_data_source_cb_resource_destroy);
}

static void 
_e_comp_wl_data_manager_cb_device_get(struct wl_client *client, struct wl_resource *manager_resource, uint32_t id, struct wl_resource *seat_resource)
{
   E_Comp_Data *cdata;
   struct wl_resource *res;

   DBG("Comp_Wl_Data: Get Data Device");

   /* try to get the compositor data */
   if (!(cdata = wl_resource_get_user_data(seat_resource))) return;

   /* try to create the data device resource */
   res = wl_resource_create(client, &wl_data_device_interface, 1, id);
   if (!res)
     {
        ERR("Could not create data device resource: %m");
        wl_resource_post_no_memory(manager_resource);
        return;
     }

   cdata->mgr.data_resources = 
     eina_list_append(cdata->mgr.data_resources, res);
   wl_resource_set_implementation(res, &_e_data_device_interface, cdata, 
                                  _e_comp_wl_data_device_cb_unbind);
}

static const struct wl_data_device_manager_interface _e_manager_interface = 
{
   _e_comp_wl_data_manager_cb_source_create,
   _e_comp_wl_data_manager_cb_device_get
};

/* static void  */
/* _e_comp_wl_data_cb_unbind_manager(struct wl_resource *resource) */
/* { */
/*    E_Comp_Data *cdata; */

/*    DBG("Comp_Wl_Data: Unbind Manager"); */

/*    if (!(cdata = wl_resource_get_user_data(resource))) return; */

/*    cdata->mgr.resource = NULL; */
/* } */

static void 
_e_comp_wl_data_cb_bind_manager(struct wl_client *client, void *data, uint32_t version EINA_UNUSED, uint32_t id)
{
   E_Comp_Data *cdata;
   struct wl_resource *res;

   if (!(cdata = data)) return;

   DBG("Comp_Wl_Data: Bind Manager");

   /* try to create data manager resource */
   res = wl_resource_create(client, &wl_data_device_manager_interface, 1, id);
   if (!res)
     {
        ERR("Could not create data device manager: %m");
        wl_client_post_no_memory(client);
        return;
     }

   wl_resource_set_implementation(res, &_e_manager_interface, cdata, NULL);
}

static void
_e_comp_wl_clipboard_source_unref(E_Comp_Wl_Clipboard_Source *source)
{
   char* t;

   source->ref --;
   if (source->ref > 0) return;

   if (source->fd_handler)
     {
        ecore_main_fd_handler_del(source->fd_handler);
        close(source->fd);
     }

   EINA_LIST_FREE(source->data_source.mime_types, t)
      eina_stringshare_del(t);

   wl_signal_emit(&source->data_source.destroy_signal, &source->data_source);
   wl_array_release(&source->contents);
   free(source);
}

static Eina_Bool
_e_comp_wl_clipboard_offer_load(void *data, Ecore_Fd_Handler *handler)
{
   E_Comp_Wl_Clipboard_Offer *offer;
   char *p;
   size_t size;
   int len;
   int fd;

   if (!(offer = (E_Comp_Wl_Clipboard_Offer*)data))
     return ECORE_CALLBACK_CANCEL;

   fd = ecore_main_fd_handler_fd_get(handler);

   size = offer->source->contents.size;
   p = (char*)offer->source->contents.data;
   len = write(fd, p + offer->offset, size - offer->offset);
   if (len > 0) offer->offset += len;

   if ((offer->offset == size) || (len <= 0))
     {
        close(fd);
        ecore_main_fd_handler_del(handler);
        _e_comp_wl_clipboard_source_unref(offer->source);
        free(offer);
     }

   return ECORE_CALLBACK_RENEW;
}

static void
_e_comp_wl_clipboard_offer_create(E_Comp_Wl_Clipboard_Source* source, int fd)
{
   E_Comp_Wl_Clipboard_Offer *offer;

   offer = E_NEW(E_Comp_Wl_Clipboard_Offer, 1);

   offer->offset = 0;
   offer->source = source;
   source->ref++;
   offer->fd_handler =
      ecore_main_fd_handler_add(fd, ECORE_FD_WRITE,
                                _e_comp_wl_clipboard_offer_load, offer,
                                NULL, NULL);
}

static Eina_Bool
_e_comp_wl_clipboard_source_save(void *data, Ecore_Fd_Handler *handler)
{
   E_Comp_Data *cdata;
   E_Comp_Wl_Clipboard_Source *source;
   char *p;
   int len, size;

   if (!(cdata = data)) return ECORE_CALLBACK_CANCEL;
   if (!(source = (E_Comp_Wl_Clipboard_Source*)cdata->clipboard.source))
     return ECORE_CALLBACK_CANCEL;

   /* extend contents buffer */
   if ((source->contents.alloc - source->contents.size) < CLIPBOARD_CHUNK)
     {
        wl_array_add(&source->contents, CLIPBOARD_CHUNK);
        source->contents.size -= CLIPBOARD_CHUNK;
     }

   p = (char*)source->contents.data + source->contents.size;
   size = source->contents.alloc - source->contents.size;
   len = read(source->fd, p, size);

   if (len == 0)
     {
        ecore_main_fd_handler_del(handler);
        close(source->fd);
        source->fd_handler = NULL;
     }
   else if (len < 0)
     {
        _e_comp_wl_clipboard_source_unref(source);
        cdata->clipboard.source = NULL;
     }
   else
     {
        source->contents.size += len;
     }

   return ECORE_CALLBACK_RENEW;
}

static void
_e_comp_wl_clipboard_source_target_send(E_Comp_Wl_Data_Source *source EINA_UNUSED, uint32_t serial EINA_UNUSED, const char *mime_type EINA_UNUSED)
{
}

static void
_e_comp_wl_clipboard_source_send_send(E_Comp_Wl_Data_Source *source, const char *mime_type, int fd)
{
   E_Comp_Wl_Clipboard_Source* clip_source;
   char *t;

   if (!source) return;

   clip_source = container_of(source, E_Comp_Wl_Clipboard_Source, data_source);
   if (!clip_source) return;

   t = eina_list_nth(source->mime_types, 0);
   if (!strcmp(mime_type, t))
     _e_comp_wl_clipboard_offer_create(clip_source, fd);
   else
     close(fd);
}

static void
_e_comp_wl_clipboard_source_cancelled_send(E_Comp_Wl_Data_Source *source EINA_UNUSED)
{
}

static E_Comp_Wl_Clipboard_Source*
_e_comp_wl_clipboard_source_create(E_Comp_Data *cdata, const char *mime_type, uint32_t serial, int fd)
{
   E_Comp_Wl_Clipboard_Source *source;

   source = E_NEW(E_Comp_Wl_Clipboard_Source, 1);
   if (!source) return NULL;

   source->data_source.resource = NULL;
   source->data_source.target = _e_comp_wl_clipboard_source_target_send;
   source->data_source.send = _e_comp_wl_clipboard_source_send_send;
   source->data_source.cancelled = _e_comp_wl_clipboard_source_cancelled_send;

   wl_array_init(&source->contents);
   wl_signal_init(&source->data_source.destroy_signal);

   source->ref = 1;
   source->serial = serial;

   source->data_source.mime_types =
      eina_list_append(source->data_source.mime_types,
                       eina_stringshare_add(mime_type));

   source->fd_handler =
      ecore_main_fd_handler_add(fd, ECORE_FD_READ,
                                _e_comp_wl_clipboard_source_save,
                                cdata, NULL, NULL);
   if (!source->fd_handler) return NULL;

   source->fd = fd;

   return source;
}

static void
_e_comp_wl_clipboard_selection_set(struct wl_listener *listener EINA_UNUSED, void *data)
{
   E_Comp_Data *cdata;
   E_Comp_Wl_Data_Source *sel_source;
   E_Comp_Wl_Clipboard_Source *clip_source;
   int p[2];
   char *mime_type;

   if (!(cdata = data)) return;

   sel_source = (E_Comp_Wl_Data_Source*) cdata->selection.data_source;
   clip_source = (E_Comp_Wl_Clipboard_Source*) cdata->clipboard.source;

   if (!sel_source)
     {
        if (clip_source)
          _e_comp_wl_data_device_selection_set(cdata,
                                               &clip_source->data_source,
                                               clip_source->serial);
        return;
     }
   else if (sel_source->target == _e_comp_wl_clipboard_source_target_send)
     return;

   if (clip_source)
     _e_comp_wl_clipboard_source_unref(clip_source);

   cdata->clipboard.source = NULL;
   mime_type = eina_list_nth(sel_source->mime_types, 0);

   if (pipe2(p, O_CLOEXEC) == -1)
     return;

   sel_source->send(sel_source, mime_type, p[1]);

   cdata->clipboard.source =
      _e_comp_wl_clipboard_source_create(cdata, mime_type,
                                         cdata->selection.serial, p[0]);

   if (!cdata->clipboard.source)
     {
        close(p[0]);
        return;
     }
}

static void
_e_comp_wl_clipboard_destroy(E_Comp_Data *cdata)
{
   if (!cdata) return;

   wl_list_remove(&cdata->clipboard.listener.link);
}

static void
_e_comp_wl_clipboard_create(E_Comp_Data *cdata)
{
   if (!cdata) return;

   cdata->clipboard.listener.notify = _e_comp_wl_clipboard_selection_set;
   wl_signal_add(&cdata->selection.signal, &cdata->clipboard.listener);
}

EINTERN void
e_comp_wl_data_device_keyboard_focus_set(E_Comp_Data *cdata)
{
   struct wl_resource *data_device_res, *offer_res, *focus;
   E_Comp_Wl_Data_Source *source;

   if (!cdata->kbd.enabled) return;

   focus = cdata->kbd.focus;
   if (!focus) return;

   data_device_res =
      _e_comp_wl_data_find_for_client(cdata->mgr.data_resources,
                                      wl_resource_get_client(focus));
   if (!data_device_res) return;

   source = (E_Comp_Wl_Data_Source*)cdata->selection.data_source;
   if (source)
     {
        offer_res = _e_comp_wl_data_device_data_offer_create(source,
                                                             data_device_res);
        wl_data_device_send_selection(data_device_res, offer_res);
     }
}

EINTERN Eina_Bool
e_comp_wl_data_manager_init(E_Comp_Data *cdata)
{
   /* check for valid compositor data */
   if (!cdata) return EINA_FALSE;

   /* try to create global data manager */
   cdata->mgr.global =
     wl_global_create(cdata->wl.disp, &wl_data_device_manager_interface, 1,
                      cdata, _e_comp_wl_data_cb_bind_manager);
   if (!cdata->mgr.global)
     {
        ERR("Could not create global for data device manager: %m");
        return EINA_FALSE;
     }

   wl_signal_init(&cdata->selection.signal);

   /* create clipboard */
   _e_comp_wl_clipboard_create(cdata);

   return EINA_TRUE;
}

EINTERN void 
e_comp_wl_data_manager_shutdown(E_Comp_Data *cdata)
{
   /* destroy the global manager resource */
   /* if (cdata->mgr.global) wl_global_destroy(cdata->mgr.global); */

   _e_comp_wl_clipboard_destroy(cdata);
}