summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--legacy/ecore/ChangeLog4
-rw-r--r--legacy/ecore/src/lib/ecore/ecore_pipe.c87
-rw-r--r--legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h2
-rw-r--r--legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c23
4 files changed, 102 insertions, 14 deletions
diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog
index 483c9d7327..0b152c6db9 100644
--- a/legacy/ecore/ChangeLog
+++ b/legacy/ecore/ChangeLog
@@ -256,3 +256,7 @@
256 256
257 * Fix epoll delete fd handling in child process - #796 257 * Fix epoll delete fd handling in child process - #796
258 258
2592011-07-07 Jihoon Kim
260
261 * Ecore_IMF: Added ecore_imf_context_cursor_location_set API
262
diff --git a/legacy/ecore/src/lib/ecore/ecore_pipe.c b/legacy/ecore/src/lib/ecore/ecore_pipe.c
index ab6ce5760c..ab0f55b04e 100644
--- a/legacy/ecore/src/lib/ecore/ecore_pipe.c
+++ b/legacy/ecore/src/lib/ecore/ecore_pipe.c
@@ -482,13 +482,9 @@ _ecore_pipe_unhandle(Ecore_Pipe *p)
482static Eina_Bool 482static Eina_Bool
483_ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__) 483_ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
484{ 484{
485 Ecore_Pipe *p; 485 Ecore_Pipe *p = (Ecore_Pipe *)data;
486 double start_time;
487 int i; 486 int i;
488 487
489 p = (Ecore_Pipe *)data;
490 start_time = ecore_time_get();
491
492 p->handling++; 488 p->handling++;
493 for (i = 0; i < 16; i++) 489 for (i = 0; i < 16; i++)
494 { 490 {
@@ -503,20 +499,28 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
503 ret = pipe_read(p->fd_read, &p->len, sizeof(p->len)); 499 ret = pipe_read(p->fd_read, &p->len, sizeof(p->len));
504 500
505 /* catch the non error case first */ 501 /* catch the non error case first */
502 /* read amount ok - nothing more to do */
506 if (ret == sizeof(p->len)) 503 if (ret == sizeof(p->len))
507 ; 504 ;
508 else if (ret > 0) 505 else if (ret > 0)
509 { 506 {
510 /* XXX What should we do here? */ 507 /* we got more data than we asked for - definite error */
511 ERR("Only read %zd bytes from the pipe, although" 508 ERR("Only read %i bytes from the pipe, although"
512 " we need to read %zd bytes.", ret, sizeof(p->len)); 509 " we need to read %i bytes.",
510 (int)ret, (int)sizeof(p->len));
513 _ecore_pipe_unhandle(p); 511 _ecore_pipe_unhandle(p);
514 return ECORE_CALLBACK_CANCEL; 512 return ECORE_CALLBACK_CANCEL;
515 } 513 }
516 else if (ret == 0) 514 else if (ret == 0)
517 { 515 {
516 /* we got no data even though we had data to read */
518 if (!p->delete_me) 517 if (!p->delete_me)
519 p->handler((void *)p->data, NULL, 0); 518 p->handler((void *)p->data, NULL, 0);
519 if (p->passed_data) free(p->passed_data);
520 p->passed_data = NULL;
521 p->already_read = 0;
522 p->len = 0;
523 p->message++;
520 pipe_close(p->fd_read); 524 pipe_close(p->fd_read);
521 p->fd_read = PIPE_FD_INVALID; 525 p->fd_read = PIPE_FD_INVALID;
522 p->fd_handler = NULL; 526 p->fd_handler = NULL;
@@ -532,9 +536,9 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
532 } 536 }
533 else 537 else
534 { 538 {
535 ERR("An unhandled error (ret: %zd errno: %d [%s])" 539 ERR("An unhandled error (ret: %i errno: %i [%s])"
536 "occurred while reading from the pipe the length", 540 "occurred while reading from the pipe the length",
537 ret, errno, strerror(errno)); 541 (int)ret, errno, strerror(errno));
538 _ecore_pipe_unhandle(p); 542 _ecore_pipe_unhandle(p);
539 return ECORE_CALLBACK_RENEW; 543 return ECORE_CALLBACK_RENEW;
540 } 544 }
@@ -545,6 +549,11 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
545 { 549 {
546 if (!p->delete_me) 550 if (!p->delete_me)
547 p->handler((void *)p->data, NULL, 0); 551 p->handler((void *)p->data, NULL, 0);
552 if (p->passed_data) free(p->passed_data);
553 p->passed_data = NULL;
554 p->already_read = 0;
555 p->len = 0;
556 p->message++;
548 pipe_close(p->fd_read); 557 pipe_close(p->fd_read);
549 p->fd_read = PIPE_FD_INVALID; 558 p->fd_read = PIPE_FD_INVALID;
550 p->fd_handler = NULL; 559 p->fd_handler = NULL;
@@ -555,8 +564,42 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
555#endif 564#endif
556 } 565 }
557 566
567 /* if somehow we got less than or equal to 0 we got an errnoneous
568 * messages so call callback with null and len we got */
569 if (p->len <= 0)
570 {
571 if (!p->delete_me)
572 p->handler((void *)p->data, NULL, p->len);
573 /* reset all values to 0 */
574 if (p->passed_data) free(p->passed_data);
575 p->passed_data = NULL;
576 p->already_read = 0;
577 p->len = 0;
578 p->message++;
579 _ecore_pipe_unhandle(p);
580 return ECORE_CALLBACK_RENEW;
581 }
582
583 /* we dont have a buffer to hold the data, so alloc it */
558 if (!p->passed_data) 584 if (!p->passed_data)
559 p->passed_data = malloc(p->len); 585 {
586 p->passed_data = malloc(p->len);
587 /* alloc failed - error case */
588 if (!p->passed_data)
589 {
590 if (!p->delete_me)
591 p->handler((void *)p->data, NULL, 0);
592 /* close the pipe */
593 p->already_read = 0;
594 p->len = 0;
595 p->message++;
596 pipe_close(p->fd_read);
597 p->fd_read = PIPE_FD_INVALID;
598 p->fd_handler = NULL;
599 _ecore_pipe_unhandle(p);
600 return ECORE_CALLBACK_CANCEL;
601 }
602 }
560 603
561 /* and read the passed data */ 604 /* and read the passed data */
562 ret = pipe_read(p->fd_read, 605 ret = pipe_read(p->fd_read,
@@ -564,6 +607,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
564 p->len - p->already_read); 607 p->len - p->already_read);
565 608
566 /* catch the non error case first */ 609 /* catch the non error case first */
610 /* if we read enough data to finish the message/buffer */
567 if (ret == (ssize_t)(p->len - p->already_read)) 611 if (ret == (ssize_t)(p->len - p->already_read))
568 { 612 {
569 if (!p->delete_me) 613 if (!p->delete_me)
@@ -575,16 +619,23 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
575 p->len = 0; 619 p->len = 0;
576 p->message++; 620 p->message++;
577 } 621 }
578 else if (ret >= 0) 622 else if (ret > 0)
579 { 623 {
624 /* more data left to read */
580 p->already_read += ret; 625 p->already_read += ret;
581 _ecore_pipe_unhandle(p); 626 _ecore_pipe_unhandle(p);
582 return ECORE_CALLBACK_RENEW; 627 return ECORE_CALLBACK_RENEW;
583 } 628 }
584 else if (ret == 0) 629 else if (ret == 0)
585 { 630 {
631 /* 0 bytes available when woken up to handle read - error */
586 if (!p->delete_me) 632 if (!p->delete_me)
587 p->handler((void *)p->data, NULL, 0); 633 p->handler((void *)p->data, NULL, 0);
634 if (p->passed_data) free(p->passed_data);
635 p->passed_data = NULL;
636 p->already_read = 0;
637 p->len = 0;
638 p->message++;
588 pipe_close(p->fd_read); 639 pipe_close(p->fd_read);
589 p->fd_read = PIPE_FD_INVALID; 640 p->fd_read = PIPE_FD_INVALID;
590 p->fd_handler = NULL; 641 p->fd_handler = NULL;
@@ -594,7 +645,10 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
594#ifndef _WIN32 645#ifndef _WIN32
595 else if ((ret == PIPE_FD_ERROR) && 646 else if ((ret == PIPE_FD_ERROR) &&
596 ((errno == EINTR) || (errno == EAGAIN))) 647 ((errno == EINTR) || (errno == EAGAIN)))
597 return ECORE_CALLBACK_RENEW; 648 {
649 _ecore_pipe_unhandle(p);
650 return ECORE_CALLBACK_RENEW;
651 }
598 else 652 else
599 { 653 {
600 ERR("An unhandled error (ret: %zd errno: %d)" 654 ERR("An unhandled error (ret: %zd errno: %d)"
@@ -610,6 +664,11 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
610 { 664 {
611 if (!p->delete_me) 665 if (!p->delete_me)
612 p->handler((void *)p->data, NULL, 0); 666 p->handler((void *)p->data, NULL, 0);
667 if (p->passed_data) free(p->passed_data);
668 p->passed_data = NULL;
669 p->already_read = 0;
670 p->len = 0;
671 p->message++;
613 pipe_close(p->fd_read); 672 pipe_close(p->fd_read);
614 p->fd_read = PIPE_FD_INVALID; 673 p->fd_read = PIPE_FD_INVALID;
615 p->fd_handler = NULL; 674 p->fd_handler = NULL;
diff --git a/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h b/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h
index 7afee2cf96..21df2a09ab 100644
--- a/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h
+++ b/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h
@@ -330,6 +330,7 @@ struct _Ecore_IMF_Context_Class
330 Ecore_IMF_Input_Panel_Layout (*input_panel_layout_get) (Ecore_IMF_Context *ctx); 330 Ecore_IMF_Input_Panel_Layout (*input_panel_layout_get) (Ecore_IMF_Context *ctx);
331 void (*input_panel_language_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang); 331 void (*input_panel_language_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang);
332 Ecore_IMF_Input_Panel_Lang (*input_panel_language_get) (Ecore_IMF_Context *ctx); 332 Ecore_IMF_Input_Panel_Lang (*input_panel_language_get) (Ecore_IMF_Context *ctx);
333 void (*cursor_location_set) (Ecore_IMF_Context *ctx, int x, int y, int w, int h);
333}; 334};
334 335
335struct _Ecore_IMF_Context_Info 336struct _Ecore_IMF_Context_Info
@@ -367,6 +368,7 @@ EAPI void ecore_imf_context_focus_in(Ecore_IMF_Context
367EAPI void ecore_imf_context_focus_out(Ecore_IMF_Context *ctx); 368EAPI void ecore_imf_context_focus_out(Ecore_IMF_Context *ctx);
368EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx); 369EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx);
369EAPI void ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos); 370EAPI void ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos);
371EAPI void ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h);
370EAPI void ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit); 372EAPI void ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit);
371EAPI void ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, Eina_Bool (*func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos), const void *data); 373EAPI void ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, Eina_Bool (*func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos), const void *data);
372EAPI void ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode); 374EAPI void ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
diff --git a/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c b/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c
index 382bf6a789..c1ecd1eca3 100644
--- a/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c
+++ b/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c
@@ -504,6 +504,29 @@ ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
504} 504}
505 505
506/** 506/**
507 * Notify the Input Method Context that a change in the cursor
508 * location has been made. The location is relative to the canvas.
509 *
510 * @param ctx An #Ecore_IMF_Context.
511 * @param x cursor x position.
512 * @param x cursor y position.
513 * @param w cursor width.
514 * @param h cursor height.
515 * @ingroup Ecore_IMF_Context_Group
516 */
517EAPI void
518ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h)
519{
520 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
521 {
522 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
523 "ecore_imf_context_cursor_position_set");
524 return;
525 }
526 if (ctx->klass->cursor_location_set) ctx->klass->cursor_location_set(ctx, x, y, w, h);
527}
528
529/**
507 * Set whether the IM context should use the preedit string 530 * Set whether the IM context should use the preedit string
508 * to display feedback. If @use_preedit is EINA_FALSE (default 531 * to display feedback. If @use_preedit is EINA_FALSE (default
509 * is EINA_TRUE), then the IM context may use some other method to display 532 * is EINA_TRUE), then the IM context may use some other method to display