On Mon, 5 Jan 2015 21:24:22 +0800 (CST) bray <[email protected]> said:

> Hi everyone:
>  
> I create a window by using EFL.
> then I create rectangle and listen to keyboard events.
> when this window hava focus, it can receive key events without problem.
>  
> But when this window in background or under another window. it can not
> receive anything. how can I receive key events in anytime?
>  
> src:
>    Evas_Object *bg = NULL;
>    bg = evas_object_rectangle_add(evas);
>    evas_object_event_callback_add(bg, EVAS_CALLBACK_KEY_DOWN, TouchKeyDown,
> NULL); evas_object_focus_set(bg, EINA_TRUE);
>    evas_object_color_set(bg, 255, 0, 0, 255);
>    evas_object_move(bg, 0, 0);
>    evas_object_resize(bg, width, height);
>    evas_object_show(bg);

you can't. in an x11 world key event only go to you if:

1. your window is focused
or
2. you have grabbed the keyboard (if you grab, no other x client can get key
events - not even the wm for its keybindings for changing desktops, alt-tab
window switching, exiting/logging out etc.) - there isnt any elm api to do a
keyboard grab (imho its pretty unsociable).

(i'm ignoring the fact that there is the ability to use the xinput extension to
passively monitor events on a device - also no api for this in elm, and this
is precisely why x11 is insecure - any x client can effectively listen to any
event anywhere - eg be a keylogger and log everything you type - passwords
included).

-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    [email protected]


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
enlightenment-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-users

Reply via email to