GdkEventButton, GdkEventMotion



Hi, i have some questions about de state field in GdkEventButton and
GdkEventMotion structures.
Here is the code i was "studying": 

gint glarea_motion_notify (GtkWidget* widget, GdkEventMotion* event) {

  int x,y;

  GdkModifierType state;

  if (event->is_hint) {
    gdk_window_get_pointer(event->window, &x, &y, &state);
  } else {
    x = (int) event->x;  // warning cast
    y = (int) event->y;  // warning cast
    state = (GdkModifierType) event->state; // warning cast 
  } 

  if (state & GDK_BUTTON1_MASK) {
    g_print ("Button 1 motion  (%d, %d)\n", x, y);
  } /* Motion while Button 1 is pressed */

...
}


And here the question:

if the program reachs this callback,that's because a motion_event has
happened,then.. why asking again for the GDK_BUTTON1_MASK?? 
I mean.. isn't it redundant?
I understand it if i would be asking for GDK_SHIFT_MASK or something
like this, but not in this case...

I use those casts because of the warnings compiling with g++ :-P

Thanks and sorry for my bad english


	Ignacio Nodal




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