[gedit-list] Capturing key-press-event



Hi,
I was trying to capture key stroke events from the gedit window. To do
that, I wrote a call back function and tried to connect it to the
"key-press-event" of GeditView, inside the gedit_view_init() method in
gedit-view.c,

      g_signal_connect (view,
                                 "key-press-event",
                                 G_CALLBACK (gedit_myac_key_press_event),
                                 NULL);

and the call back function has the following prototype.

      gboolean gedit_myac_key_press_event(GeditView *view, GdkEventKey
* event, gpointer data);

But this produces a segmentation fault when run. I cannot identiyfy
the error. I tried connecting the signal from within GeditDocument and
GeditWindow the same way, but they all gave the same error. What I
expected was since both GeditWindow and GeditView derive from
GtkWidget, I would be able to connect my call back function to
GtkWidget's "key-press-event". But this was not successful. Can you
tell me what my method is not working? How can I correctly capture key
stroke events?

Thank you.
-- 
Regards,
Ishan Jayawardena.


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