|
I have a very simple app with just a window. I'm testing some code which grabs input from a remote and inserts events as keystrokes. Here's some sample code:
[code=]while(true){
keyVal = getRemoteData();
GdkEvent *event = gdk_event_new(GDK_KEY_PRESS);
GdkEventKey *tmpKey = (GdkEventKey*)event;
tmpKey->window = gdk_get_default_root_window();
tmpKey->send_event = 1;
tmpKey->time = CUR_TIME;
tmpKey->keyval = keyVal;
tmpKey->state = 0;
tmpKey->length = 0;
tmpKey->string = "";
tmpKey->hardware_keycode = 0;
tmpKey->group = 0;
fprintf(stderr, "Put keypress\n");
gdk_event_put(event);
usleep(20000);
}[/code]
I've added code to gdk_event_peek and my event gets placed on the queue. However, it never gets removed. I have code which peeks at the queue everytime and the first entry is always the entry I get back.
Any idea why my queue isn't emptying? I have attached a "key-press-event" signal to the window, added GDK_KEY_PRESS_MASK events to the window, and grabbed focus.
Any help would be greatly appreciated.
|