Key pressed and modifier



Hi!

I'm a new user of gtk/gdk and I can't cope with the
following problem. I need to handle the event
<control>m.  Here is the way I connect this signal to
my widget:
  SIGNAL_CONNECT(GTK_OBJECT(my_widget),
                 "key-press-event",
                 GTK_SIGNAL_FUNC(key_pressed_handler),
                 NULL);
and the associated handler:
void key_pressed_handler(GtkWidget *widget, 
                         GdkEventKey *event,
                         gpointer func_data _U_)
{
   /* Ctrl M on the line */
   if (event->type == GDK_KEY_PRESS)
   {
      if ((event->state == GDK_MOD2_MASK) &&
          ((event->keyval == GDK_m) || (event->keyval
== GDK_M)))
      {
         <my_treatment>
      }
   }
}

The problem is that I get nothing when I run this... I
tried with "m" only (without <control>) and it's ok.
What can I do so as the <control> modifier is taken
into account?

Regards,

Céline.

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com



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