From 8453698094adfe825f011735404c3270ee9599a8 Mon Sep 17 00:00:00 2001 From: "jhyuni.kang" Date: Mon, 29 Jun 2015 17:19:24 +0900 Subject: [PATCH] [efl-util][ACR-298] Modify efl-util input generator's documentation about API change Change-Id: I963a51b324a20eab491b704d9434d1aa73bbdf3b Signed-off-by: jhyuni.kang --- org.tizen.guides/html/native/ui/efl_util_n.htm | 4 +- .../html/native/ui/efl_util_tutorial_n.htm | 87 ++++++++++++++-------- 2 files changed, 58 insertions(+), 33 deletions(-) mode change 100755 => 100644 org.tizen.guides/html/native/ui/efl_util_n.htm mode change 100755 => 100644 org.tizen.tutorials/html/native/ui/efl_util_tutorial_n.htm diff --git a/org.tizen.guides/html/native/ui/efl_util_n.htm b/org.tizen.guides/html/native/ui/efl_util_n.htm old mode 100755 new mode 100644 index 2a84273..6192593 --- a/org.tizen.guides/html/native/ui/efl_util_n.htm +++ b/org.tizen.guides/html/native/ui/efl_util_n.htm @@ -156,8 +156,8 @@ void get_notification_level (Evas_Object *eo)

The EFL UTIL INPUT API (in mobile and wearable applications) allows you to generate input events (such as key and touch events).

-

First you initialize the input generator and select a device type with the efl_util_input_initialize_generator() function. To generate actual key or touch events, use the efl_util_input_generate_key() or efl_util_input_generate_touch() function.

-

When no longer needed, remember to free the input generator with the efl_util_input_deinitialize_generator() function.

+

First you must make the efl_util_inputgen_h structure and initialize the structure members with the efl_util_input_initialize_generator() function. To generate actual key or touch events, use the efl_util_input_generate_key() or efl_util_input_generate_touch() function.

+

When no longer needed, remember to free the efl_util_inputgen_h structure with the efl_util_input_deinitialize_generator() function.

