clicking on a gtkdrawingarea



With  glade  I've  built  an  application  that  displays  images  on  a
gtkdrawingarea. I've added the event GDK_BUTTON_PRESS_MASK and connected
a callback to the drawingarea.

It works,  but when  I try  to see which  pixel has  been clicked  I get
strange numbers. For example:

0 1076101120
0 1079197696
0 1079197696
0 1079885824
0 1079885824
0 1078263808

The callback is

gboolean
on_drawingarea1_button_press_event     (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data)
{
  printf ("%d %d\n", event->x, event->y);
  return FALSE;
}

X is always 0, it doesn't matter where I click. 

How can I have the rigth x and y?

Thank you.

-- 
Non c'è più forza nella normalità, c'è solo monotonia.

Attachment: pgphBFD6xOXzd.pgp
Description: PGP signature



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