getting key-press-events



Hi,
 
I would like to get key-press-events with something like:
 
SIGNAL_CONNECT(GTK_OBJECT(my_widget),  "key-press-event",
                 GTK_SIGNAL_FUNC (key_pressed),
                 NULL);
......

void key_pressed (GtkWidget *widget, GdkEventKey *event, gpointer
func_data _U_)
{
   /* If I would like to check for <ctrl>-M */

if ((event->state & GDK_CONTROL_MASK) && ((event->keyval = = GDK_m) ||
(event->keyval = = GDK_M)))
       {
          <blablabla>
       }
    }
}
How can I make this option global?, i.e that the function key_pressed could be called at any time during the program? To which widget do I need to associate the SIGNAL_CONNECT?
 
Thanks in advance!
 
M


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