diff --git a/org.tizen.tutorials/html/native/ui/efl_util_tutorial_n.htm b/org.tizen.tutorials/html/native/ui/efl_util_tutorial_n.htm old mode 100755 new mode 100644 index 0de5e1c..17b545a --- a/org.tizen.tutorials/html/native/ui/efl_util_tutorial_n.htm +++ b/org.tizen.tutorials/html/native/ui/efl_util_tutorial_n.htm @@ -176,37 +176,47 @@ void capture() void key_event_generator() {    int ret = EFL_UTIL_ERROR_NONE; +   efl_util_inputgen_h inputgen = NULL; -   ret = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_KEYBOARD); - -
  • After setting input device type, execute the efl_util_input_generate_key() function to generate key input events: -
    -   if (ret != EFL_UTIL_ERROR_NONE) 
    +   inputgen = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_KEYBOARD);
    +   if (!inputgen)
        {
    -      // Failed to initialize input generator
    -
    +      // Failed to initiailize input generator system.
           return;
        }
    -   ret = efl_util_input_generate_key("XF86Menu", 1);
    +
  • +
  • After setting input device type, execute the efl_util_input_generate_key() function to generate key input events: +
    +   ret = efl_util_input_generate_key(inputgen, "XF86Menu", 1);
        if (ret != EFL_UTIL_ERROR_NONE) 
        {
           // Failed to generate a "XF86Menu" key press event
    -      efl_util_input_deinitialize_generator();
    -
    +      ret = efl_util_input_deinitialize_generator(inputgen);
    +      if (ret != EFL_UTIL_ERROR_NONE)
    +      {
    +         // Failed to deinitialize input generator system.
    +      }
           return;
        }
    -   ret = efl_util_input_generate_key("XF86Menu", 0);
    +   ret = efl_util_input_generate_key(inputgen, "XF86Menu", 0);
        if (ret != EFL_UTIL_ERROR_NONE) 
        {
           // Failed to generate a "XF86Menu" key release event
    -      efl_util_input_deinitialize_generator();
    -
    +      ret = efl_util_input_deinitialize_generator(inputgen);
    +      if (ret != EFL_UTIL_ERROR_NONE)
    +      {
    +         // Failed to deinitialize input generator system.
    +      }
           return;
        }
     
  • Free the resources with the efl_util_input_deinitialize_generator() function:
    -   efl_util_input_deinitialize_generator();
    +   ret = efl_util_input_deinitialize_generator(inputgen);
    +   if (ret != EFL_UTIL_ERROR_NONE)
    +   {
    +      // Failed to deinitialize input generator system.
    +   }
     }
  • @@ -219,45 +229,60 @@ void key_event_generator() void touch_event_generator() {    int ret = EFL_UTIL_ERROR_NONE; +   efl_util_inputgen_h inputgen = NULL; -   ret = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN); +   inputgen = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN); +   if (!inputgen) +   { +    // Failed to initiailize input generator system. +    return; +   }
  • After setting input device type, execute the efl_util_input_generate_touch() function to generate touch input events:
    -   if (ret != EFL_UTIL_ERROR_NONE) 
    -   {
    -      // Failed to initialize input generator
    -
    -      return;
    -   }
    -   ret = efl_util_input_generate_touch(0, EFL_UTIL_INPUT_TOUCH_BEGIN, 100, 100);
    +   ret = efl_util_input_generate_touch(inputgen, 0, EFL_UTIL_INPUT_TOUCH_BEGIN, 100, 100);
        if (ret != EFL_UTIL_ERROR_NONE) 
        {
           // Failed to generate a first finger touch press event on (100, 100)
    -      efl_util_input_deinitialize_generator();
    -
    +      ret = efl_util_input_deinitialize_generator(inputgen);
    +      if (ret != EFL_UTIL_ERROR_NONE)
    +      {
    +         // Failed to deinitialize input generator system.
    +      }
           return;
        }
    -   ret = efl_util_input_generate_touch(0, EFL_UTIL_INPUT_TOUCH_UPDATE, 110, 110);
    +
    +   ret = efl_util_input_generate_touch(inputgen, 0, EFL_UTIL_INPUT_TOUCH_UPDATE, 110, 110);
        if (ret != EFL_UTIL_ERROR_NONE) 
        {
           // Failed to generate a first finger touch move event to (110, 110)
    -      efl_util_input_deinitialize_generator();
    -
    +      ret = efl_util_input_deinitialize_generator(inputgen);
    +      if (ret != EFL_UTIL_ERROR_NONE)
    +      {
    +         // Failed to deinitialize input generator system.
    +      }
           return;
        }
    -   ret = efl_util_input_generate_touch(0, EFL_UTIL_INPUT_TOUCH_END, 110, 110);
    +
    +   ret = efl_util_input_generate_touch(inputgen, 0, EFL_UTIL_INPUT_TOUCH_END, 110, 110);
        if (ret != EFL_UTIL_ERROR_NONE) 
        {
           // Failed to generate a first finger touch release event to (110, 110)
    -      efl_util_input_deinitialize_generator();
    -
    +      ret = efl_util_input_deinitialize_generator(inputgen);
    +      if (ret != EFL_UTIL_ERROR_NONE)
    +      {
    +         // Failed to deinitialize input generator system.
    +      }
           return;
        }
     
  • Free the resources with the efl_util_input_deinitialize_generator() function:
    -   efl_util_input_deinitialize_generator();
    +   ret = efl_util_input_deinitialize_generator(inputgen);
    +   if (ret != EFL_UTIL_ERROR_NONE)
    +   {
    +      // Failed to deinitialize input generator system.
    +   }
     }
  • -- 2.7.4