summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2014-12-31 14:01:01 +0200
committerDaniel Hirt <daniel.hirt@samsung.com>2015-01-05 11:16:33 +0200
commite3ca4a895e30d5c18e0fc2523354a9802b6b06f2 (patch)
tree9d6ebb179794be8eb1fd7bba228b3a5ee8d2d6ce
parenta87dbd388df02a02f54642703cb63d89f56c3fe5 (diff)
Elm_Cnp: Add SelectionClear Handlers for ECORE_Xdevs/herdsman/entry_sel_to_elm_cnp
Adds missing SelectionClear handlers.
-rw-r--r--src/lib/elm_cnp.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 4a9eff8a3..fb9efdcaf 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -253,6 +253,7 @@ typedef struct _X11_Cnp_Atom X11_Cnp_Atom;
253typedef Eina_Bool (*X11_Converter_Fn_Cb) (char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize); 253typedef Eina_Bool (*X11_Converter_Fn_Cb) (char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize);
254typedef int (*X11_Response_Handler_Cb) (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *); 254typedef int (*X11_Response_Handler_Cb) (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *);
255typedef int (*X11_Notify_Handler_Cb) (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *); 255typedef int (*X11_Notify_Handler_Cb) (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *);
256typedef int (*X11_Clear_Handler_Cb) (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Clear *);
256 257
257struct _X11_Cnp_Selection 258struct _X11_Cnp_Selection
258{ 259{
@@ -285,6 +286,7 @@ struct _X11_Cnp_Atom
285 X11_Converter_Fn_Cb converter; 286 X11_Converter_Fn_Cb converter;
286 X11_Response_Handler_Cb response; 287 X11_Response_Handler_Cb response;
287 X11_Notify_Handler_Cb notify; 288 X11_Notify_Handler_Cb notify;
289 X11_Clear_Handler_Cb clear;
288 /* Atom */ 290 /* Atom */
289 Ecore_X_Atom atom; 291 Ecore_X_Atom atom;
290}; 292};
@@ -304,6 +306,7 @@ static int _x11_notify_handler_targets (X11_Cnp_Selection *sel, Eco
304static int _x11_notify_handler_text (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); 306static int _x11_notify_handler_text (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify);
305static int _x11_notify_handler_image (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); 307static int _x11_notify_handler_image (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify);
306static int _x11_notify_handler_uri (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); 308static int _x11_notify_handler_uri (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify);
309static int _x11_clear_handler_text (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Clear *clear);
307//static int _x11_notify_handler_html (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); 310//static int _x11_notify_handler_html (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify);
308static int _x11_vcard_receive (X11_Cnp_Selection *sed, Ecore_X_Event_Selection_Notify *notify); 311static int _x11_vcard_receive (X11_Cnp_Selection *sed, Ecore_X_Event_Selection_Notify *notify);
309static Eina_Bool _x11_dnd_enter (void *data EINA_UNUSED, int etype EINA_UNUSED, void *ev); 312static Eina_Bool _x11_dnd_enter (void *data EINA_UNUSED, int etype EINA_UNUSED, void *ev);
@@ -338,6 +341,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
338 _x11_targets_converter, 341 _x11_targets_converter,
339 _x11_response_handler_targets, 342 _x11_response_handler_targets,
340 _x11_notify_handler_targets, 343 _x11_notify_handler_targets,
344 NULL,
341 0 345 0
342 }, 346 },
343 [CNP_ATOM_ATOM] = { 347 [CNP_ATOM_ATOM] = {
@@ -346,6 +350,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
346 _x11_targets_converter, 350 _x11_targets_converter,
347 _x11_response_handler_targets, 351 _x11_response_handler_targets,
348 _x11_notify_handler_targets, 352 _x11_notify_handler_targets,
353 NULL,
349 0 354 0
350 }, 355 },
351 [CNP_ATOM_XELM] = { 356 [CNP_ATOM_XELM] = {
@@ -354,6 +359,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
354 _x11_general_converter, 359 _x11_general_converter,
355 NULL, 360 NULL,
356 NULL, 361 NULL,
362 NULL,
357 0 363 0
358 }, 364 },
359 [CNP_ATOM_text_uri] = { 365 [CNP_ATOM_text_uri] = {
@@ -362,6 +368,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
362 _x11_general_converter, 368 _x11_general_converter,
363 NULL, 369 NULL,
364 _x11_notify_handler_uri, 370 _x11_notify_handler_uri,
371 NULL,
365 0 372 0
366 }, 373 },
367 [CNP_ATOM_text_urilist] = { 374 [CNP_ATOM_text_urilist] = {
@@ -370,13 +377,17 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
370 _x11_general_converter, 377 _x11_general_converter,
371 NULL, 378 NULL,
372 _x11_notify_handler_uri, 379 _x11_notify_handler_uri,
380 NULL,
373 0 381 0
374 }, 382 },
375 [CNP_ATOM_text_x_vcard] = { 383 [CNP_ATOM_text_x_vcard] = {
376 "text/x-vcard", 384 "text/x-vcard",
377 ELM_SEL_FORMAT_VCARD, 385 ELM_SEL_FORMAT_VCARD,
378 _x11_vcard_send, NULL, 386 _x11_vcard_send,
379 _x11_vcard_receive, 0 387 NULL,
388 _x11_vcard_receive,
389 NULL,
390 0
380 }, 391 },
381 [CNP_ATOM_image_png] = { 392 [CNP_ATOM_image_png] = {
382 "image/png", 393 "image/png",
@@ -384,6 +395,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
384 _x11_image_converter, 395 _x11_image_converter,
385 NULL, 396 NULL,
386 _x11_notify_handler_image, 397 _x11_notify_handler_image,
398 NULL,
387 0 399 0
388 }, 400 },
389 [CNP_ATOM_image_jpeg] = { 401 [CNP_ATOM_image_jpeg] = {
@@ -392,6 +404,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
392 _x11_image_converter, 404 _x11_image_converter,
393 NULL, 405 NULL,
394 _x11_notify_handler_image,/* Raw image data is the same */ 406 _x11_notify_handler_image,/* Raw image data is the same */
407 NULL,
395 0 408 0
396 }, 409 },
397 [CNP_ATOM_image_bmp] = { 410 [CNP_ATOM_image_bmp] = {
@@ -400,6 +413,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
400 _x11_image_converter, 413 _x11_image_converter,
401 NULL, 414 NULL,
402 _x11_notify_handler_image,/* Raw image data is the same */ 415 _x11_notify_handler_image,/* Raw image data is the same */
416 NULL,
403 0 417 0
404 }, 418 },
405 [CNP_ATOM_image_gif] = { 419 [CNP_ATOM_image_gif] = {
@@ -408,6 +422,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
408 _x11_image_converter, 422 _x11_image_converter,
409 NULL, 423 NULL,
410 _x11_notify_handler_image,/* Raw image data is the same */ 424 _x11_notify_handler_image,/* Raw image data is the same */
425 NULL,
411 0 426 0
412 }, 427 },
413 [CNP_ATOM_image_tiff] = { 428 [CNP_ATOM_image_tiff] = {
@@ -416,6 +431,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
416 _x11_image_converter, 431 _x11_image_converter,
417 NULL, 432 NULL,
418 _x11_notify_handler_image,/* Raw image data is the same */ 433 _x11_notify_handler_image,/* Raw image data is the same */
434 NULL,
419 0 435 0
420 }, 436 },
421 [CNP_ATOM_image_svg] = { 437 [CNP_ATOM_image_svg] = {
@@ -424,6 +440,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
424 _x11_image_converter, 440 _x11_image_converter,
425 NULL, 441 NULL,
426 _x11_notify_handler_image,/* Raw image data is the same */ 442 _x11_notify_handler_image,/* Raw image data is the same */
443 NULL,
427 0 444 0
428 }, 445 },
429 [CNP_ATOM_image_xpm] = { 446 [CNP_ATOM_image_xpm] = {
@@ -432,6 +449,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
432 _x11_image_converter, 449 _x11_image_converter,
433 NULL, 450 NULL,
434 _x11_notify_handler_image,/* Raw image data is the same */ 451 _x11_notify_handler_image,/* Raw image data is the same */
452 NULL,
435 0 453 0
436 }, 454 },
437 [CNP_ATOM_image_tga] = { 455 [CNP_ATOM_image_tga] = {
@@ -440,6 +458,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
440 _x11_image_converter, 458 _x11_image_converter,
441 NULL, 459 NULL,
442 _x11_notify_handler_image,/* Raw image data is the same */ 460 _x11_notify_handler_image,/* Raw image data is the same */
461 NULL,
443 0 462 0
444 }, 463 },
445 [CNP_ATOM_image_ppm] = { 464 [CNP_ATOM_image_ppm] = {
@@ -448,6 +467,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
448 _x11_image_converter, 467 _x11_image_converter,
449 NULL, 468 NULL,
450 _x11_notify_handler_image,/* Raw image data is the same */ 469 _x11_notify_handler_image,/* Raw image data is the same */
470 NULL,
451 0 471 0
452 }, 472 },
453/* 473/*
@@ -474,6 +494,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
474 _x11_text_converter, 494 _x11_text_converter,
475 NULL, 495 NULL,
476 _x11_notify_handler_text, 496 _x11_notify_handler_text,
497 _x11_clear_handler_text,
477 0 498 0
478 }, 499 },
479 [CNP_ATOM_STRING] = { 500 [CNP_ATOM_STRING] = {
@@ -482,6 +503,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
482 _x11_text_converter, 503 _x11_text_converter,
483 NULL, 504 NULL,
484 _x11_notify_handler_text, 505 _x11_notify_handler_text,
506 _x11_clear_handler_text,
485 0 507 0
486 }, 508 },
487 [CNP_ATOM_COMPOUND_TEXT] = { 509 [CNP_ATOM_COMPOUND_TEXT] = {
@@ -490,6 +512,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
490 _x11_text_converter, 512 _x11_text_converter,
491 NULL, 513 NULL,
492 _x11_notify_handler_text, 514 _x11_notify_handler_text,
515 _x11_clear_handler_text,
493 0 516 0
494 }, 517 },
495 [CNP_ATOM_TEXT] = { 518 [CNP_ATOM_TEXT] = {
@@ -498,6 +521,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
498 _x11_text_converter, 521 _x11_text_converter,
499 NULL, 522 NULL,
500 _x11_notify_handler_text, 523 _x11_notify_handler_text,
524 _x11_clear_handler_text,
501 0 525 0
502 }, 526 },
503 [CNP_ATOM_text_plain_utf8] = { 527 [CNP_ATOM_text_plain_utf8] = {
@@ -506,6 +530,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
506 _x11_text_converter, 530 _x11_text_converter,
507 NULL, 531 NULL,
508 _x11_notify_handler_text, 532 _x11_notify_handler_text,
533 _x11_clear_handler_text,
509 0 534 0
510 }, 535 },
511 [CNP_ATOM_text_plain] = { 536 [CNP_ATOM_text_plain] = {
@@ -514,6 +539,7 @@ static X11_Cnp_Atom _x11_atoms[CNP_N_ATOMS] = {
514 _x11_text_converter, 539 _x11_text_converter,
515 NULL, 540 NULL,
516 _x11_notify_handler_text, 541 _x11_notify_handler_text,
542 _x11_clear_handler_text,
517 0 543 0
518 }, 544 },
519}; 545};
@@ -586,6 +612,16 @@ _x11_selection_clear(void *udata EINA_UNUSED, int type EINA_UNUSED, void *event)
586 if (sel->requestwidget) 612 if (sel->requestwidget)
587 evas_object_event_callback_del_full(sel->requestwidget, EVAS_CALLBACK_DEL, 613 evas_object_event_callback_del_full(sel->requestwidget, EVAS_CALLBACK_DEL,
588 _x11_sel_obj_del2, sel); 614 _x11_sel_obj_del2, sel);
615 for (i = 0; i < CNP_N_ATOMS; i++)
616 {
617 if (_x11_atoms[i].clear)
618 {
619 cnp_debug("Found something: %s\n", _x11_atoms[i].name);
620 _x11_atoms[i].clear(sel, ev);
621 }
622 else cnp_debug("Ignored: No handler!\n");
623 }
624 return ECORE_CALLBACK_PASS_ON;
589 sel->widget = NULL; 625 sel->widget = NULL;
590 sel->requestwidget = NULL; 626 sel->requestwidget = NULL;
591 627
@@ -874,6 +910,13 @@ end:
874 return 0; 910 return 0;
875} 911}
876 912
913static int
914_x11_clear_handler_text(X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Clear *clear EINA_UNUSED)
915{
916 elm_entry_select_none(sel->widget);
917 return 0;
918}
919
877/** 920/**
878 * So someone is pasting an image into my entry or widget... 921 * So someone is pasting an image into my entry or widget...
879 */ 922 */