From: Sung-Jin Park Date: Mon, 29 Apr 2019 07:51:16 +0000 (+0900) Subject: headless client: print pid with TRACE and do some modifications X-Git-Tag: accepted/tizen/unified/20190602.221747~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F67%2F207167%2F1;p=platform%2Fcore%2Fuifw%2Fpepper.git headless client: print pid with TRACE and do some modifications - add window hide callback - print PID inside TRACE() - do window hide with back key (TM1) - do focus skip unset/set with volume up/down keys Change-Id: I777870a60809c579ac529f9982ab48b970d7f56f Signed-off-by: Sung-Jin Park --- diff --git a/src/samples/headless_client.c b/src/samples/headless_client.c index 5b225bc..3ce783e 100644 --- a/src/samples/headless_client.c +++ b/src/samples/headless_client.c @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -9,7 +10,7 @@ #ifdef DEBUG #define TRACE(fmt, ...) \ do { \ - printf("[headless-client : %s] "fmt, __FUNCTION__, ##__VA_ARGS__); \ + printf("[CLIENT PID:%u][%s] "fmt, _getpid(), __FUNCTION__, ##__VA_ARGS__); \ } while (0) #else #define TRACE(fmt, ...) \ @@ -36,6 +37,37 @@ struct app_data static Eina_Array *_ecore_event_hdls; +static uint32_t _getpid() +{ + static pid_t pid = 0; + + if (pid) + { + return pid; + } + + pid = getpid(); + + return (uint32_t)pid; +} + +static void +do_action(app_data_t *client, const char *keyname) +{ + if (!strncmp("XF86Back", keyname, 8) || !strncmp("XF86AudioForward", keyname, 16)) + { + ecore_wl2_window_hide(client->win); + } + else if (!strncmp("XF86AudioRaiseVolume", keyname, 20)) + { + ecore_wl2_window_focus_skip_set(client->win, EINA_FALSE); + } + else if (!strncmp("XF86AudioLowerVolume", keyname, 20)) + { + ecore_wl2_window_focus_skip_set(client->win, EINA_TRUE); + } +} + static Eina_Bool _cb_focus_in(void *data, int type EINA_UNUSED, void *event) { @@ -82,6 +114,21 @@ _cb_window_show(void *data, int type EINA_UNUSED, void *event) } static Eina_Bool +_cb_window_hide(void *data, int type EINA_UNUSED, void *event) +{ + app_data_t *client = (app_data_t *)data; + Ecore_Wl2_Event_Window_Hide *ev = (Ecore_Wl2_Event_Window_Hide *)event; + + TRACE("\n"); + + /* TODO */ + (void) client; + (void) ev; + + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool _cb_window_lower(void *data, int type EINA_UNUSED, void *event) { app_data_t *client = (app_data_t *)data; @@ -153,7 +200,8 @@ _cb_key_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) (void) client; (void) ev; - ecore_wl2_window_hide(client->win); + do_action(client, ev->keyname); + return ECORE_CALLBACK_PASS_ON; } @@ -172,6 +220,9 @@ _event_handlers_init(app_data_t *client) h = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_SHOW, _cb_window_show, client); eina_array_push(_ecore_event_hdls, h); + h = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_HIDE, _cb_window_hide, client); + eina_array_push(_ecore_event_hdls, h); + h = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_LOWER, _cb_window_lower, client); eina_array_push(_ecore_event_hdls, h); @@ -188,6 +239,24 @@ _event_handlers_init(app_data_t *client) eina_array_push(_ecore_event_hdls, h); } +static void +usage() +{ + printf("* Usage *\n"); + + printf("[TM1]...\n"); + printf("- hide window : XF86Back\n"); + printf("- focus skip unset : XF86AudioRaiseVolume\n"); + printf("- focus skip set : XF86AudioLowerVolume\n"); + + printf("[RPi3]...\n"); + printf("- hide window : XF86AudioForward\n"); + printf("- focus skip unset : XF86AudioRaiseVolume\n"); + printf("- focus skip set : XF86AudioLowerVolume\n"); + + printf("\n"); +} + int main(int argc, char **argv) { int x, y, w, h; @@ -216,6 +285,8 @@ int main(int argc, char **argv) ecore_wl2_window_activate(client->win); ecore_wl2_window_commit(client->win, EINA_TRUE); + usage(); + /* TODO */ ecore_main_loop_begin();