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
    }

    $my_wdg->signal_connect("motion_notify_event",
                            \&cb_image_motion);

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

Regards,
Dov

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

    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.
                   http://comunidad.esware.com

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list




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