Re: from C to perl

Could you please explain what the code below is supposed to
do? If all that you want to do is to get latest coordinates
after a motion event then the following code is enough:

    sub cb_image_motion {
        my $wdg = shift;
        my $event = shift;
        my ($cx, $cy) = ($event->{x}, $event->{y});
        # Do something with $cx, $cy here


$cx, $cy will contain the coordinate of the pointer.


On Tue, Jan 15, 2002 at 06:05:59PM +0100, Sergio Rua wrote:

    Can anybody help me to translate this function from C to GtkPerl?

void motion_notify_get_coords(GdkEventMotion * event)
    XEvent ev;
    XSync(GDK_DISPLAY(), 0);
    while (XCheckTypedEvent(GDK_DISPLAY(), MotionNotify, &ev))
      event->x = ev.xmotion.x;
        event->y = ev.xmotion.y;

    Thank you!

Un Saludo,
                   Sergio Rua <srua esware com>
                   Departamento de Desarrollo.

gtk-perl-list mailing list
gtk-perl-list gnome org

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