Re: Key pressed and modifier

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

 



gtk gtk wrote:
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) &&

if ((event->state == GDK_CONTROL_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?

_______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux