Implementing Tap and Double Tap Gestures on Tizen Table

Original Created Apr 22, 2016 | Regeneration Apr 22, 2026

I'm developing a Tizen native application where I need to distinguish between tap and double tap gestures on a table. I'm following the official documentation for handling touch gestures.

Here's my current implementation:

Evas_Object *r;
Evas_Object *g;

r = evas_object_rectangle_add(evas_object_evas_get(parent));
evas_object_move(r, 0, 0);
evas_object_color_set(r, 0, 0, 0, 0);
evas_object_resize(r, 360, 360);

// Create gesture layer and attach to object
g = elm_gesture_layer_add(parent);
elm_gesture_layer_attach(g, r);
evas_object_show(r);

while (1) {
    dlog_print(DLOG_INFO, "STYLE", "thread run");
    
    // Single tap callback
    elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TAPS, ELM_GESTURE_STATE_END,
                            n_finger_tap_end, NULL);
    
    // Double tap callback
    elm_gesture_layer_cb_set(g, ELM_GESTURE_N_DOUBLE_TAPS,
                            ELM_GESTURE_STATE_END, dbl_click_end, NULL);
    
    usleep(3000);
    
    if (pd->data == 1)
        ecore_thread_cancel(thread);
    if (ecore_thread_check(thread))
        break;
}

The parameter parent is a table. My goal is to stop the thread by setting pd->data to 1 when either tap or double tap is detected. However, while the thread runs normally, the tap and double tap inputs aren't being registered. What could be the issue?

Problem Understanding

The main issue is that the gesture callbacks are being repeatedly set inside a while loop, which is unnecessary and potentially problematic. The gesture layer callbacks should be set up once, not continuously in a loop.

Solution Methods

  1. Remove gesture setup from the loop: The gesture callbacks should be registered only once, outside any loops.
  2. Implement proper callback functions: The actual tap handling logic should be in the callback functions (n_finger_tap_end and dbl_click_end).
  3. Ensure proper object hierarchy: Make sure the gesture layer is properly attached to the visible object.

Code Examples

Here's a corrected implementation:

// Set up gesture callbacks once, outside any loops
elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TAPS, ELM_GESTURE_STATE_END,
                        n_finger_tap_end, NULL);
elm_gesture_layer_cb_set(g, ELM_GESTURE_N_DOUBLE_TAPS, ELM_GESTURE_STATE_END,
                        dbl_click_end, NULL);

// Example callback implementations
static Evas_Event_Flags
n_finger_tap_end(void *data, void *event_info)
{
    // Handle single tap
    pd->data = 1;
    return EVAS_EVENT_FLAG_ON_HOLD;
}

static Evas_Event_Flags
dbl_click_end(void *data, void *event_info)
{
    // Handle double tap
    pd->data = 1;
    return EVAS_EVENT_FLAG_ON_HOLD;
}

Additional Tips

  1. Make sure the rectangle object (r) is properly sized and positioned where you expect taps.
  2. Verify that the parent object is visible and properly set up.
  3. Consider using the Tizen Studio's event logging to debug gesture events.
  4. For more details on gesture handling, refer to the official documentation.

Customize your cookie preferences

You can enable or disable non-essential cookies. Essential cookies are always on to ensure the site works properly and to keep you signed in.

Necessary

These cookies are necessary for the website to function properly and cannot be switched off. They help with things like logging in and setting your privacy preferences.

Always on

Analytics

These cookies help us improve the site by tracking which pages are most popular and how visitors move around the site.

Enable analytics cookies
Public Forum Public Forum
Employees only. Please sign in with your company account.