GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sun Oct 04, 2015 9:19 pm

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Event buffer and simulated events.
PostPosted: Tue Mar 17, 2009 11:14 pm 

Joined: Tue Mar 17, 2009 11:06 pm
Posts: 1
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:


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");


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.

 Post subject:
PostPosted: Thu Mar 19, 2009 9:08 am 
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hello and welcome to the Gtk+ forums.

What value are you returning from your "key-press-event" callback? I think you need to return TRUE to remove current event from the cue (but I'm not sure, since I've never done anything similar to what you're doing).

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group