GdkModifierType



Hi,
I've got a question about the field state in the  GdkEventMotion structure.
The GDK Reference Manual says:
"guint state is a bit-mask representing the state of the modifier keys (e.g.
Control, Shift and Alt) and the pointer buttons. See GdkModifierType."
But... which is the default value of "state"??

I mean, in the followin example code (yes, it's a part gtk_glarea_demo.c
:-P) ...
/***/
gint glarea_motion_notify (GtkWidget* widget, GdkEventMotion* event) {
  int x;
  int y;
  GdkModifierType state;
  if (event->is_hint) {
    gdk_window_get_pointer(event->window, &x, &y, &state);
  } else {
    x = event->x;
    y = event->y;
    state = event->state;
  }
  if (state & GDK_BUTTON1_MASK) {
    /* Mouse button 1 is engaged */
    g_print ("Button 1 motion  (%d, %d)\n", x, y);
  }
  return TRUE;
}
/***/

... if  I only ask for state "if (state) { ... } " the if-condition is also
passed.
Isn't it supposed to be a bit-mask representing the state of the modifier
keys (e.g. Control, Shift and Alt) and the pointer buttons. I'm just moving
the mouse!!!

Thanks for all,

-----------------------------------------------
Ignacio Nodal Suarez
Escuela Universitaria de Informatica (ULPGC)
Las Palmas de G.C. - Spain






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