From 037579008c5c2a8ca86660f78c6361d53c244600 Mon Sep 17 00:00:00 2001 From: Hyoyoung Chang Date: Fri, 10 Dec 2010 17:22:42 +0900 Subject: [PATCH] remove grabkeys at scrcapture --- src/scrcapture.c | 56 +++----------------------------------------------------- 1 file changed, 3 insertions(+), 53 deletions(-) diff --git a/src/scrcapture.c b/src/scrcapture.c index 0a54fb7..774206f 100644 --- a/src/scrcapture.c +++ b/src/scrcapture.c @@ -17,7 +17,7 @@ typedef struct tag_captureimginfo { - char filename[128]; + char filename[256]; Evas_Object *eo; char *imgdata; } captureimginfo_t; @@ -112,42 +112,9 @@ static Eina_Bool scrcapture_keydown_cb(void *data, int type, void *event) { struct appdata *ad = data; Ecore_Event_Key *ev = event; - static int savedkey = 0; - static double savedtime = 0.0; -#define KEY_COMPOSITE_DURATION 1.0 - - /* FIXME : it will be changed to camera+select, not ony one key */ - if (!strcmp(ev->keyname, KEY_CAMERA) || !strcmp(ev->keyname, KEY_POWER)) - { - int curkey = 0; - DTRACE("keydown = %s\n", ev->keyname); - - struct timeval tv; - gettimeofday(&tv, NULL); - double ct = tv.tv_sec+(tv.tv_usec/1000000.0); - - if (!strcmp(ev->keyname, KEY_CAMERA)) - curkey = KEY_CAMERA; - else - curkey = KEY_POWER; - - if (((ct - savedtime) <= KEY_COMPOSITE_DURATION) && savedkey != curkey) - { - DTRACE("screen capture is triggered\n"); - capture_current_screen(ad); - } - - savedtime = ct; - savedkey = curkey; - } - else - { - savedtime = 0.0; - savedkey = 0; - if (!strcmp(ev->keyname, KEY_END)) - clipdrawer_lower_view(ad); - } + if (!strcmp(ev->keyname, KEY_END)) + clipdrawer_lower_view(ad); return ECORE_CALLBACK_PASS_ON; } @@ -162,19 +129,6 @@ int init_scrcapture(void *data) Ecore_X_Display *xdisp = ecore_x_display_get(); Ecore_X_Window xwin = (Ecore_X_Window)ecore_evas_window_get(ecore_evas_ecore_evas_get(ad->evas)); -/* - result = utilx_grab_key(xdisp, xwin, KEY_SELECT, SHARED_GRAB); - if(!!result) - DTRACE("KEY_HOME key grab is failed\n"); -*/ - result = utilx_grab_key(xdisp, xwin, KEY_POWER, SHARED_GRAB); - if(!!result) - DTRACE("KEY_HOME key grab is failed\n"); - - result = utilx_grab_key(xdisp, xwin, KEY_CAMERA, SHARED_GRAB); - if(!!result) - DTRACE( "KEY_CAMERA key grab is failed\n"); - ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, scrcapture_keydown_cb, ad); return 0; @@ -186,10 +140,6 @@ void close_scrcapture(void *data) Ecore_X_Display *xdisp = ecore_x_display_get(); Ecore_X_Window xwin = (Ecore_X_Window)ecore_evas_window_get(ecore_evas_ecore_evas_get(ad->evas)); - -// utilx_ungrab_key(xdisp, xwin, KEY_SELECT); - utilx_ungrab_key(xdisp, xwin, KEY_POWER); - utilx_ungrab_key(xdisp, xwin, KEY_CAMERA); } -- 2.7.4