언어 설정

Menu
Sites
Language
[ANSWERED] Wearable: Is eext_win_keygrab_set() supported? What is the alternative for wearable?

This function is discussed here: https://developer.tizen.org/development/guides/native-application/user-interface/efl/hardware-input-handling/grabbing-hardware-key-events

In this page, it says that this function is supported since wearable 2.3.1 (I'm on wearable 2.3.2, so that's the only thing I'm interested at).

Also here: https://developer.tizen.org/development/api-references/native-application?redirect=https://developer.tizen.org/dev-guide/3.0.0/org.tizen.native.wearable.apireference/group__EFL__EXTENSION__HARDWARE__KEYEVENT__GROUP.html

This says that it is supported since Tizen 3.0. However in my Tizen Studio's copy of the same Doxygen doc, it says it is being supported since Tizen 2.4.

I did "grep -RF keygrab" on my platform's rootstraps. It returned nothing.

So I assume it is not supported, since this function is not declared in any header files or in any shared libraries. So, is there any other function I can use to achieve the same function? I need to hook the "Back" button without getting my app to quit.

Thank you.

Edited by: James B on 15 2월, 2017
답변 바로가기

Responses

6 댓글
Yasin Ali

Hi~,

 I think it is best to develop a sample app and test its support.

So, make a sample app. Let's know your progress.

James B

Thank you Yasin.

When I posted this question, I already wrote a test code, that's how I know that it doesn't seem to be supported regardless of what the docs says. If I put eext_win_keygrab_set() call in my test code, the code doesn't compile at all ("undefined function").

Yet, without this function, I cannot stop the "back" button from actually putting my app to the background. What I need to do is to be notified when the user press the Back button, but without putting my app to the back.

GEUNSOO KIM

It looks like that "since 2.4" is correct one. the prior platforms do not have the function in their SDK.

I could find the function only on 2.4 and 3.0.

James B

Thank you Geunsoo.

Is there an alternative API which provides similar function on 2.3.2? Or am I out of luck altogether?

Mark as answer
Onur Şahin

Grabbing "back" button is supported since 2.3.1 by using efl_extension.h :: eext_object_event_callback_add(). In fact it is in some of the sample projects. From BasicUI sample;

#include <efl_extension.h>

/* ... */

static void win_back_cb(void *data, Evas_Object *obj, void *event_info) {
    //to exit on back key
    ui_app_exit();

    //to hide the window on back key
    appdata_s *ad = data; 
	elm_win_lower(ad->win);

    //or do whatever you want
    do_stuff();
}

static void
create_base_gui(appdata_s *ad)
{
    /* Window */
	ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
	elm_win_autodel_set(ad->win, EINA_TRUE);

	if (elm_win_wm_rotation_supported_get(ad->win)) {
		int rots[4] = { 0, 90, 180, 270 };
		elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
	}

	evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
                   eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);

	/* Conformant */
	ad->conform = elm_conformant_add(ad->win);
	elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
	elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
	evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_win_resize_object_add(ad->win, ad->conform);
	evas_object_show(ad->conform);

	/* Label */
	ad->label = elm_label_add(ad->conform);
	elm_object_text_set(ad->label, "<align=center>Hello Tizen</align>");
	evas_object_size_hint_weight_set(ad->label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_object_content_set(ad->conform, ad->label);

	/* Show window after base gui is set up */
	evas_object_show(ad->win);
}

static bool
app_create(void *data)
{
    /* Hook to take necessary actions before main event loop starts
		Initialize UI resources and application's data
		If this function returns true, the main loop of application starts
		If this function returns false, the application is terminated */
	appdata_s *ad = data;

	create_base_gui(ad);

	return true;
}

/**/

On the other hand, grabbing the home button requires 2.4.

James B

Excellent answer Onur. Combining this with ecore_event_handler_add enables me to grab the back key.

Thank you.