event handling in GDK application



Hello,

I have a GUI application written with GDK only (there are no gtk_init() and other gtk function calls). 
The main window is created using     
jWindow = gdk_window_new(NULL, &attr, GDK_WA_TITLE | GDK_WA_X
                                | GDK_WA_Y);
/* then  it sets up the graphics context
 * Sets up colors and fonts for display
 * Enables visibility of the window
 * and performs a flush */

gdk_flush();

In order to catch events this application has a loop with gdk_events_pending()

I would like to redevelop event handling in this application and write new callback functions for key_pressed 
signals, so this callback function to be called as soon as a key pressed.
Is there any way to write event callbacks in GDK application?
I tried with 
gtk_signal_connect(GTK_OBJECT(window),"key_press_event", GTK_SIGNAL_FUNC(injectKey), NULL);
But I do not know how to get a GtkWidget for GdkWindow, as I understand they are different things.
Also I tried with       
gdk_event_handler_set((GdkEventFunc)injectKey2, NULL, NULL);
But it seems, it does not work. gdk_event_pending() loop gets key_pressed events first.

Any suggestions appreciated!
Thanks,
tanya
 







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]