Hi all,
I'm sure there's something I'm doing wrong here, but I've been beating
my head against the clutter source and API docs for so long, I can't
figure out what it is. I'm working on an app that has its own X event
handling code, and I want to be able to use clutter in the app, so I
won't be using clutter_main(). However, when I try to use
clutter_x11_handle_event() instead, nothing happens. I get no window
or anything. If I call XSync() before I start my event loop, I get a
window that comes up, but it has garbage painted on its background.
In this case, the window appears to get events (and the clutter event
filter runs), but I get nothing painted to the window.
I can't seem to find anything special that the clutter x11 backend
event init code or clutter_main() itself does that I'm missing, but
perhaps I just can't see it.
Small test case exhibiting the problem is attached. Uncommenting the
#define near the top doesn't help (or hurt). Any ideas?
Thanks,
Brian
#include stdio.h
#include clutter/clutter.h
#include clutter/x11/clutter-x11.h
#define WIDTH 480
#define HEIGHT 640
//#define DISABLE_CLUTTER_EVENT_RETRIEVAL
static ClutterX11FilterReturn
event_filter(XEvent *xev,
ClutterEvent *cev,
gpointer data)
{
printf(event_filter got event %d\n, xev-type);
return CLUTTER_X11_FILTER_CONTINUE;
}
int
main(int argc,
char **argv)
{
Display *dpy;
ClutterActor *stage, *actor;
#ifdef DISABLE_CLUTTER_EVENT_RETRIEVAL
clutter_x11_disable_event_retrieval();
#endif
clutter_init(argc, argv);
dpy = clutter_x11_get_default_display();
stage = clutter_stage_get_default();
actor = clutter_text_new_with_text(Sans 14, This is text);
clutter_container_add_actor(CLUTTER_CONTAINER(stage), actor);
clutter_actor_set_position(actor, 20, 20);
clutter_actor_show_all(stage);
#ifdef DISABLE_CLUTTER_EVENT_RETRIEVAL
XSelectInput(dpy,
clutter_x11_get_stage_window(CLUTTER_STAGE(stage)),
ButtonPressMask | ButtonReleaseMask
| KeyPressMask | KeyReleaseMask
| ExposureMask
| FocusChangeMask
| EnterWindowMask | LeaveWindowMask
| StructureNotifyMask
| PropertyChangeMask
| PointerMotionMask);
#endif
clutter_x11_add_filter(event_filter, NULL);
//clutter_main();
XSync(dpy, False);
for(;;) {
XEvent xevent;
XNextEvent(dpy, xevent);
printf(event loop got event %d\n, xevent.xany.type);
clutter_x11_handle_event(xevent);
}
return 0;
}
--
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com