Hi, On Sun, Feb 13, 2011 at 10:32 AM, John Dovers <[email protected]> wrote: > I am trying to propagate X11 events, triggered by Xlib, to Evas. In my > application, I have a main event loop which intercepts the X11 events and > forwards the key events to Evas: > > while (true) { > XNextEvent(m_display, &event); > > if (event.type == KeyPress) { > char* s = XKeysymToString(XKeycodeToKeysym(event.xkey.display, > event.xkey.keycode, 0)); > > if (s) { > evas_event_feed_key_down(m_canvas, s, s, NULL, NULL, 0, NULL); > } > } > ... same for KeyDown ... > } > > Then, in my Evas logic I register a key calback to intercept key up and key > down events: > > void keyUpCallback(void *data, Evas *e, Evas_Object *obj, void *event_info) { > std::cout << "KEY UP!" << std::endl; > } > > evas_object_event_callback_add((Evas_Object*)canvas, EVAS_CALLBACK_KEY_UP, > keyUpCallback, NULL); > > However, the callback is never called. > > Could you please point out where I am wrong?
The callback should be set on an Evas_Object, not on the canvas. Then you should give the focus to that object, so that Evas does forward event to it. And your code is reponsible of object focus. As you try to avoid Ecore at all cost, you should maybe give a look at expedite source code that does all of this stuff itself also. > On a sidenote, is Evas thread-safe? That is, is it allowed and valid to > access an Evas* and Evas_Object* concurrently? No, not at all. That's why Ecore does provide Ecore_Thread with a clean separation for logic outside of the main loop (in a thread) and inside the main loop (allowed to modify canvas and call all efl function). Btw I am interested to know why you try to avoid Ecore ? It's quite configurable and you can disable a lot of stuff in it if you think it is to big for you. It's also possible to link all 1.0 library statically with your binary, then strip the result and have a small, self contained executable that would be well below 3MB (That's the number for Elixir JS bindings build with all the EFL in static). Anyway enjoy the use of the EFL :-) -- Cedric BAIL ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
